-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPISO_74HC165.cpp
86 lines (67 loc) · 1.4 KB
/
PISO_74HC165.cpp
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#include <Arduino.h>
#include "SoftataDevice_deviceinput.h"
#include "ic_74hc165_shiftRegister.h"
Piso74HC165::Piso74HC165()
{
Setup();
}
Piso74HC165::Piso74HC165(int pin)
{
byte _pin= pin;
Setup(&_pin,1);
}
bool Piso74HC165::Setup()
{
ic165 = new IC_74HC165_ShiftRegister();
num_bytes = 2;
num_bits = 8*num_bytes;
return true;
}
bool Piso74HC165::Setup(byte * settings, byte numSettings)
{
ic165 = new IC_74HC165_ShiftRegister(settings,numSettings);
if(num_settings>3)
{
num_bytes = settings[3];
num_bits = 8*num_bytes;
}
return true;
}
int Piso74HC165::GetNumBits()
{
Serial.print("Piso74HC165::GetNumBits(): ");
Serial.println(num_bits);
return num_bits;
}
int Piso74HC165::GetInstanceValueRange()
{
return SHIFTIN_74HC165_MAX;
}
byte Piso74HC165::GetInputCapabilities()
{
byte capab = i_bit | i_readbyte | i_readword ;
return capab;
}
/*String Piso74HC165::GetPins()
{
String msg = "Relay Pins";
msg.concat(RELAY_PINOUT);
return msg;
}*/
// Index for if there are an array of actuators here.
// Instance of is collected elsewhere.
// No longer need. 2Do Remove
word Piso74HC165::readWord()
{
return ic165->read165(2);
}
byte Piso74HC165::readByte()
{
word res = ic165->read165(1);
return (byte) res ;
}
bool Piso74HC165::PollBit(byte bitNo)
{
Serial.println("Getting Piso74HC165 Bit");
return ic165->PollBit(bitNo);
}