summaryrefslogtreecommitdiffstats
path: root/firmware/pcf8574.h
blob: 13b6854b43c76292194a2949b382599f8521e23c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#ifndef PCF8574_H_
#define PCF8574_H_

#include <stdint.h>

#include "twi_master.h"
#include "util.h"


/* PCF-8574 chip context. */
struct pcf8574_chip {
	/* I2C transfer context. */
	struct twi_transfer xfer;
};

void pcf8574_init(struct pcf8574_chip *chip,
		  uint8_t address, bool chipversion_A,
		  bool initial_state);

void pcf8574_write(struct pcf8574_chip *chip,
		   uint8_t write_value);
void pcf8574_wait(struct pcf8574_chip *chip);

uint8_t pcf8574_read(struct pcf8574_chip *chip);

uint8_t pcf8574_write_read(struct pcf8574_chip *chip,
			   uint8_t write_value);

#endif /* PCF8574_H_ */
bues.ch cgit interface