Dependents:
esclavo_maestro
Diff: eeprom.cpp
- Revision:
- 2:4fd30af0937d
- Parent:
- 1:837719ffa1dc
- Child:
- 3:770d884b04c4
--- a/eeprom.cpp Fri Jul 27 02:49:15 2018 +0000
+++ b/eeprom.cpp Sat Jul 28 04:13:08 2018 +0000
@@ -54,4 +54,29 @@
+bool flush_eeprom(uint8_t eepr_addr, uint16_t address, uint8_t *ptr_string){
+ i2c.start();
+ int ack=i2c.write(eepr_addr<<1);
+ if(ack==1) {
+ i2c.write(address<<8);
+ i2c.write(address);
+ int i=0;
+
+ while(ptr_string[i]!=NULL) {
+ i2c.write(ptr_string[i]);
+ i++;
+ }
+ i2c.stop();
+ return true;//success
+ } else if(ack==0) {
+ return false;//NACK
+ } else if(ack==2) {
+ return 0;//TIMEOUT
+ }return false;
+
+
+ }
+
+
+