Hello everyone, I must to write and read a I2C eeprom like 24c256. I tryed to do it but all the examples with I2C protocol works with 8bit addressing. I tryed to modify mpu6050.c source code (in Nordic\nrf51822\Source\ext_sensors) for use with sd_twi_hardware_master.c without success.
I think that the right way is like this code snippet:
bool ee_mem24c256_register_write(uint16_t register_address, uint8_t value)
addrH = (int8_t) (register_address>>8);
addrL = (int8_t) (register_address&0xFF);
w2_data = addrH;
w2_data = addrL;
w2_data = value;
return twi_master_transfer(m_device_address, w2_data, 3, TWI_ISSUE_STOP);
bool ee_mem24c256_register_read(uint16_t register_address, uint8_t * destination, uint8_t number_of_bytes)
transfer_succeeded = twi_master_transfer(m_device_address, (uint8_t *) ®ister_address, 1, TWI_DONT_ISSUE_STOP);
transfer_succeeded &= twi_master_transfer(m_device_address|TWI_READ_BIT, destination, number_of_bytes, TWI_ISSUE_STOP);
but doesn't works...
Can you help me?
Thank you :Dd