diff options
author | Dean Camera <dean@fourwalledcubicle.com> | 2012-09-21 21:16:50 +0000 |
---|---|---|
committer | Dean Camera <dean@fourwalledcubicle.com> | 2012-09-21 21:16:50 +0000 |
commit | 97046965eeba5acb1af9a2925721fe39cfb19f2a (patch) | |
tree | 38ef37d28fe4be9e2af56e94887efc37d72a0e17 /LUFA/Drivers/Board | |
parent | f3049d958e4ef6cc919ff5f1302c1b384fed6bbf (diff) | |
download | lufa-97046965eeba5acb1af9a2925721fe39cfb19f2a.tar.gz lufa-97046965eeba5acb1af9a2925721fe39cfb19f2a.tar.bz2 lufa-97046965eeba5acb1af9a2925721fe39cfb19f2a.zip |
Add missing preprocessor logic to the USBKEY board Dataflash driver so that DATAFLASH_TOTALCHIPS parameter for the board could theoretically be changed to 1 and have the code still work.
Diffstat (limited to 'LUFA/Drivers/Board')
-rw-r--r-- | LUFA/Drivers/Board/AVR8/USBKEY/Dataflash.h | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/LUFA/Drivers/Board/AVR8/USBKEY/Dataflash.h b/LUFA/Drivers/Board/AVR8/USBKEY/Dataflash.h index f3cb45db8..2610736b6 100644 --- a/LUFA/Drivers/Board/AVR8/USBKEY/Dataflash.h +++ b/LUFA/Drivers/Board/AVR8/USBKEY/Dataflash.h @@ -179,10 +179,14 @@ if (PageAddress >= (DATAFLASH_PAGES * DATAFLASH_TOTALCHIPS)) return; - if (PageAddress & 0x01) - Dataflash_SelectChip(DATAFLASH_CHIP2); - else - Dataflash_SelectChip(DATAFLASH_CHIP1); + #if (DATAFLASH_TOTALCHIPS == 2) + if (PageAddress & 0x01) + Dataflash_SelectChip(DATAFLASH_CHIP2); + else + Dataflash_SelectChip(DATAFLASH_CHIP1); + #else + Dataflash_SelectChip(DATAFLASH_CHIP1); + #endif } /** Toggles the select line of the currently selected dataflash IC, so that it is ready to receive @@ -216,8 +220,10 @@ static inline void Dataflash_SendAddressBytes(uint16_t PageAddress, const uint16_t BufferByte) { - PageAddress >>= 1; - + #if (DATAFLASH_TOTALCHIPS == 2) + PageAddress >>= 1; + #endif + Dataflash_SendByte(PageAddress >> 5); Dataflash_SendByte((PageAddress << 3) | (BufferByte >> 8)); Dataflash_SendByte(BufferByte); |