Dependents:
esclavo_maestro
Diff: eeprom.cpp
- Revision:
- 6:09a5710f6b7c
- Parent:
- 5:790c023a3fe2
--- a/eeprom.cpp Tue Jul 31 19:05:00 2018 +0000
+++ b/eeprom.cpp Tue Jul 31 22:54:23 2018 +0000
@@ -10,16 +10,14 @@
int write_data(uint8_t eepr_addr, uint16_t address, uint8_t *ptr_string)
{
- wait_ms(2);
+ wait_ms(4);
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) {
+ for(int i =0; i<4 ;i++) {
i2c.write(ptr_string[i]);
- i++;
}
i2c.stop();
return 1;//success
@@ -34,7 +32,7 @@
uint8_t data_read(uint8_t eepr_addr, uint16_t address_read)
{
- wait_ms(2);
+ wait_ms(5);
uint8_t read;
i2c.start();
int ack=i2c.write(eepr_addr<<1);