Corrected some mistakes in the example sketch and added missing methods in the keywords file for syntax highlighting
This commit is contained in:
parent
781354a02f
commit
5813c6501d
@ -72,7 +72,7 @@ boolean PCF8574::digitalRead(Pin pin)
|
||||
return (reg & pin) == 0 ? 0 : 1;
|
||||
}
|
||||
|
||||
void PCF8574::digitalReadAll(boolean array[])
|
||||
void PCF8574::digitalReadAll(boolean array[8])
|
||||
{
|
||||
uint8_t reg = 0b00000000;
|
||||
_twc.requestFrom((uint8_t)_address,(uint8_t)1,(uint8_t)true);
|
||||
@ -93,7 +93,7 @@ boolean PCF8574::getPinMode(Pin pin)
|
||||
return _pddr & pin == 0 ? INPUT : OUTPUT;
|
||||
}
|
||||
|
||||
void PCF8574::getPinModeAll(boolean array[])
|
||||
void PCF8574::getPinModeAll(boolean array[8])
|
||||
{
|
||||
array[0] = (_pddr & P0) == 0 ? INPUT : OUTPUT;
|
||||
array[1] = (_pddr & P1) == 0 ? INPUT : OUTPUT;
|
||||
|
@ -19,9 +19,9 @@ class PCF8574
|
||||
void pinMode(Pin pin, boolean mode = INPUT);
|
||||
void digitalWrite(Pin pin, boolean mode);
|
||||
boolean digitalRead(Pin pin);
|
||||
void digitalReadAll(boolean array[]);
|
||||
void digitalReadAll(boolean array[8]);
|
||||
boolean getPinMode(Pin pin);
|
||||
void getPinModeAll(boolean array[]);
|
||||
void getPinModeAll(boolean array[8]);
|
||||
void togglePin(Pin pin);
|
||||
private:
|
||||
TwoWire &_twc;
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "PCF8574.h"
|
||||
|
||||
//Example programm with blink on P0 and digitalRead on P1 - P7
|
||||
//Example program with blink on P0 and digitalRead on P1 - P7
|
||||
|
||||
PCF8574 pcf(0x27);
|
||||
|
||||
@ -15,8 +15,8 @@ void loop() {
|
||||
// put your main code here, to run repeatedly:
|
||||
Serial.print(pcf.digitalRead(PCF8574::P0));Serial.print(pcf.digitalRead(PCF8574::P1));Serial.print(pcf.digitalRead(PCF8574::P2));Serial.print(pcf.digitalRead(PCF8574::P3));Serial.print(pcf.digitalRead(PCF8574::P4));Serial.print(pcf.digitalRead(PCF8574::P5));Serial.print(pcf.digitalRead(PCF8574::P6));Serial.println(pcf.digitalRead(PCF8574::P7));
|
||||
//pcf.digitalRead(PCF8574::P0);
|
||||
pcf.pinMode(PCF8574::P0, HIGH);
|
||||
pcf.digitalWrite(PCF8574::P0, HIGH);
|
||||
delay(200);
|
||||
pcf.pinMode(PCF8574::P0, LOW);
|
||||
pcf.digitalWrite(PCF8574::P0, LOW);
|
||||
delay(200);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
#######################################
|
||||
# Syntax Coloring Map For RTC
|
||||
# Syntax Coloring Map For PCF8574
|
||||
#######################################
|
||||
|
||||
#######################################
|
||||
@ -12,16 +12,20 @@ PCF8574 KEYWORD1
|
||||
# Methods and Functions (KEYWORD2)
|
||||
#######################################
|
||||
|
||||
digitalReadAll KEYWORD2
|
||||
getPinMode KEYWORD2
|
||||
getPinModeAll KEYWORD2
|
||||
togglePin KEYWORD2
|
||||
|
||||
#######################################
|
||||
# Constants (LITERAL1)
|
||||
#######################################
|
||||
|
||||
P0 LITERAL1
|
||||
P1 LITERAL1
|
||||
P2 LITERAL1
|
||||
P3 LITERAL1
|
||||
P4 LITERAL1
|
||||
P5 LITERAL1
|
||||
P6 LITERAL1
|
||||
P7 LITERAL1
|
||||
P0 LITERAL1
|
||||
P1 LITERAL1
|
||||
P2 LITERAL1
|
||||
P3 LITERAL1
|
||||
P4 LITERAL1
|
||||
P5 LITERAL1
|
||||
P6 LITERAL1
|
||||
P7 LITERAL1
|
||||
|
Loading…
Reference in New Issue
Block a user