mirror of
https://github.com/qmk/qmk_firmware.git
synced 2025-07-16 21:01:31 +00:00
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.
This commit is contained in:
parent
f3049d958e
commit
97046965ee
@ -179,10 +179,14 @@
|
|||||||
if (PageAddress >= (DATAFLASH_PAGES * DATAFLASH_TOTALCHIPS))
|
if (PageAddress >= (DATAFLASH_PAGES * DATAFLASH_TOTALCHIPS))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
#if (DATAFLASH_TOTALCHIPS == 2)
|
||||||
if (PageAddress & 0x01)
|
if (PageAddress & 0x01)
|
||||||
Dataflash_SelectChip(DATAFLASH_CHIP2);
|
Dataflash_SelectChip(DATAFLASH_CHIP2);
|
||||||
else
|
else
|
||||||
Dataflash_SelectChip(DATAFLASH_CHIP1);
|
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
|
/** Toggles the select line of the currently selected dataflash IC, so that it is ready to receive
|
||||||
@ -216,7 +220,9 @@
|
|||||||
static inline void Dataflash_SendAddressBytes(uint16_t PageAddress,
|
static inline void Dataflash_SendAddressBytes(uint16_t PageAddress,
|
||||||
const uint16_t BufferByte)
|
const uint16_t BufferByte)
|
||||||
{
|
{
|
||||||
|
#if (DATAFLASH_TOTALCHIPS == 2)
|
||||||
PageAddress >>= 1;
|
PageAddress >>= 1;
|
||||||
|
#endif
|
||||||
|
|
||||||
Dataflash_SendByte(PageAddress >> 5);
|
Dataflash_SendByte(PageAddress >> 5);
|
||||||
Dataflash_SendByte((PageAddress << 3) | (BufferByte >> 8));
|
Dataflash_SendByte((PageAddress << 3) | (BufferByte >> 8));
|
||||||
|
Loading…
Reference in New Issue
Block a user