23 lines
638 B
C
23 lines
638 B
C
#ifndef PCA9555_H
|
|
#define PCA9555_H
|
|
|
|
#include "lib/mystd.h"
|
|
|
|
#define PCA9555_ADDR 0b0100000
|
|
#define PCA9555_INPUT_PORT0 0x00
|
|
#define PCA9555_INPUT_PORT1 0x01
|
|
#define PCA9555_OUTPUT_PORT0 0x02
|
|
#define PCA9555_OUTPUT_PORT1 0x03
|
|
#define PCA9555_CONFIG_PORT0 0x06
|
|
#define PCA9555_CONFIG_PORT1 0x07
|
|
|
|
extern uint8_t ADDR_BITS;
|
|
static inline uint8_t pca9555_addr(void) {
|
|
return PCA9555_ADDR | ADDR_BITS;
|
|
}
|
|
t_error pca9555_detect_addr(void);
|
|
t_error pca9555_read(uint8_t reg, uint8_t* out);
|
|
t_error pca9555_write(uint8_t reg, uint8_t value);
|
|
t_error pca9555_write_masked(uint8_t reg, uint8_t value, uint8_t mask);
|
|
|
|
#endif /* PCA9555_H */
|