A ferroelectric random access memory or F-RAM is nonvolatile and performs reads and writes similar to a RAM.
Diff: FM24V10.h
- Revision:
- 0:e4b7a2f63736
- Child:
- 1:b9f6d029c760
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/FM24V10.h Tue Feb 03 19:56:43 2015 +0000 @@ -0,0 +1,48 @@ +#ifndef UK_AC_HERTS_SMARTLAB_FM24V10 +#define UK_AC_HERTS_SMARTLAB_FM24V10 + +#include "mbed.h" + +class FM24V10 +{ +public : + enum SPEED_MODE { + STANDARD,FULL,FAST,HIGH + }; + + FM24V10(PinName sda, PinName scl, bool A1, bool A2); + + FM24V10(PinName sda, PinName scl, bool A1, bool A2, SPEED_MODE speed); + + void WriteShort(int position, int value, bool Hs_mode); + + void WriteShort(int position, int * value, int size, bool Hs_mode); + + void ReadShort(int position, int * value, int size, bool Hs_mode); + + int ReadShort(int position, bool Hs_mode); + +private : + static const int HS_COMMAND = 0x09; + + static const int FREQUENCY_STANDARD = 100000; + static const int FREQUENCY_FULL = 400000; + static const int FREQUENCY_FAST = 1000000; + static const int FREQUENCY_HIGH = 3200000; + + I2C _i2c_bus; + int _speed; + int _addr; + + int result; + + void Init(bool A1, bool A2); + + void GetSlaveAddress(int position); + + void StartHS(); + + void StopHS(); +}; + +#endif \ No newline at end of file