add StrobePort_PCA9655E to LED_PCA9655E
This commit is contained in:
parent
a7d1fc0b85
commit
4fe2de25de
@ -2,16 +2,10 @@
|
|||||||
|
|
||||||
void LED_PCA9655E::on()
|
void LED_PCA9655E::on()
|
||||||
{
|
{
|
||||||
Wire.beginTransmission(port.ADDR);
|
refPort.write(pin, HIGH);
|
||||||
Wire.write(outputByteCommand);
|
|
||||||
Wire.write(port.outputVal |= pin); //set pin high
|
|
||||||
Wire.endTransmission();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LED_PCA9655E::off()
|
void LED_PCA9655E::off()
|
||||||
{
|
{
|
||||||
Wire.beginTransmission(port.ADDR);
|
refPort.write(pin, LOW);
|
||||||
Wire.write(outputByteCommand);
|
|
||||||
Wire.write(port.outputVal &= ~pin); //set pin low
|
|
||||||
Wire.endTransmission();
|
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <Wire.h>
|
#include <Wire.h>
|
||||||
#include <LED.h>
|
#include <LED.h>
|
||||||
#include "IOEPort.h"
|
#include <StrobePort_PCA9655E.h>
|
||||||
|
|
||||||
/* A LED_PCA9655E object is an PCA9655E pin that is connected to an LED indicator light.
|
/* A LED_PCA9655E object is an PCA9655E pin that is connected to an LED indicator light.
|
||||||
Input/Ouput Direction configuration are set to ouput in StrobePort_PCA9655E.begin() and ReadPort_PCA9655E.begin().
|
Input/Ouput Direction configuration are set to ouput in StrobePort_PCA9655E.begin() and ReadPort_PCA9655E.begin().
|
||||||
@ -12,13 +12,14 @@ Input/Ouput Direction configuration are set to ouput in StrobePort_PCA9655E.begi
|
|||||||
class LED_PCA9655E: public LED
|
class LED_PCA9655E: public LED
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
IOEPort& port;
|
//IOEPort& port;
|
||||||
const uint8_t outputByteCommand; //General Purpose Input/Ouput register address
|
//const uint8_t outputByteCommand; //General Purpose Input/Ouput register address
|
||||||
|
StrobePort_PCA9655E& refPort;
|
||||||
const uint8_t pin; //bitwise pin to LED
|
const uint8_t pin; //bitwise pin to LED
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LED_PCA9655E(IOEPort& port, const uint8_t pin)
|
LED_PCA9655E(StrobePort_PCA9655E& refPort, const uint8_t pin)
|
||||||
: port(port), outputByteCommand(port.num + 2), pin(pin) {}
|
: refPort(refPort), pin(pin) {}
|
||||||
|
|
||||||
virtual void on();
|
virtual void on();
|
||||||
virtual void off();
|
virtual void off();
|
||||||
|
@ -18,6 +18,7 @@ void StrobePort_PCA9655E::begin()
|
|||||||
pin is bitwise, where pin being strobed is 1.
|
pin is bitwise, where pin being strobed is 1.
|
||||||
value is HIGH or LOW.
|
value is HIGH or LOW.
|
||||||
Does not reset the other pins because LEDs could be using some of the pins.
|
Does not reset the other pins because LEDs could be using some of the pins.
|
||||||
|
Syntax is similar to Arduino DigitalWrite().
|
||||||
*/
|
*/
|
||||||
void StrobePort_PCA9655E::write(const uint8_t pin, const bool value)
|
void StrobePort_PCA9655E::write(const uint8_t pin, const bool value)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user