diff options
author | Dean Camera <[email protected]> | 2010-03-15 05:38:29 +0000 |
---|---|---|
committer | Dean Camera <[email protected]> | 2010-03-15 05:38:29 +0000 |
commit | b2bdfe437762a9a88b4de1cada7f794b255b0d97 (patch) | |
tree | 2cd59535488dacfc88fb608ca0ea72c89b52c732 | |
parent | 4f9dd142e7691a88adae271433ff6850b55cbfbe (diff) | |
download | qmk_firmware-b2bdfe437762a9a88b4de1cada7f794b255b0d97.tar.gz qmk_firmware-b2bdfe437762a9a88b4de1cada7f794b255b0d97.zip |
Improve documentation for the ADC and TWI drivers.
-rw-r--r-- | LUFA/Drivers/Peripheral/AVRU4U6U7/ADC.h | 10 | ||||
-rw-r--r-- | LUFA/Drivers/Peripheral/TWI.c | 2 |
2 files changed, 10 insertions, 2 deletions
diff --git a/LUFA/Drivers/Peripheral/AVRU4U6U7/ADC.h b/LUFA/Drivers/Peripheral/AVRU4U6U7/ADC.h index 4b120aef62..9ab65af53f 100644 --- a/LUFA/Drivers/Peripheral/AVRU4U6U7/ADC.h +++ b/LUFA/Drivers/Peripheral/AVRU4U6U7/ADC.h @@ -148,7 +148,7 @@ #define ADC_CHANNEL7 (0x07 << MUX0)
/** MUX mask define for the internal 1.1V bandgap channel of the ADC. See \ref ADC_StartReading and \ref ADC_GetChannelReading. */
- #define ADC_1100MV_BANDGAP 0x1E
+ #define ADC_1100MV_BANDGAP (0x1E << MUX0)
#if (defined(__AVR_ATmega16U4__) || defined(__AVR_ATmega32U4__) || defined(__DOXYGEN__))
/** MUX mask define for the ADC8 channel of the ADC. See \ref ADC_StartReading and \ref ADC_GetChannelReading.
@@ -289,6 +289,10 @@ * Once executed, the conversion status can be determined via the \ref ADC_IsReadingComplete() macro and
* the result read via the \ref ADC_GetResult() macro.
*
+ * If the ADC has been initialized in free running mode, calling this function once will begin the repeated
+ * conversions. If the ADC is in single conversion mode (or the channel to convert from is to be changed),
+ * this function must be called each time a conversion is to take place.
+ *
* \param[in] MUXMask Mask comprising of an ADC channel mask, reference mask and adjustment mask
*/
static inline void ADC_StartReading(const uint16_t MUXMask)
@@ -308,6 +312,10 @@ /** Performs a complete single reading from channel, including a polling spin-loop to wait for the
* conversion to complete, and the returning of the converted value.
*
+ * \note For free running mode, the automated conversions should be initialized with a single call
+ * to \ref ADC_StartReading() to select the channel and begin the automated conversions, and
+ * the results read directly from the \ref ADC_GetResult() instead to reduce overhead.
+ *
* \param[in] MUXMask Mask comprising of an ADC channel mask, reference mask and adjustment mask
*/
static inline uint16_t ADC_GetChannelReading(const uint16_t MUXMask) ATTR_WARN_UNUSED_RESULT;
diff --git a/LUFA/Drivers/Peripheral/TWI.c b/LUFA/Drivers/Peripheral/TWI.c index 7986679972..9e0c20dc0a 100644 --- a/LUFA/Drivers/Peripheral/TWI.c +++ b/LUFA/Drivers/Peripheral/TWI.c @@ -17,7 +17,7 @@ bool TWI_StartTransmission(uint8_t SlaveAddress, uint8_t TimeoutMS) TWCR = ((1 << TWINT) | (1 << TWSTA) | (1 << TWEN));
TimeoutRemaining = (TimeoutMS * 100);
- while (TimeoutRemaining-- && !BusCaptured)
+ while (TimeoutRemaining-- && !(BusCaptured))
{
if (TWCR & (1 << TWINT))
{
|