mirror of
https://github.com/RfidResearchGroup/ChameleonMini.git
synced 2026-05-12 11:20:37 -07:00
Fix:not saving card data when it is smaller than one page(256B)
This commit is contained in:
@@ -133,7 +133,8 @@ AVRDUDE_WRITE_EEPROM_LATEST = -U eeprom:w:Latest/Chameleon-RevG.eep
|
||||
|
||||
# Default target
|
||||
all:
|
||||
|
||||
touch uartcmd.c
|
||||
touch Terminal/Commands.c
|
||||
# Include LUFA build script makefiles
|
||||
include $(LUFA_PATH)/Build/lufa_core.mk
|
||||
include $(LUFA_PATH)/Build/lufa_sources.mk
|
||||
|
||||
@@ -204,7 +204,7 @@ INLINE void FlashWrite(const void *Buffer, uint32_t Address, uint16_t ByteCount)
|
||||
/* We assume that FlashWrite is always called for write actions that are
|
||||
* aligned to APP_SECTION_PAGE_SIZE and a multiple of APP_SECTION_PAGE_SIZE.
|
||||
* Thus only full pages are written into the flash. */
|
||||
uint16_t PageCount = ByteCount / APP_SECTION_PAGE_SIZE;
|
||||
uint16_t PageCount = (ByteCount + APP_SECTION_PAGE_SIZE - 1) / APP_SECTION_PAGE_SIZE;
|
||||
uint32_t PhysicalAddress = Address + FLASH_DATA_ADDR;
|
||||
|
||||
if ((PhysicalAddress >= FLASH_DATA_START) && (PhysicalAddress <= FLASH_DATA_END)) {
|
||||
@@ -240,7 +240,7 @@ INLINE void FlashWrite(const void *Buffer, uint32_t Address, uint16_t ByteCount)
|
||||
}
|
||||
|
||||
INLINE void FlashErase(uint32_t Address, uint16_t ByteCount) {
|
||||
uint16_t PageCount = ByteCount / APP_SECTION_PAGE_SIZE;
|
||||
uint16_t PageCount = (ByteCount + APP_SECTION_PAGE_SIZE - 1) / APP_SECTION_PAGE_SIZE;
|
||||
uint32_t PhysicalAddress = Address + FLASH_DATA_ADDR;
|
||||
|
||||
if ((PhysicalAddress >= FLASH_DATA_START) && (PhysicalAddress <= FLASH_DATA_END)) {
|
||||
@@ -308,7 +308,7 @@ INLINE void FRAMToFlash(uint32_t Address, uint16_t ByteCount) {
|
||||
/* We assume that FlashWrite is always called for write actions that are
|
||||
* aligned to APP_SECTION_PAGE_SIZE and a multiple of APP_SECTION_PAGE_SIZE.
|
||||
* Thus only full pages are written into the flash. */
|
||||
uint16_t PageCount = ByteCount / APP_SECTION_PAGE_SIZE;
|
||||
uint16_t PageCount = (ByteCount + APP_SECTION_PAGE_SIZE - 1) / APP_SECTION_PAGE_SIZE;
|
||||
uint32_t PhysicalAddress = Address + FLASH_DATA_ADDR;
|
||||
|
||||
if ((PhysicalAddress >= FLASH_DATA_START) && (PhysicalAddress <= FLASH_DATA_END)) {
|
||||
|
||||
@@ -670,6 +670,7 @@ CommandStatusIdType CommandSetLedMode(char *OutMessage, const char *InParam) {
|
||||
break;
|
||||
case 'R': // State reset
|
||||
bKeepAlive = 1;
|
||||
bUSBTerminal = 0;
|
||||
break;
|
||||
case 'T': // Test
|
||||
SendTestCmd(InParam[1]);
|
||||
|
||||
Reference in New Issue
Block a user