28 lines
663 B
C
28 lines
663 B
C
#ifndef _PCA9555_H_
|
|
#define _PCA9555_H_
|
|
|
|
#include <stdint.h>
|
|
|
|
#define PCA9555_I2C_ADDR (0x40)
|
|
#define PCA9555_REG_IN_PORT0 (0x0)
|
|
#define PCA9555_REG_IN_PORT1 (0x1)
|
|
#define PCA9555_REG_OUT_PORT0 (0x2)
|
|
#define PCA9555_REG_OUT_PORT1 (0x3)
|
|
#define PCA9555_REG_POLARITY0 (0x4)
|
|
#define PCA9555_REG_POLARITY1 (0x5)
|
|
#define PCA9555_REG_CONFIG0 (0x6)
|
|
#define PCA9555_REG_CONFIG1 (0x7)
|
|
|
|
/**
|
|
* @brief Init I2C and port expander
|
|
*/
|
|
void port_expander_init(void);
|
|
|
|
uint8_t port_expander_get_buttons(void);
|
|
|
|
void port_expander_set_leds(uint8_t leds);
|
|
|
|
uint8_t port_expander_get_leds(void);
|
|
|
|
void port_expander_set_single_led(uint8_t pos, uint8_t val);
|
|
#endif /* _PCA9555_H */ |