expand7  2.0.0.0
expand7.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 EXPAND7_H
36 #define EXPAND7_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 EXPAND7_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 EXPAND7_OK 0
74 #define EXPAND7_ERROR -1
75 
81 #define EXPAND7_M_PORT_BASE_ADR 0x20
82 #define EXPAND7_EEPROM_BASE_ADR 0x50
83 #define EXPAND7_DEV_ADR_GND 0x00
84 #define EXPAND7_DEV_ADR_VCC 0x01
85 
91 #define EXPAND7_REG_IN_PORT0_ADR 0x00
92 #define EXPAND7_REG_IN_PORT1_ADR 0x01
93 #define EXPAND7_REG_IN_PORT2_ADR 0x02
94 #define EXPAND7_REG_IN_PORT3_ADR 0x03
95 #define EXPAND7_REG_IN_PORT4_ADR 0x04
96 #define EXPAND7_REG_IN_PORT5_ADR 0x05
97 #define EXPAND7_REG_IN_PORT6_ADR 0x06
98 #define EXPAND7_REG_IN_PORT7_ADR 0x07
99 #define EXPAND7_REG_OUT_PORT0_ADR 0x08
100 #define EXPAND7_REG_OUT_PORT1_ADR 0x09
101 #define EXPAND7_REG_OUT_PORT2_ADR 0x0A
102 #define EXPAND7_REG_OUT_PORT3_ADR 0x0B
103 #define EXPAND7_REG_OUT_PORT4_ADR 0x0C
104 #define EXPAND7_REG_OUT_PORT5_ADR 0x0D
105 #define EXPAND7_REG_OUT_PORT6_ADR 0x0E
106 #define EXPAND7_REG_OUT_PORT7_ADR 0x0F
107 #define EXPAND7_REG_INT_STAT_PORT0_ADR 0x10
108 #define EXPAND7_REG_INT_STAT_PORT1_ADR 0x11
109 #define EXPAND7_REG_INT_STAT_PORT2_ADR 0x12
110 #define EXPAND7_REG_INT_STAT_PORT3_ADR 0x13
111 #define EXPAND7_REG_INT_STAT_PORT4_ADR 0x14
112 #define EXPAND7_REG_INT_STAT_PORT5_ADR 0x15
113 #define EXPAND7_REG_INT_STAT_PORT6_ADR 0x16
114 #define EXPAND7_REG_INT_STAT_PORT7_ADR 0x17
115 #define EXPAND7_REG_PORT_SEL_ADR 0x18
116 #define EXPAND7_REG_INT_MASK_ADR 0x19
117 #define EXPAND7_REG_SEL_PWM_OUT_ADR 0x1A
118 #define EXPAND7_REG_INV_ADR 0x1B
119 #define EXPAND7_REG_PORT_DIR_ADR 0x1C
120 #define EXPAND7_REG_PULL_UP_ADR 0x1D
121 #define EXPAND7_REG_PULL_DOWN_ADR 0x1E
122 #define EXPAND7_REG_OPEN_DRAIN_HIGH_ADR 0x1F
123 #define EXPAND7_REG_OPEN_DRAIN_LOW_ADR 0x20
124 #define EXPAND7_REG_STRONG_ADR 0x21
125 #define EXPAND7_REG_SLOW_STRONG_ADR 0x22
126 #define EXPAND7_REG_HIGH_Z_ADR 0x23
127 #define EXPAND7_REG_RSRVD_1_ADR 0x24
128 #define EXPAND7_REG_RSRVD_2_ADR 0x25
129 #define EXPAND7_REG_RSRVD_3_ADR 0x26
130 #define EXPAND7_REG_RSRVD_4_ADR 0x27
131 #define EXPAND7_REG_PWM_SEL_ADR 0x28
132 #define EXPAND7_REG_CFG_PWM_ADR 0x29
133 #define EXPAND7_REG_PERIOD_PWM_ADR 0x2A
134 #define EXPAND7_REG_PULSE_WIDTH_PWM_ADR 0x2B
135 #define EXPAND7_REG_DIVIDER_ADR 0x2C
136 #define EXPAND7_REG_EEPROM_ADR 0x2D
137 #define EXPAND7_REG_DEV_ID_ADR 0x2E
138 #define EXPAND7_REG_WDT_ADR 0x2F
139 #define EXPAND7_REG_CMD_ADR 0x30
140 
146 #define EXPAND7_SEL_PWM_0 0x00
147 #define EXPAND7_SEL_PWM_1 0x01
148 #define EXPAND7_SEL_PWM_2 0x02
149 #define EXPAND7_SEL_PWM_3 0x03
150 #define EXPAND7_SEL_PWM_4 0x04
151 #define EXPAND7_SEL_PWM_5 0x05
152 #define EXPAND7_SEL_PWM_6 0x06
153 #define EXPAND7_SEL_PWM_7 0x07
154 
160 #define EXPAND7_PWM_CLK_SRC_32_KHZ 0x00
161 #define EXPAND7_PWM_CLK_SRC_24_MHZ 0x01
162 #define EXPAND7_PWM_CLK_SRC_1_5_MHZ 0x02
163 #define EXPAND7_PWM_CLK_SRC_93_75_KHZ 0x03
164 #define EXPAND7_PWM_CLK_SRC_367_6_HZ 0x04
165 #define EXPAND7_PWM_CLK_SRC_PREV 0x05
166 
172 #define EXPAND7_STORE_POR_CFG_TO_EEPROM 0x01
173 #define EXPAND7_RESTORE_DEFAULTS 0x02
174 #define EXPAND7_WRITE_EEPROM_POR 0x03
175 #define EXPAND7_READ_EEPROM_POR 0x04
176 #define EXPAND7_WRITE_DEV_CFG 0x05
177 #define EXPAND7_READ_DEV_CFG 0x06
178 #define EXPAND7_RECFG_DEV_TO_POR 0x07
179 
185 #define EXPAND7_EEPROM_EN_WDE 0x01
186 #define EXPAND7_EEPROM_EN_EEE 0x02
187 #define EXPAND7_EEPROM_EN_EERO 0x04
188 
194 #define EXPAND7_PORT_0 0x00
195 #define EXPAND7_PORT_1 0x01
196 #define EXPAND7_PORT_2 0x02
197 #define EXPAND7_PORT_3 0x03
198 #define EXPAND7_PORT_4 0x04
199 #define EXPAND7_PORT_5 0x05
200 
206 #define EXPAND7_LOW 0x00
207 #define EXPAND7_HIGH 0x01
208 #define EXPAND7_INT_NORMAL 0x00
209 #define EXPAND7_INT_INVERTED 0x01
210 
216 #define EXPAND7_PORT0_OUT_INX 0x00
217 #define EXPAND7_PORT1_OUT_INX 0x01
218 #define EXPAND7_PORT2_OUT_INX 0x02
219 #define EXPAND7_PORT3_OUT_INX 0x03
220 #define EXPAND7_PORT4_OUT_INX 0x04
221 #define EXPAND7_PORT5_OUT_INX 0x05
222 #define EXPAND7_PORT6_OUT_INX 0x06
223 #define EXPAND7_PORT7_OUT_INX 0x07
224 
225 #define EXPAND7_PORT0_INT_MASK_INX 0x08
226 #define EXPAND7_PORT1_INT_MASK_INX 0x09
227 #define EXPAND7_PORT2_INT_MASK_INX 0x0A
228 #define EXPAND7_PORT3_INT_MASK_INX 0x0B
229 #define EXPAND7_PORT4_INT_MASK_INX 0x0C
230 #define EXPAND7_PORT5_INT_MASK_INX 0x0D
231 #define EXPAND7_PORT6_INT_MASK_INX 0x0E
232 #define EXPAND7_PORT7_INT_MASK_INX 0x0F
233 
234 #define EXPAND7_PORT0_SEL_PWM_INX 0x10
235 #define EXPAND7_PORT1_SEL_PWM_INX 0x11
236 #define EXPAND7_PORT2_SEL_PWM_INX 0x12
237 #define EXPAND7_PORT3_SEL_PWM_INX 0x13
238 #define EXPAND7_PORT4_SEL_PWM_INX 0x14
239 #define EXPAND7_PORT5_SEL_PWM_INX 0x15
240 #define EXPAND7_PORT6_SEL_PWM_INX 0x16
241 #define EXPAND7_PORT7_SEL_PWM_INX 0x17
242 
243 #define EXPAND7_PORT0_INV_INX 0x18
244 #define EXPAND7_PORT1_INV_INX 0x19
245 #define EXPAND7_PORT2_INV_INX 0x1A
246 #define EXPAND7_PORT3_INV_INX 0x1B
247 #define EXPAND7_PORT4_INV_INX 0x1C
248 #define EXPAND7_PORT5_INV_INX 0x1D
249 #define EXPAND7_PORT6_INV_INX 0x1E
250 #define EXPAND7_PORT7_INV_INX 0x1F
251 
252 #define EXPAND7_PORT0_DIR_INX 0x20
253 #define EXPAND7_PORT1_DIR_INX 0x21
254 #define EXPAND7_PORT2_DIR_INX 0x22
255 #define EXPAND7_PORT3_DIR_INX 0x23
256 #define EXPAND7_PORT4_DIR_INX 0x24
257 #define EXPAND7_PORT5_DIR_INX 0x25
258 #define EXPAND7_PORT6_DIR_INX 0x26
259 #define EXPAND7_PORT7_DIR_INX 0x27
260 
261 #define EXPAND7_PORT0_PULL_UP_INX 0x28
262 #define EXPAND7_PORT0_PULL_DOWN_INX 0x29
263 #define EXPAND7_PORT0_OPEN_DRAIN_HIGH_INX 0x2A
264 #define EXPAND7_PORT0_OPEN_DRAIN_LOW_INX 0x2B
265 #define EXPAND7_PORT0_STRONG_INX 0x2C
266 #define EXPAND7_PORT0_SLOW_STRONG_INX 0x2D
267 #define EXPAND7_PORT0_HIGH_Z_INX 0x2E
268 
269 #define EXPAND7_PORT1_PULL_UP_INX 0x2F
270 #define EXPAND7_PORT1_PULL_DOWN_INX 0x30
271 #define EXPAND7_PORT1_OPEN_DRAIN_HIGH_INX 0x31
272 #define EXPAND7_PORT1_OPEN_DRAIN_LOW_INX 0x32
273 #define EXPAND7_PORT1_STRONG_INX 0x33
274 #define EXPAND7_PORT1_SLOW_STRONG_INX 0x34
275 #define EXPAND7_PORT1_HIGH_Z_INX 0x35
276 
277 #define EXPAND7_PORT2_PULL_UP_INX 0x36
278 #define EXPAND7_PORT2_PULL_DOWN_INX 0x37
279 #define EXPAND7_PORT2_OPEN_DRAIN_HIGH_INX 0x38
280 #define EXPAND7_PORT2_OPEN_DRAIN_LOW_INX 0x39
281 #define EXPAND7_PORT2_STRONG_INX 0x3A
282 #define EXPAND7_PORT2_SLOW_STRONG_INX 0x3B
283 #define EXPAND7_PORT2_HIGH_Z_INX 0x3C
284 
285 #define EXPAND7_PORT3_PULL_UP_INX 0x3D
286 #define EXPAND7_PORT3_PULL_DOWN_INX 0x3E
287 #define EXPAND7_PORT3_OPEN_DRAIN_HIGH_INX 0x3F
288 #define EXPAND7_PORT3_OPEN_DRAIN_LOW_INX 0x40
289 #define EXPAND7_PORT3_STRONG_INX 0x41
290 #define EXPAND7_PORT3_SLOW_STRONG_INX 0x42
291 #define EXPAND7_PORT3_HIGH_Z_INX 0x43
292 
293 #define EXPAND7_PORT4_PULL_UP_INX 0x44
294 #define EXPAND7_PORT4_PULL_DOWN_INX 0x45
295 #define EXPAND7_PORT4_OPEN_DRAIN_HIGH_INX 0x46
296 #define EXPAND7_PORT4_OPEN_DRAIN_LOW_INX 0x47
297 #define EXPAND7_PORT4_STRONG_INX 0x48
298 #define EXPAND7_PORT4_SLOW_STRONG_INX 0x49
299 #define EXPAND7_PORT4_HIGH_Z_INX 0x4A
300 
301 #define EXPAND7_PORT5_PULL_UP_INX 0x4B
302 #define EXPAND7_PORT5_PULL_DOWN_INX 0x4C
303 #define EXPAND7_PORT5_OPEN_DRAIN_HIGH_INX 0x4D
304 #define EXPAND7_PORT5_OPEN_DRAIN_LOW_INX 0x4E
305 #define EXPAND7_PORT5_STRONG_INX 0x4F
306 #define EXPAND7_PORT5_SLOW_STRONG_INX 0x50
307 #define EXPAND7_PORT5_HIGH_Z_INX 0x51
308 
309 #define EXPAND7_PORT6_PULL_UP_INX 0x52
310 #define EXPAND7_PORT6_PULL_DOWN_INX 0x53
311 #define EXPAND7_PORT6_OPEN_DRAIN_HIGH_INX 0x54
312 #define EXPAND7_PORT6_OPEN_DRAIN_LOW_INX 0x55
313 #define EXPAND7_PORT6_STRONG_INX 0x56
314 #define EXPAND7_PORT6_SLOW_STRONG_INX 0x57
315 #define EXPAND7_PORT6_HIGH_Z_INX 0x58
316 
317 #define EXPAND7_PORT7_PULL_UP_INX 0x59
318 #define EXPAND7_PORT7_PULL_DOWN_INX 0x5A
319 #define EXPAND7_PORT7_OPEN_DRAIN_HIGH_INX 0x5B
320 #define EXPAND7_PORT7_OPEN_DRAIN_LOW_INX 0x5C
321 #define EXPAND7_PORT7_STRONG_INX 0x5D
322 #define EXPAND7_PORT7_SLOW_STRONG_INX 0x5E
323 #define EXPAND7_PORT7_HIGH_Z_INX 0x5F
324 
325 #define EXPAND7_PWM0_CFG_INX 0x60
326 #define EXPAND7_PWM0_PERIOD_INX 0x61
327 #define EXPAND7_PWM0_PULSE_WIDTH_INX 0x62
328 
329 #define EXPAND7_PWM1_CFG_INX 0x63
330 #define EXPAND7_PWM1_PERIOD_INX 0x64
331 #define EXPAND7_PWM1_PULSE_WIDTH_INX 0x65
332 
333 #define EXPAND7_PWM2_CFG_INX 0x66
334 #define EXPAND7_PWM2_PERIOD_INX 0x67
335 #define EXPAND7_PWM2_PULSE_WIDTH_INX 0x68
336 
337 #define EXPAND7_PWM3_CFG_INX 0x69
338 #define EXPAND7_PWM3_PERIOD_INX 0x6A
339 #define EXPAND7_PWM3_PULSE_WIDTH_INX 0x6B
340 
341 #define EXPAND7_PWM4_CFG_INX 0x6C
342 #define EXPAND7_PWM4_PERIOD_INX 0x6D
343 #define EXPAND7_PWM4_PULSE_WIDTH_INX 0x6E
344 
345 #define EXPAND7_PWM5_CFG_INX 0x6F
346 #define EXPAND7_PWM5_PERIOD_INX 0x70
347 #define EXPAND7_PWM5_PULSE_WIDTH_INX 0x71
348 
349 #define EXPAND7_PWM6_CFG_INX 0x72
350 #define EXPAND7_PWM6_PERIOD_INX 0x73
351 #define EXPAND7_PWM6_PULSE_WIDTH_INX 0x74
352 
353 #define EXPAND7_PWM7_CFG_INX 0x75
354 #define EXPAND7_PWM7_PERIOD_INX 0x76
355 #define EXPAND7_PWM7_PULSE_WIDTH_INX 0x77
356 
357 #define EXPAND7_PWM8_CFG_INX 0x78
358 #define EXPAND7_PWM8_PERIOD_INX 0x79
359 #define EXPAND7_PWM8_PULSE_WIDTH_INX 0x7A
360 
361 #define EXPAND7_PWM9_CFG_INX 0x7B
362 #define EXPAND7_PWM9_PERIOD_INX 0x7C
363 #define EXPAND7_PWM9_PULSE_WIDTH_INX 0x7D
364 
365 #define EXPAND7_PWM10_CFG_INX 0x7E
366 #define EXPAND7_PWM10_PERIOD_INX 0x7F
367 #define EXPAND7_PWM10_PULSE_WIDTH_INX 0x80
368 
369 #define EXPAND7_PWM11_CFG_INX 0x81
370 #define EXPAND7_PWM11_PERIOD_INX 0x82
371 #define EXPAND7_PWM11_PULSE_WIDTH_INX 0x83
372 
373 #define EXPAND7_PWM12_CFG_INX 0x84
374 #define EXPAND7_PWM12_PERIOD_INX 0x85
375 #define EXPAND7_PWM12_PULSE_WIDTH_INX 0x86
376 
377 #define EXPAND7_PWM13_CFG_INX 0x87
378 #define EXPAND7_PWM13_PERIOD_INX 0x88
379 #define EXPAND7_PWM13_PULSE_WIDTH_INX 0x89
380 
381 #define EXPAND7_PWM14_CFG_INX 0x8A
382 #define EXPAND7_PWM14_PERIOD_INX 0x8B
383 #define EXPAND7_PWM14_PULSE_WIDTH_INX 0x8C
384 
385 #define EXPAND7_PWM15_CFG_INX 0x8D
386 #define EXPAND7_PWM15_PERIOD_INX 0x8E
387 #define EXPAND7_PWM15_PULSE_WIDTH_INX 0x8F
388 
389 #define EXPAND7_DIVIDER_INX 0x90
390 #define EXPAND7_EEPROM_ENABLE_INX 0x91
391 #define EXPAND7_CRC_INX 0x92
392  // End group macro
395 // --------------------------------------------------------------- PUBLIC TYPES
404 typedef struct
405 {
406  uint8_t pwm_sel;
407  uint8_t clk_src;
408  uint8_t period;
409  uint8_t pulse_wid;
410  uint8_t devider;
411 
413 
417 typedef struct
418 {
419  // Output pins
420  digital_out_t rst;
421 
422  // Input pins
423  digital_in_t int_pin;
424 
425  // Modules
426  i2c_master_t i2c;
427 
428  // ctx variable
429  uint8_t slave_address;
430 
431 } expand7_t;
432 
436 typedef struct
437 {
438  // Communication gpio pins
439  pin_name_t scl;
440  pin_name_t sda;
441 
442  // Additional gpio pins
443  pin_name_t rst;
444  pin_name_t int_pin;
445 
446  // static variable
447  uint32_t i2c_speed;
448  uint8_t i2c_address;
449 
450 } expand7_cfg_t;
451  // End types group
453 // ----------------------------------------------- PUBLIC FUNCTION DECLARATIONS
454 
460 #ifdef __cplusplus
461 extern "C"{
462 #endif
463 
473 
481 err_t expand7_init ( expand7_t *ctx, expand7_cfg_t *cfg );
482 
493 void expand7_generic_write ( expand7_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len );
494 
506 void expand7_generic_read ( expand7_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len );
507 
517 void expand7_write_byte ( expand7_t *ctx, uint8_t reg_adr, uint8_t wr_data );
518 
529 uint8_t expand7_read_byte ( expand7_t *ctx, uint8_t reg_adr );
530 
542 void expand7_write_port_exp ( expand7_t *ctx, uint8_t reg, uint8_t *buf, uint8_t len );
543 
555 void expand7_read_port_exp ( expand7_t *ctx, uint8_t reg, uint8_t *buf, uint8_t len );
556 
565 void expand7_send_eeprom_cmd ( expand7_t *ctx, uint8_t cmd );
566 
577 void expand7_write_eeprom ( expand7_t *ctx, uint16_t mem_adr, uint8_t *buf, uint8_t len );
578 
589 void expand7_read_eeprom ( expand7_t *ctx, uint16_t mem_adr, uint8_t *buf, uint8_t len );
590 
602 uint8_t expand7_read_bit ( expand7_t *ctx, uint8_t reg_adr, uint8_t bit_num );
603 
614 void expand7_write_bit ( expand7_t *ctx, uint8_t reg_adr, uint8_t bit_num, uint8_t pin_val );
615 
626 uint8_t expand7_read_pin ( expand7_t *ctx, uint8_t pin, uint8_t inv );
627 
638 uint8_t expand7_read_port ( expand7_t *ctx, uint8_t port, uint8_t inv );
639 
650 uint8_t expand7_get_pin_out_lvl ( expand7_t *ctx, uint8_t pin );
651 
662 uint8_t expand7_get_port_out_lvl ( expand7_t *ctx, uint8_t port );
663 
673 void expand7_write_pin ( expand7_t *ctx, uint8_t pin, uint8_t pin_val );
674 
684 void expand7_write_port ( expand7_t *ctx, uint8_t port, uint8_t value );
685 
696 void expand7_write_all ( expand7_t *ctx, uint8_t value );
697 
707 void expand7_sel_pwm_pin ( expand7_t *ctx, uint8_t pin, uint8_t pwm_en );
708 
719 void expand7_pwm_cfg ( expand7_t *ctx, expand7_pwm_cfg_t pwm_cfg, float *duty_cyc, float *freq );
720 
731 void expand7_eeprom_enable ( expand7_t *ctx, uint8_t cmd );
732 
741 void expand7_reset ( expand7_t *ctx );
742 
754 uint8_t expand7_check_int ( expand7_t *ctx );
755 
756 #ifdef __cplusplus
757 }
758 #endif
759 #endif // _EXPAND7_H_
760  // End public_function group
763 
764 // ------------------------------------------------------------------------- END
expand7_pwm_cfg_t::clk_src
uint8_t clk_src
Definition: expand7.h:407
expand7_cfg_t::rst
pin_name_t rst
Definition: expand7.h:443
expand7_t::rst
digital_out_t rst
Definition: expand7.h:420
expand7_write_port_exp
void expand7_write_port_exp(expand7_t *ctx, uint8_t reg, uint8_t *buf, uint8_t len)
Port Expander Write function.
expand7_cfg_t
Click configuration structure definition.
Definition: expand7.h:437
expand7_init
err_t expand7_init(expand7_t *ctx, expand7_cfg_t *cfg)
Initialization function.
expand7_read_port
uint8_t expand7_read_port(expand7_t *ctx, uint8_t port, uint8_t inv)
Get all pin logic levels from one port function.
expand7_t
Click ctx object definition.
Definition: expand7.h:418
expand7_get_pin_out_lvl
uint8_t expand7_get_pin_out_lvl(expand7_t *ctx, uint8_t pin)
Get a single OUTPUT pin's setting function.
expand7_read_pin
uint8_t expand7_read_pin(expand7_t *ctx, uint8_t pin, uint8_t inv)
Get a single INPUT pin's logic level function.
expand7_eeprom_enable
void expand7_eeprom_enable(expand7_t *ctx, uint8_t cmd)
Enable Register Configuration function.
expand7_generic_read
void expand7_generic_read(expand7_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic read function.
expand7_generic_write
void expand7_generic_write(expand7_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
Generic write function.
expand7_reset
void expand7_reset(expand7_t *ctx)
Reset function.
expand7_pwm_cfg_t::period
uint8_t period
Definition: expand7.h:408
expand7_read_port_exp
void expand7_read_port_exp(expand7_t *ctx, uint8_t reg, uint8_t *buf, uint8_t len)
Port Expander Read function.
expand7_sel_pwm_pin
void expand7_sel_pwm_pin(expand7_t *ctx, uint8_t pin, uint8_t pwm_en)
Select a PWM output pin function.
expand7_write_port
void expand7_write_port(expand7_t *ctx, uint8_t port, uint8_t value)
Set all OUTPUT pins' logic levels in one port function.
expand7_t::i2c
i2c_master_t i2c
Definition: expand7.h:426
expand7_write_byte
void expand7_write_byte(expand7_t *ctx, uint8_t reg_adr, uint8_t wr_data)
Write byte function.
expand7_get_port_out_lvl
uint8_t expand7_get_port_out_lvl(expand7_t *ctx, uint8_t port)
Get all pin output settings from one port function.
expand7_send_eeprom_cmd
void expand7_send_eeprom_cmd(expand7_t *ctx, uint8_t cmd)
Send Command function.
expand7_write_pin
void expand7_write_pin(expand7_t *ctx, uint8_t pin, uint8_t pin_val)
Set a single OUTPUT pin's logic level function.
expand7_t::int_pin
digital_in_t int_pin
Definition: expand7.h:423
expand7_cfg_t::scl
pin_name_t scl
Definition: expand7.h:439
expand7_write_eeprom
void expand7_write_eeprom(expand7_t *ctx, uint16_t mem_adr, uint8_t *buf, uint8_t len)
EEPROM Write function.
expand7_cfg_setup
void expand7_cfg_setup(expand7_cfg_t *cfg)
Config Object Initialization function.
expand7_cfg_t::sda
pin_name_t sda
Definition: expand7.h:440
expand7_pwm_cfg_t::devider
uint8_t devider
Definition: expand7.h:410
expand7_read_byte
uint8_t expand7_read_byte(expand7_t *ctx, uint8_t reg_adr)
Read byte function.
expand7_pwm_cfg
void expand7_pwm_cfg(expand7_t *ctx, expand7_pwm_cfg_t pwm_cfg, float *duty_cyc, float *freq)
PWM Configuration function.
expand7_write_bit
void expand7_write_bit(expand7_t *ctx, uint8_t reg_adr, uint8_t bit_num, uint8_t pin_val)
Write bit function.
expand7_read_bit
uint8_t expand7_read_bit(expand7_t *ctx, uint8_t reg_adr, uint8_t bit_num)
Read bit function.
expand7_check_int
uint8_t expand7_check_int(expand7_t *ctx)
Get Interrupt state function.
expand7_pwm_cfg_t
PWM Configuration.
Definition: expand7.h:405
expand7_cfg_t::i2c_address
uint8_t i2c_address
Definition: expand7.h:448
expand7_cfg_t::int_pin
pin_name_t int_pin
Definition: expand7.h:444
expand7_read_eeprom
void expand7_read_eeprom(expand7_t *ctx, uint16_t mem_adr, uint8_t *buf, uint8_t len)
EEPROM Read function.
expand7_pwm_cfg_t::pwm_sel
uint8_t pwm_sel
Definition: expand7.h:406
expand7_t::slave_address
uint8_t slave_address
Definition: expand7.h:429
expand7_write_all
void expand7_write_all(expand7_t *ctx, uint8_t value)
Set all OUTPUT pins' logic levels function.
expand7_pwm_cfg_t::pulse_wid
uint8_t pulse_wid
Definition: expand7.h:409
expand7_cfg_t::i2c_speed
uint32_t i2c_speed
Definition: expand7.h:447