Fixes name conflict in examples with ESP32 GPIO.

Further coding style fixes (all more cuddly now).
This commit is contained in:
riban 2018-10-15 09:13:30 +01:00
parent 1d7dbd640b
commit 5046bc8bf2
3 changed files with 12 additions and 18 deletions

View file

@ -12,10 +12,9 @@
#define OUTPUT_PIN 0
USB Usb; // Create an UHS2 interface object
UHS2_GPIO GPIO(&Usb); // Create a GPIO object
UHS2_GPIO Gpio(&Usb); // Create a GPIO object
void setup()
{
void setup() {
Serial.begin( 115200 );
#if !defined(__MIPSEL__)
while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
@ -28,12 +27,11 @@ void setup()
delay( 200 );
}
void loop()
{
void loop() {
// Get the current output value, toggle then wait half a second
int nValue = GPIO.digitalReadOutput(OUTPUT_PIN);
int nValue = Gpio.digitalReadOutput(OUTPUT_PIN);
nValue = (nValue ? 0 : 1);
GPIO.digitalWrite(OUTPUT_PIN, nValue);
Gpio.digitalWrite(OUTPUT_PIN, nValue);
Serial.print(nValue ? "+" : "."); // Debug to show what the output should be doing
delay(500);
}

View file

@ -12,8 +12,7 @@
USB Usb;
void setup()
{
void setup() {
Serial.begin( 115200 );
#if !defined(__MIPSEL__)
while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
@ -26,8 +25,7 @@ void setup()
delay( 200 );
}
void loop()
{
void loop() {
// Get the current output value, toggle then wait half a second
uint8_t nGPO = Usb.gpioRdOutput();
uint8_t nValue = ((nGPO & 0x01) == 0x01) ? 0 : 1;

View file

@ -12,10 +12,9 @@
#define OUTPUT_PIN 0
USB Usb; // Create an UHS2 interface object
UHS2_GPIO GPIO(&Usb); // Create a GPIO object
UHS2_GPIO Gpio(&Usb); // Create a GPIO object
void setup()
{
void setup() {
Serial.begin( 115200 );
#if !defined(__MIPSEL__)
while (!Serial); // Wait for serial port to connect - used on Leonardo, Teensy and other boards with built-in USB CDC serial connection
@ -28,11 +27,10 @@ void setup()
delay( 200 );
}
void loop()
{
void loop() {
// Get the value of input, set value of output
int nValue = GPIO.digitalRead(INPUT_PIN);
int nValue = Gpio.digitalRead(INPUT_PIN);
nValue = (nValue ? LOW : HIGH);
GPIO.digitalWrite(OUTPUT_PIN, nValue);
Gpio.digitalWrite(OUTPUT_PIN, nValue);
}