| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
#ifndef __ADP5589_H__ |
| 43 |
#define __ADP5589_H__ |
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
#define PMOD_IOXP_J1 0 // J1 port of PmodIOXP |
| 50 |
#define PMOD_IOXP_J2 1 // J2 port of PmodIOXP |
| 51 |
#define ADP5589_ADDRESS 0x34 // I2C ADDRESS |
| 52 |
#define ADP5589_ID 0x10 // Manufacturer ID |
| 53 |
|
| 54 |
|
| 55 |
#define ADP5589_ADR_ID 0x00 |
| 56 |
#define ADP5589_ADR_INT_STATUS 0x01 |
| 57 |
#define ADP5589_ADR_STATUS 0x02 |
| 58 |
#define ADP5589_ADR_FIFO1 0x03 |
| 59 |
#define ADP5589_ADR_FIFO2 0x04 |
| 60 |
#define ADP5589_ADR_FIFO3 0x05 |
| 61 |
#define ADP5589_ADR_FIFO4 0x06 |
| 62 |
#define ADP5589_ADR_FIFO5 0x07 |
| 63 |
#define ADP5589_ADR_FIFO6 0x08 |
| 64 |
#define ADP5589_ADR_FIFO7 0x09 |
| 65 |
#define ADP5589_ADR_FIFO8 0x0A |
| 66 |
#define ADP5589_ADR_FIFO9 0x0B |
| 67 |
#define ADP5589_ADR_FIFO10 0x0C |
| 68 |
#define ADP5589_ADR_FIFO11 0x0D |
| 69 |
#define ADP5589_ADR_FIFO12 0x0E |
| 70 |
#define ADP5589_ADR_FIFO13 0x0F |
| 71 |
#define ADP5589_ADR_FIFO14 0x10 |
| 72 |
#define ADP5589_ADR_FIFO15 0x11 |
| 73 |
#define ADP5589_ADR_FIFO16 0x12 |
| 74 |
#define ADP5589_ADR_GPI_INT_STATUS_A 0x13 |
| 75 |
#define ADP5589_ADR_GPI_INT_STATUS_B 0x14 |
| 76 |
#define ADP5589_ADR_GPI_INT_STATUS_C 0x15 |
| 77 |
#define ADP5589_ADR_GPI_STATUS_A 0x16 |
| 78 |
#define ADP5589_ADR_GPI_STATUS_B 0x17 |
| 79 |
#define ADP5589_ADR_GPI_STATUS_C 0x18 |
| 80 |
#define ADP5589_ADR_RPULL_CONFIG_A 0x19 |
| 81 |
#define ADP5589_ADR_RPULL_CONFIG_B 0x1A |
| 82 |
#define ADP5589_ADR_RPULL_CONFIG_C 0x1B |
| 83 |
#define ADP5589_ADR_RPULL_CONFIG_D 0x1C |
| 84 |
#define ADP5589_ADR_RPULL_CONFIG_E 0x1D |
| 85 |
#define ADP5589_ADR_GPI_INT_LEVEL_A 0x1E |
| 86 |
#define ADP5589_ADR_GPI_INT_LEVEL_B 0x1F |
| 87 |
#define ADP5589_ADR_GPI_INT_LEVEL_C 0x20 |
| 88 |
#define ADP5589_ADR_GPI_EVENT_EN_A 0x21 |
| 89 |
#define ADP5589_ADR_GPI_EVENT_EN_B 0x22 |
| 90 |
#define ADP5589_ADR_GPI_EVENT_EN_C 0x23 |
| 91 |
#define ADP5589_ADR_GPI_INTERRUPT_EN_A 0x24 |
| 92 |
#define ADP5589_ADR_GPI_INTERRUPT_EN_B 0x25 |
| 93 |
#define ADP5589_ADR_GPI_INTERRUPT_EN_C 0x26 |
| 94 |
#define ADP5589_ADR_DEBOUNCE_DIS_A 0x27 |
| 95 |
#define ADP5589_ADR_DEBOUNCE_DIS_B 0x28 |
| 96 |
#define ADP5589_ADR_DEBOUNCE_DIS_C 0x29 |
| 97 |
#define ADP5589_ADR_GPO_DATA_OUT_A 0x2A |
| 98 |
#define ADP5589_ADR_GPO_DATA_OUT_B 0x2B |
| 99 |
#define ADP5589_ADR_GPO_DATA_OUT_C 0x2C |
| 100 |
#define ADP5589_ADR_GPO_OUT_MODE_A 0x2D |
| 101 |
#define ADP5589_ADR_GPO_OUT_MODE_B 0x2E |
| 102 |
#define ADP5589_ADR_GPO_OUT_MODE_C 0x2F |
| 103 |
#define ADP5589_ADR_GPIO_DIRECTION_A 0x30 |
| 104 |
#define ADP5589_ADR_GPIO_DIRECTION_B 0x31 |
| 105 |
#define ADP5589_ADR_GPIO_DIRECTION_C 0x32 |
| 106 |
#define ADP5589_ADR_UNLOCK1 0x33 |
| 107 |
#define ADP5589_ADR_UNLOCK2 0x34 |
| 108 |
#define ADP5589_ADR_EXT_LOCK_EVENT 0x35 |
| 109 |
#define ADP5589_ADR_UNLOCK_TIMERS 0x36 |
| 110 |
#define ADP5589_ADR_LOCK_CFG 0x37 |
| 111 |
#define ADP5589_ADR_RESET1_EVENT_A 0x38 |
| 112 |
#define ADP5589_ADR_RESET1_EVENT_B 0x39 |
| 113 |
#define ADP5589_ADR_RESET1_EVENT_C 0x3A |
| 114 |
#define ADP5589_ADR_RESET2_EVENT_A 0x3B |
| 115 |
#define ADP5589_ADR_RESET2_EVENT_B 0x3C |
| 116 |
#define ADP5589_ADR_RESET_CFG 0x3D |
| 117 |
#define ADP5589_ADR_PWM_OFFT_LOW 0x3E |
| 118 |
#define ADP5589_ADR_PWM_OFFT_HIGH 0x3F |
| 119 |
#define ADP5589_ADR_PWM_ONT_LOW 0x40 |
| 120 |
#define ADP5589_ADR_PWM_ONT_HIGH 0x41 |
| 121 |
#define ADP5589_ADR_PWM_CFG 0x42 |
| 122 |
#define ADP5589_ADR_CLOCK_DIV_CFG 0x43 |
| 123 |
#define ADP5589_ADR_LOGIC_1_CFG 0x44 |
| 124 |
#define ADP5589_ADR_LOGIC_2_CFG 0x45 |
| 125 |
#define ADP5589_ADR_LOGIC_FF_CFG 0x46 |
| 126 |
#define ADP5589_ADR_LOGIC_INT_EVENT 0x47 |
| 127 |
#define ADP5589_ADR_POLL_TIME_CFG 0x48 |
| 128 |
#define ADP5589_ADR_PIN_CONFIG_A 0x49 |
| 129 |
#define ADP5589_ADR_PIN_CONFIG_B 0x4A |
| 130 |
#define ADP5589_ADR_PIN_CONFIG_C 0x4B |
| 131 |
#define ADP5589_ADR_PIN_CONFIG_D 0x4C |
| 132 |
#define ADP5589_ADR_GENERAL_CFG_B 0x4D |
| 133 |
#define ADP5589_ADR_INT_EN 0x4E |
| 134 |
|
| 135 |
|
| 136 |
|
| 137 |
|
| 138 |
#define ADP5589_ID_MAN_ID (0xF0) |
| 139 |
#define ADP5589_ID_REV_ID (0x0F) |
| 140 |
|
| 141 |
#define ADP5589_INT_STATUS_EVENT_INT (1 << 0) |
| 142 |
#define ADP5589_INT_STATUS_GPI_INT (1 << 1) |
| 143 |
#define ADP5589_INT_STATUS_OVERFLOW_INT (1 << 2) |
| 144 |
#define ADP5589_INT_STATUS_LOCK_INT (1 << 3) |
| 145 |
#define ADP5589_INT_STATUS_LOGIC1_INT (1 << 4) |
| 146 |
#define ADP5589_INT_STATUS_LOGIC2_INT (1 << 5) |
| 147 |
|
| 148 |
#define ADP5589_STATUS_EC(x) (((x) & 0x1F) << 0) |
| 149 |
#define ADP5589_STATUS_LOCK_STAT (1 << 5) |
| 150 |
#define ADP5589_STATUS_LOGIC1_STAT (1 << 6) |
| 151 |
#define ADP5589_STATUS_LOGIC2_STAT (1 << 7) |
| 152 |
|
| 153 |
#define ADP5589_INT_EN_EVENT_IEN (1 << 0) |
| 154 |
#define ADP5589_INT_EN_GPI_IEN (1 << 1) |
| 155 |
#define ADP5589_INT_EN_OVERFLOW_IEN (1 << 2) |
| 156 |
#define ADP5589_INT_EN_LOCK_IEN (1 << 3) |
| 157 |
#define ADP5589_INT_EN_LOGIC1_INT (1 << 4) |
| 158 |
#define ADP5589_INT_EN_LOGIC2_INT (1 << 5) |
| 159 |
|
| 160 |
#define ADP5589_GENERAL_CFG_B_RST_CFG (1 << 0) |
| 161 |
#define ADP5589_GENERAL_CFG_B_INT_CFG (1 << 1) |
| 162 |
#define ADP5589_GENERAL_CFG_B_LCK_TRK_GPI (1 << 3) |
| 163 |
#define ADP5589_GENERAL_CFG_B_LCK_TRK_LOGIC (1 << 4) |
| 164 |
#define ADP5589_GENERAL_CFG_B_CORE_FREQ(x) (((x) & 0x03) << 5) |
| 165 |
#define ADP5589_GENERAL_CFG_B_OSC_EN (1 << 7) |
| 166 |
|
| 167 |
#define ADP5589_PIN_CONFIG_D_R0_EXTEND (1 << 0) |
| 168 |
#define ADP5589_PIN_CONFIG_D_C9_EXTEND (1 << 1) |
| 169 |
#define ADP5589_PIN_CONFIG_D_R3_EXTEND(x) (((x) & 0x03) << 2) |
| 170 |
#define ADP5589_PIN_CONFIG_D_C6_EXTEND (1 << 4) |
| 171 |
#define ADP5589_PIN_CONFIG_D_R4_EXTEND (1 << 5) |
| 172 |
#define ADP5589_PIN_CONFIG_D_C4_EXTEND (1 << 6) |
| 173 |
#define ADP5589_PIN_CONFIG_D_PULL_SELECT (1 << 7) |
| 174 |
|
| 175 |
#define ADP5589_GPI_STATUS_GPI_1_STAT (1 << 0) |
| 176 |
#define ADP5589_GPI_STATUS_GPI_2_STAT (1 << 1) |
| 177 |
#define ADP5589_GPI_STATUS_GPI_3_STAT (1 << 2) |
| 178 |
#define ADP5589_GPI_STATUS_GPI_4_STAT (1 << 3) |
| 179 |
#define ADP5589_GPI_STATUS_GPI_5_STAT (1 << 4) |
| 180 |
#define ADP5589_GPI_STATUS_GPI_6_STAT (1 << 5) |
| 181 |
#define ADP5589_GPI_STATUS_GPI_7_STAT (1 << 6) |
| 182 |
#define ADP5589_GPI_STATUS_GPI_8_STAT (1 << 7) |
| 183 |
|
| 184 |
#define ADP5589_GPI_STATUS_GPI_9_STAT (1 << 0) |
| 185 |
#define ADP5589_GPI_STATUS_GPI_10_STAT (1 << 1) |
| 186 |
#define ADP5589_GPI_STATUS_GPI_11_STAT (1 << 2) |
| 187 |
#define ADP5589_GPI_STATUS_GPI_12_STAT (1 << 3) |
| 188 |
#define ADP5589_GPI_STATUS_GPI_13_STAT (1 << 4) |
| 189 |
#define ADP5589_GPI_STATUS_GPI_14_STAT (1 << 5) |
| 190 |
#define ADP5589_GPI_STATUS_GPI_15_STAT (1 << 6) |
| 191 |
#define ADP5589_GPI_STATUS_GPI_16_STAT (1 << 7) |
| 192 |
|
| 193 |
#define ADP5589_GPI_STATUS_GPI_17_STAT (1 << 0) |
| 194 |
#define ADP5589_GPI_STATUS_GPI_18_STAT (1 << 1) |
| 195 |
#define ADP5589_GPI_STATUS_GPI_19_STAT (1 << 2) |
| 196 |
|
| 197 |
#define ADP5589_GPI_EVENT_EN_GPI_1_STAT (1 << 0) |
| 198 |
#define ADP5589_GPI_EVENT_EN_GPI_2_STAT (1 << 1) |
| 199 |
#define ADP5589_GPI_EVENT_EN_GPI_3_STAT (1 << 2) |
| 200 |
#define ADP5589_GPI_EVENT_EN_GPI_4_STAT (1 << 3) |
| 201 |
#define ADP5589_GPI_EVENT_EN_GPI_5_STAT (1 << 4) |
| 202 |
#define ADP5589_GPI_EVENT_EN_GPI_6_STAT (1 << 5) |
| 203 |
#define ADP5589_GPI_EVENT_EN_GPI_7_STAT (1 << 6) |
| 204 |
#define ADP5589_GPI_EVENT_EN_GPI_8_STAT (1 << 7) |
| 205 |
|
| 206 |
#define ADP5589_GPI_EVENT_EN_GPI_9_STAT (1 << 0) |
| 207 |
#define ADP5589_GPI_EVENT_EN_GPI_10_STAT (1 << 1) |
| 208 |
#define ADP5589_GPI_EVENT_EN_GPI_11_STAT (1 << 2) |
| 209 |
#define ADP5589_GPI_EVENT_EN_GPI_12_STAT (1 << 3) |
| 210 |
#define ADP5589_GPI_EVENT_EN_GPI_13_STAT (1 << 4) |
| 211 |
#define ADP5589_GPI_EVENT_EN_GPI_14_STAT (1 << 5) |
| 212 |
#define ADP5589_GPI_EVENT_EN_GPI_15_STAT (1 << 6) |
| 213 |
#define ADP5589_GPI_EVENT_EN_GPI_16_STAT (1 << 7) |
| 214 |
|
| 215 |
#define ADP5589_GPI_EVENT_EN_GPI_17_STAT (1 << 0) |
| 216 |
#define ADP5589_GPI_EVENT_EN_GPI_18_STAT (1 << 1) |
| 217 |
#define ADP5589_GPI_EVENT_EN_GPI_19_STAT (1 << 2) |
| 218 |
|
| 219 |
|
| 220 |
#define ADP5589_UNLOCK1_UNLOCK1_STATE (1 << 7) |
| 221 |
#define ADP5589_UNLOCK1_UNLOCK1_UNLOCK1(x) (((x) & 0x7F) << 0) |
| 222 |
|
| 223 |
#define ADP5589_UNLOCK2_UNLOCK2_STATE (1 << 7) |
| 224 |
#define ADP5589_UNLOCK2_UNLOCK2_UNLOCK2(x) (((x) & 0x7F) << 0) |
| 225 |
|
| 226 |
#define ADP5589_EXT_LOCK_EXT_LOCK_STATE (1 << 7) |
| 227 |
#define ADP5589_EXT_LOCK_EXT_LOCK_EVENT(x) (((x) & 0x7F) << 0) |
| 228 |
|
| 229 |
#define ADP5589_UNLOCK_TIMERS_INT_MASK_TIMER(x) (((x) & 0xF8) << 3) |
| 230 |
#define ADP5589_UNLOCK_TIMERS_UNLOCK_TIMER(x) (((x) & 0x07) << 0) |
| 231 |
|
| 232 |
#define ADP5589_UNLOCK_TIMER_DIS 0 |
| 233 |
#define ADP5589_UNLOCK_TIMER_1SEC 1 |
| 234 |
#define ADP5589_UNLOCK_TIMER_2SEC 2 |
| 235 |
#define ADP5589_UNLOCK_TIMER_3SEC 3 |
| 236 |
#define ADP5589_UNLOCK_TIMER_4SEC 4 |
| 237 |
#define ADP5589_UNLOCK_TIMER_5SEC 5 |
| 238 |
#define ADP5589_UNLOCK_TIMER_6SEC 6 |
| 239 |
#define ADP5589_UNLOCK_TIMER_7SEC 7 |
| 240 |
|
| 241 |
#define ADP5589_INT_MASTER_TIMER_DIS 0 |
| 242 |
#define ADP5589_INT_MASTER_TIMER_1SEC 1 |
| 243 |
#define ADP5589_INT_MASTER_TIMER_2SEC 2 |
| 244 |
#define ADP5589_INT_MASTER_TIMER_30SEC (0X1E) |
| 245 |
#define ADP5589_INT_MASTER_TIMER_31SEC (0X1F) |
| 246 |
|
| 247 |
#define ADP5589_LOCK_CFG_LOCK_EN (1 << 0) |
| 248 |
|
| 249 |
#define ADP5589_RESET_CFG_RESET_PULSE_WIDTH(x) (((x) & 0x03) << 0) |
| 250 |
#define ADP5589_RESET_CFG_RESET_TRIGGER_TIME(x) (((x) & 0x07) << 2) |
| 251 |
#define ADP5589_RESET_CFG_RST_PASSTHRU_EN (1 << 5) |
| 252 |
#define ADP5589_RESET_CFG_RESET1_POL (1 << 6) |
| 253 |
#define ADP5589_RESET_CFG_RESET2_POL (1 << 7) |
| 254 |
|
| 255 |
#define ADP5589_RESET_CFG_RESET_TRIGGER_TIME_IMMED 0 |
| 256 |
#define ADP5589_RESET_CFG_RESET_TRIGGER_TIME_1D0SEC 1 |
| 257 |
#define ADP5589_RESET_CFG_RESET_TRIGGER_TIME_1D5SEC 2 |
| 258 |
#define ADP5589_RESET_CFG_RESET_TRIGGER_TIME_2D0SEC 3 |
| 259 |
#define ADP5589_RESET_CFG_RESET_TRIGGER_TIME_2D5SEC 4 |
| 260 |
#define ADP5589_RESET_CFG_RESET_TRIGGER_TIME_3D0SEC 5 |
| 261 |
#define ADP5589_RESET_CFG_RESET_TRIGGER_TIME_3D5SEC 6 |
| 262 |
#define ADP5589_RESET_CFG_RESET_TRIGGER_TIME_4D0SEC 7 |
| 263 |
|
| 264 |
#define ADP5589_RESET_CFG_RESET_PULSE_WIDTH_500US 0 |
| 265 |
#define ADP5589_RESET_CFG_RESET_PULSE_WIDTH_1MS 1 |
| 266 |
#define ADP5589_RESET_CFG_RESET_PULSE_WIDTH_2MS 2 |
| 267 |
#define ADP5589_RESET_CFG_RESET_PULSE_WIDTH_10MS 3 |
| 268 |
|
| 269 |
#define ADP5589_PWM_CFG_PWM_EN (1 << 0) |
| 270 |
#define ADP5589_PWM_CFG_PWM_MODE (1 << 1) |
| 271 |
#define ADP5589_PWM_CFG_PWM_IN_AND (1 << 2) |
| 272 |
|
| 273 |
#define ADP5589_CLOCK_DIV_CFG_CLK_INV (1 << 6) |
| 274 |
#define ADP5589_CLOCK_DIV_CFG_CLK_DIV(x) (((x) & 0x1F) << 1) |
| 275 |
#define ADP5589_CLOCK_DIV_CFG_CLK_DIV_EN (1 << 0) |
| 276 |
|
| 277 |
#define ADP5589_CLOCK_DIV_CFG_CLK_DIV_DIV1 (0X00) |
| 278 |
#define ADP5589_CLOCK_DIV_CFG_CLK_DIV_DIV2 (0X01) |
| 279 |
#define ADP5589_CLOCK_DIV_CFG_CLK_DIV_DIV3 (0X02) |
| 280 |
#define ADP5589_CLOCK_DIV_CFG_CLK_DIV_DIV4 (0X03) |
| 281 |
#define ADP5589_CLOCK_DIV_CFG_CLK_DIV_DIV32 (0X1F) |
| 282 |
|
| 283 |
#define ADP5589_LOGIC_1_CFG_LOGIC1_SEL(x) (((x) & 0x07) << 0) |
| 284 |
#define ADP5589_LOGIC_1_LA1_INV (1 << 3) |
| 285 |
#define ADP5589_LOGIC_1_LB1_INV (1 << 4) |
| 286 |
#define ADP5589_LOGIC_1_LC1_INV (1 << 5) |
| 287 |
#define ADP5589_LOGIC_1_LY1_INV (1 << 6) |
| 288 |
|
| 289 |
#define ADP5589_LOGIC_CFG_LOGIC_SEL_OFF (0x00) |
| 290 |
#define ADP5589_LOGIC_CFG_LOGIC_SEL_AND (0x01) |
| 291 |
#define ADP5589_LOGIC_CFG_LOGIC_SEL_OR (0x02) |
| 292 |
#define ADP5589_LOGIC_CFG_LOGIC_SEL_XOR (0x03) |
| 293 |
#define ADP5589_LOGIC_CFG_LOGIC_SEL_FF (0x04) |
| 294 |
#define ADP5589_LOGIC_CFG_LOGIC_SEL_IN_LA (0x05) |
| 295 |
#define ADP5589_LOGIC_CFG_LOGIC_SEL_IN_LB (0x06) |
| 296 |
#define ADP5589_LOGIC_CFG_LOGIC_SEL_IN_LC (0x07) |
| 297 |
|
| 298 |
#define ADP5589_LOGIC_2_CFG_LOGIC2_SEL(x) (((x) & 0x07) << 0) |
| 299 |
#define ADP5589_LOGIC_2_LA2_INV (1 << 3) |
| 300 |
#define ADP5589_LOGIC_2_LB2_INV (1 << 4) |
| 301 |
#define ADP5589_LOGIC_2_LC2_INV (1 << 5) |
| 302 |
#define ADP5589_LOGIC_2_LY2_INV (1 << 6) |
| 303 |
#define ADP5589_LOGIC_2_LY1_CASCADE (1 << 7) |
| 304 |
|
| 305 |
#define ADP5589_LOGIC_FF_CFG_FF1_CLR (1 << 0) |
| 306 |
#define ADP5589_LOGIC_FF_CFG_FF1_SET (1 << 1) |
| 307 |
#define ADP5589_LOGIC_FF_CFG_FF2_CLR (1 << 2) |
| 308 |
#define ADP5589_LOGIC_FF_CFG_FF2_SET (1 << 3) |
| 309 |
|
| 310 |
#define ADP5589_LOGIC_INT_EVENT_EN_LOGIC1_INT_LEVEL (1 << 0) |
| 311 |
#define ADP5589_LOGIC_INT_EVENT_EN_LOGIC1_EVENT_EN (1 << 1) |
| 312 |
#define ADP5589_LOGIC_INT_EVENT_EN_LY1_DBNC_DIS (1 << 2) |
| 313 |
#define ADP5589_LOGIC_INT_EVENT_EN_LOGIC2_INT_LEVEL (1 << 3) |
| 314 |
#define ADP5589_LOGIC_INT_EVENT_EN_LOGIC2_EVENT_EN (1 << 4) |
| 315 |
#define ADP5589_LOGIC_INT_EVENT_EN_LY2_DBNC_DIS (1 << 5) |
| 316 |
|
| 317 |
#define ADP5589_POLL_TIME_CFG_KEY_POLL_TIME(x) (((x) & 0x03) << 0) |
| 318 |
|
| 319 |
#define ADP5589_POLL_TIME_CFG_KEY_POLL_TIME_10MS (0x00) |
| 320 |
#define ADP5589_POLL_TIME_CFG_KEY_POLL_TIME_20MS (0x01) |
| 321 |
#define ADP5589_POLL_TIME_CFG_KEY_POLL_TIME_30MS (0x02) |
| 322 |
#define ADP5589_POLL_TIME_CFG_KEY_POLL_TIME_40MS (0x03) |
| 323 |
|
| 324 |
#define ADP5589_EVENT_KEY_RELEASED 0 |
| 325 |
#define ADP5589_EVENT_KEY_PRESSED 1 |
| 326 |
|
| 327 |
|
| 328 |
|
| 329 |
|
| 330 |
|
| 331 |
|
| 332 |
void ADP5589_SetRegisterValue(unsigned char registerAddress, |
| 333 |
unsigned char registerValue); |
| 334 |
|
| 335 |
|
| 336 |
unsigned char ADP5589_GetRegisterValue(unsigned char registerAddress); |
| 337 |
|
| 338 |
|
| 339 |
|
| 340 |
char ADP5589_Init(void); |
| 341 |
|
| 342 |
|
| 343 |
void ADP5589_InitPwm(void); |
| 344 |
|
| 345 |
|
| 346 |
void ADP5589_SetPwm(unsigned short pwmOffTime, unsigned short pwmOnTime); |
| 347 |
|
| 348 |
|
| 349 |
void ADP5589_GpioDirection(unsigned char reg, unsigned char val); |
| 350 |
|
| 351 |
|
| 352 |
unsigned char ADP5589_GetPinState(unsigned char reg); |
| 353 |
|
| 354 |
|
| 355 |
void ADP5589_SetPinState(unsigned char reg, unsigned char state); |
| 356 |
|
| 357 |
|
| 358 |
void ADP5589_InitKey(unsigned char pmodPort); |
| 359 |
|
| 360 |
|
| 361 |
unsigned char ADP5589_KeyDecode(unsigned char reg, |
| 362 |
unsigned char eventType, |
| 363 |
unsigned char pmodPort); |
| 364 |
|
| 365 |
|
| 366 |
void ADP5589_KeyLock(unsigned char firstEvent, |
| 367 |
unsigned char secondEvent, |
| 368 |
unsigned char pmodPort); |
| 369 |
|
| 370 |
#endif |