How to use DueFlashStorage in Arduino Due (Middleware)

Hello World !!

This topic we want to tell that the example of Arduino Mega2560 is not enough of EEPROM to applicable. So I find the other to resolve this problem. now we can use DueFlashStorage and Arduino Due to save binary code that download from EP iLogic.

<< from: >>

// 1Kb of data

#define DATA_LENGTH ((IFLASH1_PAGE_SIZE/sizeof(byte))*4)

<< to: >>

// 1 kb of data (It is useful, Implement )

#define DATA_LENGTH ((IFLASH1_PAGE_SIZE/sizeof(byte))* 4 )

:

: //(it is more setup)

// 1 Kb, you need mail to author with your requirement.

    • Please New Project from Sample Template (you can select Due Balance Car)

.<< from: >>

#include <EEPROM.h>

byte iLogic_eeprom_read_byte(unsigned int addr)

{ return EEPROM.read(addr);

}

void iLogic_eeprom_write_byte( unsigned int addr , byte data)

{ EEPROM.write(addr, data);

}

<< to: >>

#include <DueFlashStorage.h>

DueFlashStorage dueFlashStorage;

byte iLogic_eeprom_read_byte(unsigned int addr)

{ return dueFlashStorage.read(addr);

}

void iLogic_eeprom_write_byte( unsigned int addr , byte data )

{ dueFlashStorage.write(addr,data);

}

    • Complete the uppers, you can use flash to storage, please carefully SetDValue, and SetDAValue do not be set too many times in FUNCs. It will write data to flash.