Dependents: Motorino_Lib xxx_Motorino_Lib
Revision 0:99177ac50c7a, committed 2022-01-24
- Comitter:
- jack1930
- Date:
- Mon Jan 24 12:38:26 2022 +0000
- Commit message:
- internes EEPROM
Changed in this revision
eeprom_intern.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r 000000000000 -r 99177ac50c7a eeprom_intern.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/eeprom_intern.h Mon Jan 24 12:38:26 2022 +0000 @@ -0,0 +1,27 @@ +#include "mbed.h" + +char *meinEEPROM=(char*)FLASH_EEPROM_BASE; +//Byte write +void EEPROM_WRITE(int Startadresse, char *Data, int len) +{ + ScopedRomWriteLock make_rom_writable; + FLASH->PEKEYR=FLASH_PEKEY1;//0x89ABCDEF; //unlock + FLASH->PEKEYR=FLASH_PEKEY2;//0x02030405; + if ((FLASH->PECR&1)==0) + for(int i=0;i<len;i++) + { + meinEEPROM[i]=Data[i]; + + } + else printf("not unlock"); + FLASH->PECR|=1; //Lock +} + +//Byte read +void EEPROM_READ(int Startadresse, char *Data, int len) +{ + for(int i=0;i<len;i++) + { + Data[i]=meinEEPROM[i+Startadresse]; + } +} \ No newline at end of file