16 #ifndef BSP_STK_IOEXP_H
17 #define BSP_STK_IOEXP_H
27 #define BSP_IOEXP_REG_DISP_CTRL 0x00
28 #define BSP_IOEXP_REG_VCOM_CTRL 0x01
29 #define BSP_IOEXP_REG_SENSOR_CTRL 0x02
30 #define BSP_IOEXP_REG_LED_CTRL 0x03
32 #define BSP_IOEXP_NUM_APP_REGS 4
34 #define BSP_IOEXP_REG_SYS_CMD 0xF0
35 #define BSP_IOEXP_REG_VERSION_MAJOR 0xF1
36 #define BSP_IOEXP_REG_VERSION_MINOR 0xF2
37 #define BSP_IOEXP_REG_VERSION_PATCH 0xF3
39 #define BSP_IOEXP_REG_SCRATCH0 0xF4
40 #define BSP_IOEXP_REG_SCRATCH1 0xF5
41 #define BSP_IOEXP_REG_SCRATCH2 0xF6
42 #define BSP_IOEXP_REG_SCRATCH3 0xF7
44 #define BSP_IOEXP_REG_DEVICE_ID0 0xF8
45 #define BSP_IOEXP_REG_DEVICE_ID1 0xF9
46 #define BSP_IOEXP_REG_DEVICE_ID2 0xFA
47 #define BSP_IOEXP_REG_DEVICE_ID3 0xFB
49 #define BSP_IOEXP_SYS_REG_START 0xF0
50 #define BSP_IOEXP_NUM_SYS_REGS 12
52 #define BSP_IOEXP_REG_DISP_CTRL_ENABLE 0x01
53 #define BSP_IOEXP_REG_DISP_CTRL_EXTCOMIN 0x02
54 #define BSP_IOEXP_REG_DISP_CTRL_AUTO_EXTCOMIN 0x04
55 #define BSP_IOEXP_REG_VCOM_CTRL_ENABLE 0x01
56 #define BSP_IOEXP_REG_SENSOR_CTRL_ENABLE 0x01
57 #define BSP_IOEXP_REG_LED_CTRL_LED0 0x01
58 #define BSP_IOEXP_REG_LED_CTRL_LED1 0x02
59 #define BSP_IOEXP_REG_LED_CTRL_LED_MASK 0x03
60 #define BSP_IOEXP_REG_LED_CTRL_DIRECT 0x80
62 #define BSP_IOEXP_REG_SYS_CMD_BOOTMODE 0xA5
64 #define BSP_IOEXP_DEVICE_ID 0x50584F49
68 void ioexpDisable(
void);
69 int ioexpEnable(
void);
70 uint32_t ioexpGetDeviceId(
void);
71 int ioexpReadReg(uint8_t reg, uint8_t *result);
72 int ioexpRegBitsSet(uint8_t addr,
bool set, uint8_t bitMask);
73 int ioexpWriteReg(uint8_t reg, uint8_t value);