expand6  2.0.0.0
expand6.h
Go to the documentation of this file.
1 /*
2  * MikroSDK - MikroE Software Development Kit
3  * Copyright© 2020 MikroElektronika d.o.o.
4  *
5  * Permission is hereby granted, free of charge, to any person
6  * obtaining a copy of this software and associated documentation
7  * files (the "Software"), to deal in the Software without restriction,
8  * including without limitation the rights to use, copy, modify, merge,
9  * publish, distribute, sublicense, and/or sell copies of the Software,
10  * and to permit persons to whom the Software is furnished to do so,
11  * subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be
14  * included in all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19  * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
20  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
22  * OR OTHER DEALINGS IN THE SOFTWARE.
23  */
24 
33 // ----------------------------------------------------------------------------
34 
35 #ifndef EXPAND6_H
36 #define EXPAND6_H
37 
38 #include "mikrosdk_version.h"
39 
40 #ifdef __GNUC__
41 #if mikroSDK_GET_VERSION < 20800ul
42 #include "rcu_delays.h"
43 #else
44 #include "delays.h"
45 #endif
46 #endif
47 
48 #include "drv_digital_out.h"
49 #include "drv_digital_in.h"
50 #include "drv_i2c_master.h"
51 
52 // -------------------------------------------------------------- PUBLIC MACROS
62 #define EXPAND6_MAP_MIKROBUS( cfg, mikrobus ) \
63  cfg.scl = MIKROBUS( mikrobus, MIKROBUS_SCL ); \
64  cfg.sda = MIKROBUS( mikrobus, MIKROBUS_SDA ); \
65  cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
66  cfg.int_pin = MIKROBUS( mikrobus, MIKROBUS_INT )
67 
73 #define EXPAND6_RETVAL uint8_t
74 
75 #define EXPAND6_OK 0x00
76 #define EXPAND6_INIT_ERROR 0xFF
77 
83 #define EXPAND6_M_PORT_BASE_ADR 0x20
84 #define EXPAND6_EEPROM_BASE_ADR 0x50
85 #define EXPAND6_DEV_ADR_GND 0x00
86 #define EXPAND6_DEV_ADR_VCC 0x01
87 
93 #define EXPAND6_REG_IN_PORT0_ADR 0x00
94 #define EXPAND6_REG_IN_PORT1_ADR 0x01
95 #define EXPAND6_REG_IN_PORT2_ADR 0x02
96 #define EXPAND6_REG_IN_PORT3_ADR 0x03
97 #define EXPAND6_REG_IN_PORT4_ADR 0x04
98 #define EXPAND6_REG_IN_PORT5_ADR 0x05
99 #define EXPAND6_REG_IN_PORT6_ADR 0x06
100 #define EXPAND6_REG_IN_PORT7_ADR 0x07
101 #define EXPAND6_REG_OUT_PORT0_ADR 0x08
102 #define EXPAND6_REG_OUT_PORT1_ADR 0x09
103 #define EXPAND6_REG_OUT_PORT2_ADR 0x0A
104 #define EXPAND6_REG_OUT_PORT3_ADR 0x0B
105 #define EXPAND6_REG_OUT_PORT4_ADR 0x0C
106 #define EXPAND6_REG_OUT_PORT5_ADR 0x0D
107 #define EXPAND6_REG_OUT_PORT6_ADR 0x0E
108 #define EXPAND6_REG_OUT_PORT7_ADR 0x0F
109 #define EXPAND6_REG_INT_STAT_PORT0_ADR 0x10
110 #define EXPAND6_REG_INT_STAT_PORT1_ADR 0x11
111 #define EXPAND6_REG_INT_STAT_PORT2_ADR 0x12
112 #define EXPAND6_REG_INT_STAT_PORT3_ADR 0x13
113 #define EXPAND6_REG_INT_STAT_PORT4_ADR 0x14
114 #define EXPAND6_REG_INT_STAT_PORT5_ADR 0x15
115 #define EXPAND6_REG_INT_STAT_PORT6_ADR 0x16
116 #define EXPAND6_REG_INT_STAT_PORT7_ADR 0x17
117 #define EXPAND6_REG_PORT_SEL_ADR 0x18
118 #define EXPAND6_REG_INT_MASK_ADR 0x19
119 #define EXPAND6_REG_SEL_PWM_OUT_ADR 0x1A
120 #define EXPAND6_REG_INV_ADR 0x1B
121 #define EXPAND6_REG_PORT_DIR_ADR 0x1C
122 #define EXPAND6_REG_PULL_UP_ADR 0x1D
123 #define EXPAND6_REG_PULL_DOWN_ADR 0x1E
124 #define EXPAND6_REG_OPEN_DRAIN_HIGH_ADR 0x1F
125 #define EXPAND6_REG_OPEN_DRAIN_LOW_ADR 0x20
126 #define EXPAND6_REG_STRONG_ADR 0x21
127 #define EXPAND6_REG_SLOW_STRONG_ADR 0x22
128 #define EXPAND6_REG_HIGH_Z_ADR 0x23
129 #define EXPAND6_REG_RSRVD_1_ADR 0x24
130 #define EXPAND6_REG_RSRVD_2_ADR 0x25
131 #define EXPAND6_REG_RSRVD_3_ADR 0x26
132 #define EXPAND6_REG_RSRVD_4_ADR 0x27
133 #define EXPAND6_REG_PWM_SEL_ADR 0x28
134 #define EXPAND6_REG_CFG_PWM_ADR 0x29
135 #define EXPAND6_REG_PERIOD_PWM_ADR 0x2A
136 #define EXPAND6_REG_PULSE_WIDTH_PWM_ADR 0x2B
137 #define EXPAND6_REG_DIVIDER_ADR 0x2C
138 #define EXPAND6_REG_EEPROM_ADR 0x2D
139 #define EXPAND6_REG_DEV_ID_ADR 0x2E
140 #define EXPAND6_REG_WDT_ADR 0x2F
141 #define EXPAND6_REG_CMD_ADR 0x30
142 
148 #define EXPAND6_SEL_PWM_0 0x00
149 #define EXPAND6_SEL_PWM_1 0x01
150 #define EXPAND6_SEL_PWM_2 0x02
151 #define EXPAND6_SEL_PWM_3 0x03
152 
158 #define EXPAND6_PWM_CLK_SRC_32_KHZ 0x00
159 #define EXPAND6_PWM_CLK_SRC_24_MHZ 0x01
160 #define EXPAND6_PWM_CLK_SRC_1_5_MHZ 0x02
161 #define EXPAND6_PWM_CLK_SRC_93_75_KHZ 0x03
162 #define EXPAND6_PWM_CLK_SRC_367_6_HZ 0x04
163 #define EXPAND6_PWM_CLK_SRC_PREV 0x05
164 
170 #define EXPAND6_STORE_POR_CFG_TO_EEPROM 0x01
171 #define EXPAND6_RESTORE_DEFAULTS 0x02
172 #define EXPAND6_WRITE_EEPROM_POR 0x03
173 #define EXPAND6_READ_EEPROM_POR 0x04
174 #define EXPAND6_WRITE_DEV_CFG 0x05
175 #define EXPAND6_READ_DEV_CFG 0x06
176 #define EXPAND6_RECFG_DEV_TO_POR 0x07
177 
183 #define EXPAND6_EEPROM_EN_WDE 0x01
184 #define EXPAND6_EEPROM_EN_EEE 0x02
185 #define EXPAND6_EEPROM_EN_EERO 0x04
186 
192 #define EXPAND6_PORT_0 0x00
193 #define EXPAND6_PORT_1 0x01
194 #define EXPAND6_PORT_2 0x02
195 
201 #define EXPAND6_LOW 0x00
202 #define EXPAND6_HIGH 0x01
203 #define EXPAND6_INT_NORMAL 0x00
204 #define EXPAND6_INT_INVERTED 0x01
205 
211 #define EXPAND6_PORT0_OUT_INX 0x00
212 #define EXPAND6_PORT1_OUT_INX 0x01
213 #define EXPAND6_PORT2_OUT_INX 0x02
214 #define EXPAND6_PORT3_OUT_INX 0x03
215 #define EXPAND6_PORT4_OUT_INX 0x04
216 #define EXPAND6_PORT5_OUT_INX 0x05
217 #define EXPAND6_PORT6_OUT_INX 0x06
218 #define EXPAND6_PORT7_OUT_INX 0x07
219 
220 #define EXPAND6_PORT0_INT_MASK_INX 0x08
221 #define EXPAND6_PORT1_INT_MASK_INX 0x09
222 #define EXPAND6_PORT2_INT_MASK_INX 0x0A
223 #define EXPAND6_PORT3_INT_MASK_INX 0x0B
224 #define EXPAND6_PORT4_INT_MASK_INX 0x0C
225 #define EXPAND6_PORT5_INT_MASK_INX 0x0D
226 #define EXPAND6_PORT6_INT_MASK_INX 0x0E
227 #define EXPAND6_PORT7_INT_MASK_INX 0x0F
228 
229 #define EXPAND6_PORT0_SEL_PWM_INX 0x10
230 #define EXPAND6_PORT1_SEL_PWM_INX 0x11
231 #define EXPAND6_PORT2_SEL_PWM_INX 0x12
232 #define EXPAND6_PORT3_SEL_PWM_INX 0x13
233 #define EXPAND6_PORT4_SEL_PWM_INX 0x14
234 #define EXPAND6_PORT5_SEL_PWM_INX 0x15
235 #define EXPAND6_PORT6_SEL_PWM_INX 0x16
236 #define EXPAND6_PORT7_SEL_PWM_INX 0x17
237 
238 #define EXPAND6_PORT0_INV_INX 0x18
239 #define EXPAND6_PORT1_INV_INX 0x19
240 #define EXPAND6_PORT2_INV_INX 0x1A
241 #define EXPAND6_PORT3_INV_INX 0x1B
242 #define EXPAND6_PORT4_INV_INX 0x1C
243 #define EXPAND6_PORT5_INV_INX 0x1D
244 #define EXPAND6_PORT6_INV_INX 0x1E
245 #define EXPAND6_PORT7_INV_INX 0x1F
246 
247 #define EXPAND6_PORT0_DIR_INX 0x20
248 #define EXPAND6_PORT1_DIR_INX 0x21
249 #define EXPAND6_PORT2_DIR_INX 0x22
250 #define EXPAND6_PORT3_DIR_INX 0x23
251 #define EXPAND6_PORT4_DIR_INX 0x24
252 #define EXPAND6_PORT5_DIR_INX 0x25
253 #define EXPAND6_PORT6_DIR_INX 0x26
254 #define EXPAND6_PORT7_DIR_INX 0x27
255 
256 #define EXPAND6_PORT0_PULL_UP_INX 0x28
257 #define EXPAND6_PORT0_PULL_DOWN_INX 0x29
258 #define EXPAND6_PORT0_OPEN_DRAIN_HIGH_INX 0x2A
259 #define EXPAND6_PORT0_OPEN_DRAIN_LOW_INX 0x2B
260 #define EXPAND6_PORT0_STRONG_INX 0x2C
261 #define EXPAND6_PORT0_SLOW_STRONG_INX 0x2D
262 #define EXPAND6_PORT0_HIGH_Z_INX 0x2E
263 
264 #define EXPAND6_PORT1_PULL_UP_INX 0x2F
265 #define EXPAND6_PORT1_PULL_DOWN_INX 0x30
266 #define EXPAND6_PORT1_OPEN_DRAIN_HIGH_INX 0x31
267 #define EXPAND6_PORT1_OPEN_DRAIN_LOW_INX 0x32
268 #define EXPAND6_PORT1_STRONG_INX 0x33
269 #define EXPAND6_PORT1_SLOW_STRONG_INX 0x34
270 #define EXPAND6_PORT1_HIGH_Z_INX 0x35
271 
272 #define EXPAND6_PORT2_PULL_UP_INX 0x36
273 #define EXPAND6_PORT2_PULL_DOWN_INX 0x37
274 #define EXPAND6_PORT2_OPEN_DRAIN_HIGH_INX 0x38
275 #define EXPAND6_PORT2_OPEN_DRAIN_LOW_INX 0x39
276 #define EXPAND6_PORT2_STRONG_INX 0x3A
277 #define EXPAND6_PORT2_SLOW_STRONG_INX 0x3B
278 #define EXPAND6_PORT2_HIGH_Z_INX 0x3C
279 
280 #define EXPAND6_PORT3_PULL_UP_INX 0x3D
281 #define EXPAND6_PORT3_PULL_DOWN_INX 0x3E
282 #define EXPAND6_PORT3_OPEN_DRAIN_HIGH_INX 0x3F
283 #define EXPAND6_PORT3_OPEN_DRAIN_LOW_INX 0x40
284 #define EXPAND6_PORT3_STRONG_INX 0x41
285 #define EXPAND6_PORT3_SLOW_STRONG_INX 0x42
286 #define EXPAND6_PORT3_HIGH_Z_INX 0x43
287 
288 #define EXPAND6_PORT4_PULL_UP_INX 0x44
289 #define EXPAND6_PORT4_PULL_DOWN_INX 0x45
290 #define EXPAND6_PORT4_OPEN_DRAIN_HIGH_INX 0x46
291 #define EXPAND6_PORT4_OPEN_DRAIN_LOW_INX 0x47
292 #define EXPAND6_PORT4_STRONG_INX 0x48
293 #define EXPAND6_PORT4_SLOW_STRONG_INX 0x49
294 #define EXPAND6_PORT4_HIGH_Z_INX 0x4A
295 
296 #define EXPAND6_PORT5_PULL_UP_INX 0x4B
297 #define EXPAND6_PORT5_PULL_DOWN_INX 0x4C
298 #define EXPAND6_PORT5_OPEN_DRAIN_HIGH_INX 0x4D
299 #define EXPAND6_PORT5_OPEN_DRAIN_LOW_INX 0x4E
300 #define EXPAND6_PORT5_STRONG_INX 0x4F
301 #define EXPAND6_PORT5_SLOW_STRONG_INX 0x50
302 #define EXPAND6_PORT5_HIGH_Z_INX 0x51
303 
304 #define EXPAND6_PORT6_PULL_UP_INX 0x52
305 #define EXPAND6_PORT6_PULL_DOWN_INX 0x53
306 #define EXPAND6_PORT6_OPEN_DRAIN_HIGH_INX 0x54
307 #define EXPAND6_PORT6_OPEN_DRAIN_LOW_INX 0x55
308 #define EXPAND6_PORT6_STRONG_INX 0x56
309 #define EXPAND6_PORT6_SLOW_STRONG_INX 0x57
310 #define EXPAND6_PORT6_HIGH_Z_INX 0x58
311 
312 #define EXPAND6_PORT7_PULL_UP_INX 0x59
313 #define EXPAND6_PORT7_PULL_DOWN_INX 0x5A
314 #define EXPAND6_PORT7_OPEN_DRAIN_HIGH_INX 0x5B
315 #define EXPAND6_PORT7_OPEN_DRAIN_LOW_INX 0x5C
316 #define EXPAND6_PORT7_STRONG_INX 0x5D
317 #define EXPAND6_PORT7_SLOW_STRONG_INX 0x5E
318 #define EXPAND6_PORT7_HIGH_Z_INX 0x5F
319 
320 #define EXPAND6_PWM0_CFG_INX 0x60
321 #define EXPAND6_PWM0_PERIOD_INX 0x61
322 #define EXPAND6_PWM0_PULSE_WIDTH_INX 0x62
323 
324 #define EXPAND6_PWM1_CFG_INX 0x63
325 #define EXPAND6_PWM1_PERIOD_INX 0x64
326 #define EXPAND6_PWM1_PULSE_WIDTH_INX 0x65
327 
328 #define EXPAND6_PWM2_CFG_INX 0x66
329 #define EXPAND6_PWM2_PERIOD_INX 0x67
330 #define EXPAND6_PWM2_PULSE_WIDTH_INX 0x68
331 
332 #define EXPAND6_PWM3_CFG_INX 0x69
333 #define EXPAND6_PWM3_PERIOD_INX 0x6A
334 #define EXPAND6_PWM3_PULSE_WIDTH_INX 0x6B
335 
336 #define EXPAND6_PWM4_CFG_INX 0x6C
337 #define EXPAND6_PWM4_PERIOD_INX 0x6D
338 #define EXPAND6_PWM4_PULSE_WIDTH_INX 0x6E
339 
340 #define EXPAND6_PWM5_CFG_INX 0x6F
341 #define EXPAND6_PWM5_PERIOD_INX 0x70
342 #define EXPAND6_PWM5_PULSE_WIDTH_INX 0x71
343 
344 #define EXPAND6_PWM6_CFG_INX 0x72
345 #define EXPAND6_PWM6_PERIOD_INX 0x73
346 #define EXPAND6_PWM6_PULSE_WIDTH_INX 0x74
347 
348 #define EXPAND6_PWM7_CFG_INX 0x75
349 #define EXPAND6_PWM7_PERIOD_INX 0x76
350 #define EXPAND6_PWM7_PULSE_WIDTH_INX 0x77
351 
352 #define EXPAND6_PWM8_CFG_INX 0x78
353 #define EXPAND6_PWM8_PERIOD_INX 0x79
354 #define EXPAND6_PWM8_PULSE_WIDTH_INX 0x7A
355 
356 #define EXPAND6_PWM9_CFG_INX 0x7B
357 #define EXPAND6_PWM9_PERIOD_INX 0x7C
358 #define EXPAND6_PWM9_PULSE_WIDTH_INX 0x7D
359 
360 #define EXPAND6_PWM10_CFG_INX 0x7E
361 #define EXPAND6_PWM10_PERIOD_INX 0x7F
362 #define EXPAND6_PWM10_PULSE_WIDTH_INX 0x80
363 
364 #define EXPAND6_PWM11_CFG_INX 0x81
365 #define EXPAND6_PWM11_PERIOD_INX 0x82
366 #define EXPAND6_PWM11_PULSE_WIDTH_INX 0x83
367 
368 #define EXPAND6_PWM12_CFG_INX 0x84
369 #define EXPAND6_PWM12_PERIOD_INX 0x85
370 #define EXPAND6_PWM12_PULSE_WIDTH_INX 0x86
371 
372 #define EXPAND6_PWM13_CFG_INX 0x87
373 #define EXPAND6_PWM13_PERIOD_INX 0x88
374 #define EXPAND6_PWM13_PULSE_WIDTH_INX 0x89
375 
376 #define EXPAND6_PWM14_CFG_INX 0x8A
377 #define EXPAND6_PWM14_PERIOD_INX 0x8B
378 #define EXPAND6_PWM14_PULSE_WIDTH_INX 0x8C
379 
380 #define EXPAND6_PWM15_CFG_INX 0x8D
381 #define EXPAND6_PWM15_PERIOD_INX 0x8E
382 #define EXPAND6_PWM15_PULSE_WIDTH_INX 0x8F
383 
384 #define EXPAND6_DIVIDER_INX 0x90
385 #define EXPAND6_EEPROM_ENABLE_INX 0x91
386 #define EXPAND6_CRC_INX 0x92
387  // End group macro
390 // --------------------------------------------------------------- PUBLIC TYPES
399 typedef struct
400 {
401  uint8_t pwm_sel;
402  uint8_t clk_src;
403  uint8_t period;
404  uint8_t pulse_wid;
405  uint8_t devider;
406 
408 
412 typedef struct
413 {
414  // Output pins
415 
416  digital_out_t rst;
417 
418  // Input pins
419 
420  digital_in_t int_pin;
421 
422  // Modules
423 
424  i2c_master_t i2c;
425 
426  // ctx variable
427 
428  uint8_t slave_address;
429 
430 } expand6_t;
431 
435 typedef struct
436 {
437  // Communication gpio pins
438 
439  pin_name_t scl;
440  pin_name_t sda;
441 
442  // Additional gpio pins
443 
444  pin_name_t rst;
445  pin_name_t int_pin;
446 
447  // static variable
448 
449  uint32_t i2c_speed;
450  uint8_t i2c_address;
451 
452 } expand6_cfg_t;
453  // End types group
455 // ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
456 
462 #ifdef __cplusplus
463 extern "C"{
464 #endif
465 
475 
484 
495 void expand6_generic_write ( expand6_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len );
496 
508 void expand6_generic_read ( expand6_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len );
509 
519 void expand6_write_byte ( expand6_t *ctx, uint8_t reg_adr, uint8_t wr_data );
520 
531 uint8_t expand6_read_byte ( expand6_t *ctx, uint8_t reg_adr );
532 
544 void expand6_write_port_exp ( expand6_t *ctx, uint8_t reg, uint8_t *buf, uint8_t len );
545 
557 void expand6_read_port_exp ( expand6_t *ctx, uint8_t reg, uint8_t *buf, uint8_t len );
558 
567 void expand6_send_eeprom_cmd ( expand6_t *ctx, uint8_t cmd );
568 
579 void expand6_write_eeprom ( expand6_t *ctx, uint16_t mem_adr, uint8_t *buf, uint8_t len );
580 
591 void expand6_read_eeprom ( expand6_t *ctx, uint16_t mem_adr, uint8_t *buf, uint8_t len );
592 
604 uint8_t expand6_read_bit ( expand6_t *ctx, uint8_t reg_adr, uint8_t bit_num );
605 
616 void expand6_write_bit ( expand6_t *ctx, uint8_t reg_adr, uint8_t bit_num, uint8_t pin_val );
617 
628 uint8_t expand6_read_pin ( expand6_t *ctx, uint16_t pin, uint8_t inv );
629 
640 uint8_t expand6_read_port ( expand6_t *ctx, uint8_t port, uint8_t inv );
641 
652 uint8_t expand6_get_pin_out_lvl ( expand6_t *ctx, uint16_t pin );
653 
664 uint8_t expand6_get_port_out_lvl ( expand6_t *ctx, uint8_t port );
665 
675 void expand6_write_pin ( expand6_t *ctx, uint16_t pin, uint8_t pin_val );
676 
686 void expand6_write_port ( expand6_t *ctx, uint8_t port, uint8_t value );
687 
697 void expand6_sel_pwm_pin ( expand6_t *ctx, uint16_t pin, uint8_t pwm_en );
698 
709 void expand6_pwm_cfg ( expand6_t *ctx, expand6_pwm_cfg_t pwm_cfg, float *duty_cyc, float *freq );
710 
721 void expand6_eeprom_enable ( expand6_t *ctx, uint8_t cmd );
722 
731 void expand6_reset ( expand6_t *ctx );
732 
744 uint8_t expand6_check_int ( expand6_t *ctx );
745 
746 #ifdef __cplusplus
747 }
748 #endif
749 #endif // _EXPAND6_H_
750  // End public_function group
753 
754 // ------------------------------------------------------------------------- END
expand6_t::int_pin
digital_in_t int_pin
Definition: expand6.h:420
expand6_pwm_cfg
void expand6_pwm_cfg(expand6_t *ctx, expand6_pwm_cfg_t pwm_cfg, float *duty_cyc, float *freq)
PWM Configuration function.
expand6_cfg_t
Click configuration structure definition.
Definition: expand6.h:436
expand6_cfg_t::rst
pin_name_t rst
Definition: expand6.h:444
expand6_write_port_exp
void expand6_write_port_exp(expand6_t *ctx, uint8_t reg, uint8_t *buf, uint8_t len)
Port Expander Write function.
expand6_pwm_cfg_t::devider
uint8_t devider
Definition: expand6.h:405
expand6_generic_read
void expand6_generic_read(expand6_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic read function.
expand6_pwm_cfg_t::clk_src
uint8_t clk_src
Definition: expand6.h:402
expand6_pwm_cfg_t::period
uint8_t period
Definition: expand6.h:403
expand6_t::i2c
i2c_master_t i2c
Definition: expand6.h:424
expand6_t
Click ctx object definition.
Definition: expand6.h:413
expand6_write_byte
void expand6_write_byte(expand6_t *ctx, uint8_t reg_adr, uint8_t wr_data)
Write byte function.
expand6_t::slave_address
uint8_t slave_address
Definition: expand6.h:428
expand6_read_eeprom
void expand6_read_eeprom(expand6_t *ctx, uint16_t mem_adr, uint8_t *buf, uint8_t len)
EEPROM Read function.
expand6_sel_pwm_pin
void expand6_sel_pwm_pin(expand6_t *ctx, uint16_t pin, uint8_t pwm_en)
Select a PWM output pin function.
expand6_read_pin
uint8_t expand6_read_pin(expand6_t *ctx, uint16_t pin, uint8_t inv)
Get a single INPUT pin's logic level function.
expand6_write_eeprom
void expand6_write_eeprom(expand6_t *ctx, uint16_t mem_adr, uint8_t *buf, uint8_t len)
EEPROM Write function.
expand6_check_int
uint8_t expand6_check_int(expand6_t *ctx)
Get Interrupt state function.
expand6_send_eeprom_cmd
void expand6_send_eeprom_cmd(expand6_t *ctx, uint8_t cmd)
Send Command function.
expand6_cfg_t::sda
pin_name_t sda
Definition: expand6.h:440
expand6_read_port_exp
void expand6_read_port_exp(expand6_t *ctx, uint8_t reg, uint8_t *buf, uint8_t len)
Port Expander Read function.
expand6_cfg_t::int_pin
pin_name_t int_pin
Definition: expand6.h:445
expand6_read_port
uint8_t expand6_read_port(expand6_t *ctx, uint8_t port, uint8_t inv)
Get all pin logic levels from one port function.
expand6_write_pin
void expand6_write_pin(expand6_t *ctx, uint16_t pin, uint8_t pin_val)
Set a single OUTPUT pin's logic level function.
expand6_pwm_cfg_t
PWM Configuration.
Definition: expand6.h:400
expand6_init
EXPAND6_RETVAL expand6_init(expand6_t *ctx, expand6_cfg_t *cfg)
Initialization function.
expand6_cfg_t::scl
pin_name_t scl
Definition: expand6.h:439
expand6_cfg_setup
void expand6_cfg_setup(expand6_cfg_t *cfg)
Config Object Initialization function.
expand6_t::rst
digital_out_t rst
Definition: expand6.h:416
EXPAND6_RETVAL
#define EXPAND6_RETVAL
Definition: expand6.h:73
expand6_write_port
void expand6_write_port(expand6_t *ctx, uint8_t port, uint8_t value)
Set all OUTPUT pins' logic levels in one port function.
expand6_get_port_out_lvl
uint8_t expand6_get_port_out_lvl(expand6_t *ctx, uint8_t port)
Get all pin output settings from one port function.
expand6_cfg_t::i2c_speed
uint32_t i2c_speed
Definition: expand6.h:449
expand6_generic_write
void expand6_generic_write(expand6_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic write function.
expand6_write_bit
void expand6_write_bit(expand6_t *ctx, uint8_t reg_adr, uint8_t bit_num, uint8_t pin_val)
Write bit function.
expand6_cfg_t::i2c_address
uint8_t i2c_address
Definition: expand6.h:450
expand6_pwm_cfg_t::pulse_wid
uint8_t pulse_wid
Definition: expand6.h:404
expand6_get_pin_out_lvl
uint8_t expand6_get_pin_out_lvl(expand6_t *ctx, uint16_t pin)
Get a single OUTPUT pin's setting function.
expand6_eeprom_enable
void expand6_eeprom_enable(expand6_t *ctx, uint8_t cmd)
Enable Register Configuration function.
expand6_read_byte
uint8_t expand6_read_byte(expand6_t *ctx, uint8_t reg_adr)
Read byte function.
expand6_read_bit
uint8_t expand6_read_bit(expand6_t *ctx, uint8_t reg_adr, uint8_t bit_num)
Read bit function.
expand6_reset
void expand6_reset(expand6_t *ctx)
Reset function.
expand6_pwm_cfg_t::pwm_sel
uint8_t pwm_sel
Definition: expand6.h:401