LibDriver PCF8575
Loading...
Searching...
No Matches
driver_pcf8575_basic.c
Go to the documentation of this file.
1
36
38
39static pcf8575_handle_t gs_handle;
40
50{
51 uint8_t res;
52
53 /* link functions */
61
62 /* set addr pin */
63 res = pcf8575_set_addr_pin(&gs_handle, addr);
64 if (res != 0)
65 {
66 pcf8575_interface_debug_print("pcf8575: set addr pin failed.\n");
67
68 return 1;
69 }
70
71 /* pcf8575 init */
72 res = pcf8575_init(&gs_handle);
73 if (res != 0)
74 {
75 pcf8575_interface_debug_print("pcf8575: init failed.\n");
76
77 return 1;
78 }
79
80 return 0;
81}
82
91{
92 if (pcf8575_deinit(&gs_handle) != 0)
93 {
94 return 1;
95 }
96
97 return 0;
98}
99
110{
111 if (pcf8575_read(&gs_handle, pin, level) != 0)
112 {
113 return 1;
114 }
115
116 return 0;
117}
118
129{
130 if (pcf8575_write(&gs_handle, pin, level) != 0)
131 {
132 return 1;
133 }
134
135 return 0;
136}
driver pcf8575 basic header file
uint8_t pcf8575_deinit(pcf8575_handle_t *handle)
close the chip
struct pcf8575_handle_s pcf8575_handle_t
pcf8575 handle structure definition
uint8_t pcf8575_set_addr_pin(pcf8575_handle_t *handle, pcf8575_address_t addr_pin)
set the address pin
uint8_t pcf8575_write(pcf8575_handle_t *handle, pcf8575_pin_t pin, pcf8575_pin_level_t level)
write the pin
uint8_t pcf8575_read(pcf8575_handle_t *handle, pcf8575_pin_t pin, pcf8575_pin_level_t *level)
read the pin
uint8_t pcf8575_init(pcf8575_handle_t *handle)
initialize the chip
pcf8575_address_t
pcf8575 address enumeration definition
pcf8575_pin_t
pcf8575 pin enumeration definition
pcf8575_pin_level_t
pcf8575 pin enumeration definition
uint8_t pcf8575_basic_deinit(void)
basic example deinit
uint8_t pcf8575_basic_read(pcf8575_pin_t pin, pcf8575_pin_level_t *level)
basic example read
uint8_t pcf8575_basic_write(pcf8575_pin_t pin, pcf8575_pin_level_t level)
basic example write
uint8_t pcf8575_basic_init(pcf8575_address_t addr)
basic example init
void pcf8575_interface_delay_ms(uint32_t ms)
interface delay ms
uint8_t pcf8575_interface_iic_write_cmd(uint8_t addr, uint8_t *buf, uint16_t len)
interface iic bus write command
uint8_t pcf8575_interface_iic_init(void)
interface iic bus init
void pcf8575_interface_debug_print(const char *const fmt,...)
interface print format data
uint8_t pcf8575_interface_iic_deinit(void)
interface iic bus deinit
uint8_t pcf8575_interface_iic_read_cmd(uint8_t addr, uint8_t *buf, uint16_t len)
interface iic bus read command