| 60,7 → 60,16 |
| ******************************************************************************/ |
| |
| /**************************************************************************//** |
| * \fn static void eeprom_24c512__write_page( |
| * uint16_t address, |
| * uint8_t length, |
| * uint8_t* p_data) |
| * |
| * \brief Write a page in memory. |
| * |
| * \param address Start address of data to write. |
| * \param length Number of bytes to write. |
| * \param[in] p_data Bytes to write. |
| ******************************************************************************/ |
| static |
| void |
| 86,7 → 95,7 |
| * |
| * \brief Initialize EEPROM 24C512. |
| * |
| * \param hardware_address Hardware address. Pins A0 to A2. |
| * \param hardware_address Hardware address. Pins A0 to A1. |
| ******************************************************************************/ |
| void |
| eeprom_24c512__initialize |
| 94,7 → 103,7 |
| uint8_t hardware_address |
| ){ |
| // Compute device address. |
| device_address = EEPROM_24C512__ADDRESS | (hardware_address << 1); |
| device_address = EEPROM_24C512__ADDRESS | ((hardware_address & 0x03) << 1); |
| |
| // We don't initialize TWI here: we may have several devices on the bus. |
| // Initialize TWI. |
| 198,9 → 207,7 |
| twi__send_slaw(device_address); |
| twi__send_data(address >> 8); |
| twi__send_data(address & 0xFF); |
| twi__stop(); |
| |
| twi__start(); |
| twi__repeat_start(); |
| twi__send_slar(device_address); |
| twi__receive_data_nack(&data); |
| twi__stop(); |
| 234,9 → 241,7 |
| twi__send_slaw(device_address); |
| twi__send_data(address >> 8); |
| twi__send_data(address & 0xFF); |
| twi__stop(); |
| |
| twi__start(); |
| twi__repeat_start(); |
| twi__send_slar(device_address); |
| for (uint16_t i = 0; i < length - 1; i++) |
| { |