
lab eeprom
Fork of Nucleo_eeprom by
Revision 3:8d9d440c1a2c, committed 2015-10-26
- Comitter:
- soulx
- Date:
- Mon Oct 26 16:44:20 2015 +0000
- Parent:
- 2:27acee628363
- Child:
- 4:3a9d307d26e2
- Commit message:
- eeprom must wait a litte time for write and read
Changed in this revision
--- a/eeprom.lib Tue Aug 25 12:06:56 2015 +0000 +++ b/eeprom.lib Mon Oct 26 16:44:20 2015 +0000 @@ -1,1 +1,1 @@ -https://developer.mbed.org/teams/FRA221_2015/code/eeprom/#e91aa7bef1f9 +https://developer.mbed.org/teams/FRA221_2015/code/eeprom/#c648c5e93d5e
--- a/main.cpp Tue Aug 25 12:06:56 2015 +0000 +++ b/main.cpp Mon Oct 26 16:44:20 2015 +0000 @@ -2,26 +2,45 @@ #include "eeprom.h" -EEPROM memory(I2C_SDA,I2C_SCL,EEPROM_Address); + EEPROM memory(I2C_SDA,I2C_SCL,0); int main() { - char value='A'; - char data[2]; - memory.write(1,value); - memory.write(2,'a'); + + + int8_t data_dummy='r'; + int8_t data[4]; + float x=0.0f,j=9785.26844; + int16_t y=0x3321,z; + + + memory.write(1,(int8_t)data_dummy); + wait_ms(1); + + memory.write(2,(int8_t)'c'); + wait_ms(1); memory.read(1,data,2); - printf("read[1] = %c\n",data[0]); + wait_ms(1); + + + memory.write(10,j); + wait_ms(1); + + memory.read(10,x); + wait_ms(1); + + + memory.write(1,(int16_t)y); + wait_ms(1); + memory.read(1,z); + wait_ms(1); + + printf("read[1] = %c\n",data[0]); printf("read[2] = %c\n",data[1]); - float x=0.0f; - memory.write(10,1.23f); - memory.read(10,x); - printf("float = %f\n",x); - - int16_t y=16200,z; - memory.write(1,y); - memory.read(1,z); + printf("float = %f\n",x); + printf("int16 =%d\n",z); + } \ No newline at end of file
--- a/mbed.bld Tue Aug 25 12:06:56 2015 +0000 +++ b/mbed.bld Mon Oct 26 16:44:20 2015 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/8ed44a420e5c \ No newline at end of file +http://mbed.org/users/mbed_official/code/mbed/builds/34e6b704fe68 \ No newline at end of file