Ibrahim Abd Elkader
/
nrflash
Program Nordic nRF24LU1+ chips using SPI.
nrflash.h@0:f9a5ac1b59f7, 2011-03-13 (annotated)
- Committer:
- mux
- Date:
- Sun Mar 13 11:30:09 2011 +0000
- Revision:
- 0:f9a5ac1b59f7
1.0
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mux | 0:f9a5ac1b59f7 | 1 | #ifndef __NRFLASH_H__ |
mux | 0:f9a5ac1b59f7 | 2 | #define __NRFLASH_H__ |
mux | 0:f9a5ac1b59f7 | 3 | #include <mbed.h> |
mux | 0:f9a5ac1b59f7 | 4 | class NRFlash { |
mux | 0:f9a5ac1b59f7 | 5 | private: |
mux | 0:f9a5ac1b59f7 | 6 | SPI spi; |
mux | 0:f9a5ac1b59f7 | 7 | DigitalOut ssel; |
mux | 0:f9a5ac1b59f7 | 8 | DigitalOut prog; |
mux | 0:f9a5ac1b59f7 | 9 | DigitalOut rst; |
mux | 0:f9a5ac1b59f7 | 10 | void write_enable(); |
mux | 0:f9a5ac1b59f7 | 11 | public: |
mux | 0:f9a5ac1b59f7 | 12 | NRFlash(PinName mosi, PinName miso, PinName sclk, PinName ssel, PinName prog, PinName rst); |
mux | 0:f9a5ac1b59f7 | 13 | void reset(); |
mux | 0:f9a5ac1b59f7 | 14 | void enable_programming(); |
mux | 0:f9a5ac1b59f7 | 15 | void disable_programming(); |
mux | 0:f9a5ac1b59f7 | 16 | int read_fsr(); |
mux | 0:f9a5ac1b59f7 | 17 | void write_fsr(int fsr); |
mux | 0:f9a5ac1b59f7 | 18 | void erase_flash(); |
mux | 0:f9a5ac1b59f7 | 19 | int read_flash(const char *path); |
mux | 0:f9a5ac1b59f7 | 20 | int write_flash(const char *path); |
mux | 0:f9a5ac1b59f7 | 21 | }; |
mux | 0:f9a5ac1b59f7 | 22 | #endif //__NRFLASH_H__ |