nRF51 SDK
|
Modules | |
main.c | |
This file contains the source code for a sample application using the Flash Write Application. | |
The Flash Write Example erases a page in flash and then reads a pattern from pins 0-7 (Buttons), writes it to flash if a new pattern is detected, reads it back and writes it to pins 8-15 (LEDs). Each time a new pattern is detected, the address in flash is incremented. It uses the hardware delivered in the nRF51822 Development Kit.
The application starts with setting pins 0-7 as input (Buttons) and pins 8-15 as output (LEDs). The flash start address is set to the last page in flash, and the page is erased. The main loop first reads the button pattern and writes the value to flash. After the write to flash, the same flash address is read and set to the LEDs. Note that by erasing flash, each bit is set to logic one, so by pressing a button, the corresponding LED will be turned off.
The source code and project file can be found in the <InstallFolder>\Nordic\nrf51822\Board\nrf6310\flashwrite_example
folder.
Instructions on how to set up the nRFgo Motherboard: nRFgo Motherboard Setup (nRF6310).
LED assignments:
Button assignment:
The Flash Write Example Application can be tested as follows: