[Taranis] EEPROM write from USB massstorage seems working now here!

This commit is contained in:
bsongis@gmail.com
2013-04-21 11:00:29 +00:00
parent f915a7c82e
commit 38afc96e2c
+3 -7
View File
@@ -663,18 +663,14 @@ int32_t fat12Read( uint8_t *buffer, uint16_t sector, uint16_t count )
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
int32_t fat12Write(const uint8_t *buffer, uint16_t sector, uint32_t count ) int32_t fat12Write(const uint8_t *buffer, uint16_t sector, uint32_t count )
{ {
// TO DO, actually write to the EEPROM
if ( sector >3 )
{
sector -= 4 ; // Indexes EEPROM in 512 byte blocks
// Look for a 4K block boundary, writing 4K+
while (count) { while (count) {
eeWriteBlockCmp((uint8_t *)buffer, sector*512, 512); if (sector >= 4) {
eeWriteBlockCmp((uint8_t *)buffer, (sector-4)*512, 512);
}
buffer += 512; buffer += 512;
sector++; sector++;
count--; count--;
} }
}
return 0 ; return 0 ;
} }