Update Temperature board driver to be AVR32 compatible when the ADC peripheral driver is eventually ported. Make architecture includes explicit for both the AVR32 and the AVR8, to make way for future architecture ports.
Add SPI driver aliases for the old function names in the AVR8 driver, so that existing code will still compile against the new version.
This commit is contained in:
parent
c24027f3b5
commit
e11fddfe66
18 changed files with 138 additions and 92 deletions
|
@ -47,14 +47,25 @@ int8_t Temperature_GetTemperature(void)
|
|||
{
|
||||
uint16_t Temp_ADC = ADC_GetChannelReading(ADC_REFERENCE_AVCC | ADC_RIGHT_ADJUSTED | TEMP_ADC_CHANNEL_MASK);
|
||||
|
||||
#if defined(__AVR32__)
|
||||
if (Temp_ADC > Temperature_Lookup[0])
|
||||
return TEMP_MIN_TEMP;
|
||||
|
||||
for (uint16_t Index = 0; Index < TEMP_TABLE_SIZE; Index++)
|
||||
{
|
||||
if (Temp_ADC > Temperature_Lookup[Index])
|
||||
return (Index + TEMP_TABLE_OFFSET);
|
||||
}
|
||||
#elif defined(__AVR__)
|
||||
if (Temp_ADC > pgm_read_word(&Temperature_Lookup[0]))
|
||||
return TEMP_MIN_TEMP;
|
||||
return TEMP_MIN_TEMP;
|
||||
|
||||
for (uint16_t Index = 0; Index < TEMP_TABLE_SIZE; Index++)
|
||||
{
|
||||
if (Temp_ADC > pgm_read_word(&Temperature_Lookup[Index]))
|
||||
return (Index + TEMP_TABLE_OFFSET);
|
||||
}
|
||||
#endif
|
||||
|
||||
return TEMP_MAX_TEMP;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue