Fix compile errors from the changes to the SerialStream and board Temperature drivers.

pull/1469/head
Dean Camera 14 years ago
parent c05e7cd7d9
commit 6026b9128b

@ -106,7 +106,7 @@
* must be pre-initialized before this macro is run and linked to an output device, such as the AVR's USART * must be pre-initialized before this macro is run and linked to an output device, such as the AVR's USART
* peripheral. * peripheral.
* *
* The output takes the form "{FILENAME}: Function {FUNCTION NAME}, Line {LINE NUMBER}: Assertion {x} failed." * The output takes the form "{FILENAME}: Function {FUNCTION NAME}, Line {LINE NUMBER}: Assertion {Condition} failed."
* *
* \param[in] Condition Condition that will be evaluated, * \param[in] Condition Condition that will be evaluated,
* *
@ -114,7 +114,7 @@
*/ */
#define STDOUT_ASSERT(Condition) MACROS{ if (!(x)) { printf_P(PSTR("%s: Function \"%s\", Line %d: " \ #define STDOUT_ASSERT(Condition) MACROS{ if (!(x)) { printf_P(PSTR("%s: Function \"%s\", Line %d: " \
"Assertion \"%s\" failed.\r\n"), \ "Assertion \"%s\" failed.\r\n"), \
__FILE__, __func__, __LINE__, #x); } }MACROE __FILE__, __func__, __LINE__, #Condition); } }MACROE
/** Forces GCC to use pointer indirection (via the AVR's pointer register pairs) when accessing the given /** Forces GCC to use pointer indirection (via the AVR's pointer register pairs) when accessing the given
* struct pointer. In some cases GCC will emit non-optimal assembly code when accessing a structure through * struct pointer. In some cases GCC will emit non-optimal assembly code when accessing a structure through

@ -30,7 +30,7 @@
#include "Temperature.h" #include "Temperature.h"
static const uint16_t PROGMEM Temperature_Lookup[] = { static const uint16_t PROGMEM Temperature_Lookup[TEMP_TABLE_SIZE] = {
0x3B4, 0x3B0, 0x3AB, 0x3A6, 0x3A0, 0x39A, 0x394, 0x38E, 0x388, 0x381, 0x37A, 0x373, 0x3B4, 0x3B0, 0x3AB, 0x3A6, 0x3A0, 0x39A, 0x394, 0x38E, 0x388, 0x381, 0x37A, 0x373,
0x36B, 0x363, 0x35B, 0x353, 0x34A, 0x341, 0x338, 0x32F, 0x325, 0x31B, 0x311, 0x307, 0x36B, 0x363, 0x35B, 0x353, 0x34A, 0x341, 0x338, 0x32F, 0x325, 0x31B, 0x311, 0x307,
0x2FC, 0x2F1, 0x2E6, 0x2DB, 0x2D0, 0x2C4, 0x2B8, 0x2AC, 0x2A0, 0x294, 0x288, 0x27C, 0x2FC, 0x2F1, 0x2E6, 0x2DB, 0x2D0, 0x2C4, 0x2B8, 0x2AC, 0x2A0, 0x294, 0x288, 0x27C,
@ -50,7 +50,7 @@ int8_t Temperature_GetTemperature(void)
if (Temp_ADC > pgm_read_word(&Temperature_Lookup[0])) if (Temp_ADC > pgm_read_word(&Temperature_Lookup[0]))
return TEMP_MIN_TEMP; return TEMP_MIN_TEMP;
for (uint16_t Index = 0; Index < (sizeof(Temperature_Lookup) / sizeof(Temperature_Lookup[0])); Index++) for (uint16_t Index = 0; Index < TEMP_TABLE_SIZE; Index++)
{ {
if (Temp_ADC > pgm_read_word(&Temperature_Lookup[Index])) if (Temp_ADC > pgm_read_word(&Temperature_Lookup[Index]))
return (Index + TEMP_TABLE_OFFSET_DEGREES); return (Index + TEMP_TABLE_OFFSET_DEGREES);

@ -92,12 +92,15 @@
/** ADC channel MUX mask for the temperature sensor. */ /** ADC channel MUX mask for the temperature sensor. */
#define TEMP_ADC_CHANNEL_MASK ADC_CHANNEL0 #define TEMP_ADC_CHANNEL_MASK ADC_CHANNEL0
/** Size of the temperature sensor lookup table, in lookup values */
#define TEMP_TABLE_SIZE 120
/** Minimum returnable temperature from the \ref Temperature_GetTemperature() function. */ /** Minimum returnable temperature from the \ref Temperature_GetTemperature() function. */
#define TEMP_MIN_TEMP TEMP_TABLE_OFFSET #define TEMP_MIN_TEMP TEMP_TABLE_OFFSET_DEGREES
/** Maximum returnable temperature from the \ref Temperature_GetTemperature() function. */ /** Maximum returnable temperature from the \ref Temperature_GetTemperature() function. */
#define TEMP_MAX_TEMP ((TEMP_TABLE_SIZE - 1) + TEMP_TABLE_OFFSET) #define TEMP_MAX_TEMP ((TEMP_TABLE_SIZE - 1) + TEMP_TABLE_OFFSET_DEGREES)
/* Inline Functions: */ /* Inline Functions: */
/** Initialises the temperature sensor driver, including setting up the appropriate ADC channel. /** Initialises the temperature sensor driver, including setting up the appropriate ADC channel.

@ -97,6 +97,13 @@
#endif #endif
/* Public Interface - May be used in end-application: */ /* Public Interface - May be used in end-application: */
/* External Variables: */
/** Named stream for the USART, once \ref SerialStream_Init() has been called. This may be used with the
* file based stream functions (fprintf, fscanf, etc.) that require a handle to the stream rather than
* using the stdin and stdout named streams.
*/
extern FILE USARTStream;
/* Inline Functions: */ /* Inline Functions: */
/** Initialises the serial stream (and regular USART driver) so that both the stream and regular /** Initialises the serial stream (and regular USART driver) so that both the stream and regular
* USART driver functions can be used. Must be called before any stream or regular USART functions. * USART driver functions can be used. Must be called before any stream or regular USART functions.
@ -121,13 +128,6 @@
Serial_ShutDown(); Serial_ShutDown();
} }
/* External Variables: */
/** Named stream for the USART, once \ref SerialStream_Init() has been called. This may be used with the
* file based stream functions (fprintf, fscanf, etc.) that require a handle to the stream rather than
* using the stdin and stdout named streams.
*/
extern FILE USARTStream;
/* Disable C linkage for C++ Compilers: */ /* Disable C linkage for C++ Compilers: */
#if defined(__cplusplus) #if defined(__cplusplus)
} }

Loading…
Cancel
Save