Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: IAP
Flash Class Reference
This is simple library for storing data to flash memory and reading it. More...
#include <Flash.h>
Public Member Functions | |
| Flash () | |
| Constructor. | |
| void | writeFlash (char data[MEM_SIZE]) |
| Function recevies data array wich is stored in flash memory. | |
| void | readFlash (char *data) |
| Function returning data to pointer to array of size 256 wich is stored in flash memory. | |
Detailed Description
This is simple library for storing data to flash memory and reading it.
This allows us to have retain data without having to have external flash chip. This class uses NXP LPC1768 internal flash memory which give us 256B of flash size.
Author: TVZ Mechatronics Team
Example of use:
#include "mbed.h" #include "Flash.h" BusOut display(LED1, LED2, LED3, LED4); InterruptIn cntUp(p5); Timer debounceUp; Flash flash; char retainData[MEM_SIZE]; uint8_t counter; void countUp(void) { if (debounceUp.read_ms() > 500) { if (counter > 15) counter = 0; else counter++; retainData[0] = counter; flash.writeFlash(retainData); debounceUp.reset(); } } int main() { cntUp.rise(&countUp); debounceUp.start(); flash.readFlash(retainData); counter = retainData[0]; while(1) { display = counter; } }
Definition at line 58 of file Flash.h.
Constructor & Destructor Documentation
Member Function Documentation
| void readFlash | ( | char * | data ) |
Generated on Wed Jul 13 2022 21:11:15 by
1.7.2