EFM32 Gecko Software Documentation  efm32g-doc-5.1.2
bsp_stk_ioexp.h
Go to the documentation of this file.
1 /***************************************************************************/
16 #ifndef BSP_STK_IOEXP_H
17 #define BSP_STK_IOEXP_H
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
25 // These defines are internal to the BSP and should not be used by user code.
26 
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
31 
32 #define BSP_IOEXP_NUM_APP_REGS 4
33 
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
38 
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
43 
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
48 
49 #define BSP_IOEXP_SYS_REG_START 0xF0
50 #define BSP_IOEXP_NUM_SYS_REGS 12
51 
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
61 
62 #define BSP_IOEXP_REG_SYS_CMD_BOOTMODE 0xA5
63 
64 #define BSP_IOEXP_DEVICE_ID 0x50584F49
65 
66 // These functions are internal to the BSP and should not be used by user code.
67 
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);
74 
77 #ifdef __cplusplus
78 }
79 #endif
80 
81 #endif /* BSP_STK_IOEXP_H */