-
Notifications
You must be signed in to change notification settings - Fork 9
/
PCA9554.h
48 lines (35 loc) · 1.08 KB
/
PCA9554.h
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/***************************************************************************
Title: PCA9554
by: AD0ND
This file is free software; you can redistribute it and/or modify
it under the terms of either the GNU General Public License version 2
or the GNU Lesser General Public License version 2.1, both as
published by the Free Software Foundation.
***************************************************************************/
#ifndef PCA9554_h
#define PCA9554_h
#include <Arduino.h>
#include <Wire.h>
//PCA9554 Command Byte
#define INPUTPORT 0x00
#define OUTPUTPORT 0x01
#define POLINVPORT 0x02
#define CONFIGPORT 0x03
#define ALLOUTPUT 0x00
#define ALLINPUT 0xFF
class PCA9554
{
public :
PCA9554(byte SlaveAddress);
bool twiRead(byte ®isterAddress);
bool twiWrite(byte registerAddress, byte dataWrite);
bool pinMode(byte pinNumber, bool state);
bool portMode(byte value);
bool digitalWrite(byte pinNumber, bool state);
bool digitalWritePort(byte value);
bool digitalRead(byte &pinNumber);
bool digitalReadPort(byte &value);
private :
int _SlaveAddress;
};
#endif