diff options
-rw-r--r-- | i2c.h | 17 | ||||
-rw-r--r-- | response.c | 6 |
2 files changed, 20 insertions, 3 deletions
@@ -1,4 +1,21 @@ #include <glib.h> +#define PCF8574 0x20 /* secondary I2C peripheral device */ +#define Second_PW_Port 0 /* PCF8574 at three-bit address 0 is for dual PW board (1021D) */ +#define Second_Dly_Port 1 /* PCF8574 at three-bit address 1 is for dual delay board (AVX-DD-A3-PS-TC) */ +#define To_Self_Cal_Port 2 /* PCF8574 at three-bit address 2 is for self-cal PCB 226A */ +#define From_Self_Cal_Port 3 /* PCF8574 at three-bit address 3 is for self-cal PCB 226A */ + +#define PCF8574A 0x38 /* Main I2C peripheral device */ +#define Button_Press_Port 0 /* PCF8574A at three-bit address 0 is for detecting button presses */ +#define LCD_Port 1 /* PCF8574A at three-bit address 1 is for LCD */ +#define Lower_Encoder_Port 2 /* PCF8574A at three-bit address 2 is for lower encoder counters */ +#define Upper_Encoder_Port 3 /* PCF8574A at three-bit address 3 is for upper encoder counter */ +#define Curr_Mon_LSB 4 /* PCF8574A at three-bit address 4 is for current monitor */ +#define Curr_Mon_MSB 5 /* PCF8574A at three-bit address 5 is for current monitor */ +#define rise_time_port 4 /* PCF8574A at three-bit address 4 is for rise time circuit in AVRQ */ + +/* 6 and 7 reserved for dual-channel current monitor */ + int I2C_Write(gulong address, guchar value); guchar I2C_Read(gulong address); @@ -107,9 +107,9 @@ void responseCb(gpointer instance, GObject *arg1, gpointer user_data) g_strstrip (str); guchar status = 0; // delete me, later - FIXME - I2C test code - I2C_Write (0x3b, 0xff); - status = I2C_Read (0x3b); + // I2C test code + I2C_Write (PCF8574A + Upper_Encoder_Port, 0xff); + status = I2C_Read (PCF8574A + Upper_Encoder_Port); // dummy response function gchar* upper = g_ascii_strup(str, len); |