pcf8574.h 633 B

123456789101112131415161718192021222324252627282930
  1. #ifndef PCF8574_H_
  2. #define PCF8574_H_
  3. #include <stdint.h>
  4. #include "twi_master.h"
  5. #include "util.h"
  6. /* PCF-8574 chip context. */
  7. struct pcf8574_chip {
  8. /* I2C transfer context. */
  9. struct twi_transfer xfer;
  10. };
  11. void pcf8574_init(struct pcf8574_chip *chip,
  12. uint8_t address, bool chipversion_A,
  13. bool initial_state);
  14. void pcf8574_write(struct pcf8574_chip *chip,
  15. uint8_t write_value);
  16. void pcf8574_wait(struct pcf8574_chip *chip);
  17. uint8_t pcf8574_read(struct pcf8574_chip *chip);
  18. uint8_t pcf8574_write_read(struct pcf8574_chip *chip,
  19. uint8_t write_value);
  20. #endif /* PCF8574_H_ */