[Taranis] EEPROM write from USB massstorage seems working now here!
This commit is contained in:
@@ -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 ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user