aboutsummaryrefslogtreecommitdiffstats
path: root/LUFA/Drivers/Board
diff options
context:
space:
mode:
Diffstat (limited to 'LUFA/Drivers/Board')
-rw-r--r--LUFA/Drivers/Board/Dataflash.h6
-rw-r--r--LUFA/Drivers/Board/Temperature.c13
-rw-r--r--LUFA/Drivers/Board/Temperature.h4
3 files changed, 18 insertions, 5 deletions
diff --git a/LUFA/Drivers/Board/Dataflash.h b/LUFA/Drivers/Board/Dataflash.h
index c0f314a3e..dfd8cd6e9 100644
--- a/LUFA/Drivers/Board/Dataflash.h
+++ b/LUFA/Drivers/Board/Dataflash.h
@@ -127,7 +127,7 @@
static inline uint8_t Dataflash_TransferByte(const uint8_t Byte) ATTR_ALWAYS_INLINE;
static inline uint8_t Dataflash_TransferByte(const uint8_t Byte)
{
- return SPI_TransferByte(Byte);
+ return SPI_Transfer(Byte);
}
/** Sends a byte to the currently selected dataflash IC, and ignores the next byte from the dataflash.
@@ -137,7 +137,7 @@
static inline void Dataflash_SendByte(const uint8_t Byte) ATTR_ALWAYS_INLINE;
static inline void Dataflash_SendByte(const uint8_t Byte)
{
- SPI_SendByte(Byte);
+ SPI_Send(Byte);
}
/** Sends a dummy byte to the currently selected dataflash IC, and returns the next byte from the dataflash.
@@ -147,7 +147,7 @@
static inline uint8_t Dataflash_ReceiveByte(void) ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT;
static inline uint8_t Dataflash_ReceiveByte(void)
{
- return SPI_ReceiveByte();
+ return SPI_Receive();
}
/* Includes: */
diff --git a/LUFA/Drivers/Board/Temperature.c b/LUFA/Drivers/Board/Temperature.c
index ea12bf766..09d705085 100644
--- a/LUFA/Drivers/Board/Temperature.c
+++ b/LUFA/Drivers/Board/Temperature.c
@@ -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;
}
diff --git a/LUFA/Drivers/Board/Temperature.h b/LUFA/Drivers/Board/Temperature.h
index 12e6df137..8700839b6 100644
--- a/LUFA/Drivers/Board/Temperature.h
+++ b/LUFA/Drivers/Board/Temperature.h
@@ -54,8 +54,10 @@
/* Includes: */
#if defined(__AVR32__)
+ #include <avr32/io.h>
#include <stdint.h>
- #else
+ #elif defined(__AVR__)
+ #include <avr/io.h>
#include <avr/pgmspace.h>
#endif