Fix TWI address reading error
This commit is contained in:
@@ -27,6 +27,7 @@
|
|||||||
inline void eeprom_init() {
|
inline void eeprom_init() {
|
||||||
#define DICT_SIZE 4
|
#define DICT_SIZE 4
|
||||||
|
|
||||||
|
// EEPROM addresses
|
||||||
#define TWI_ADDR 0x22
|
#define TWI_ADDR 0x22
|
||||||
#define SENSOR_READINGS 0x23
|
#define SENSOR_READINGS 0x23
|
||||||
#define MOISTURE_MIN 0x24
|
#define MOISTURE_MIN 0x24
|
||||||
@@ -39,8 +40,9 @@ inline void eeprom_init() {
|
|||||||
MOISTURE_MAX
|
MOISTURE_MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// actual values
|
||||||
uint16_t values[DICT_SIZE] = {
|
uint16_t values[DICT_SIZE] = {
|
||||||
0x20,
|
0x30,
|
||||||
5,
|
5,
|
||||||
400,
|
400,
|
||||||
200
|
200
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ static inline void twiReset(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void twiInit(void) {
|
void twiInit(void) {
|
||||||
TWAR = (TWI_ADDR << 1); //address definition found in config.h
|
TWAR = ((eepromRead(TWI_ADDR)) << 1); //address definition found in config.h
|
||||||
twiReset();
|
twiReset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user