Accessories
Arduino for motors and lights library.
PortExpanderSX1509.cpp
1 #include "Accessories.h"
2 
3 #ifndef NO_EXPANDER_SX1509
4 
6 
7 byte PortExpanderSX1509::begin(int inId, byte inAddress)
8 {
9  this->id = inId;
10  if (this->sx1509.begin(inAddress) == 1)
11  {
12  PortExpander::Add(this);
13  return 1;
14  }
15 #ifdef ACCESSORIES_DEBUG_MODE
16  Serial.println(F("Expander SX1509 failed"));
17 #endif
18  return 0;
19 }
20 
21 void PortExpanderSX1509::beginPin(int inPin, PIN_TYPE inType)
22 {
23  if (inType < ANALOG)
24  {
25  sx1509.pinMode(inPin, OUTPUT);
26  }
27  else
28  {
29  sx1509.pinMode(inPin, ANALOG_OUTPUT);
30  }
31 }
32 
33 void PortExpanderSX1509::digitalWrite(int inPin, int inValue)
34 {
35  sx1509.digitalWrite(inPin, inValue);
36 }
37 
38 void PortExpanderSX1509::analogWrite(int inPin, int inValue)
39 {
40  sx1509.analogWrite(inPin, inValue);
41 }
42 
43 #endif
void digitalWrite(int inPin, int inValue)
void beginPin(int inPin, PIN_TYPE inType)
virtual byte begin()
void analogWrite(int inPin, int inValue)