mirror of
https://github.com/felis/USB_Host_Shield_2.0.git
synced 2024-03-22 11:31:26 +01:00
Fixes name conflict in examples with ESP32 GPIO.
Further coding style fixes (all more cuddly now).
This commit is contained in:
parent
1d7dbd640b
commit
5046bc8bf2
3 changed files with 12 additions and 18 deletions
|
@ -12,10 +12,9 @@
|
||||||
#define OUTPUT_PIN 0
|
#define OUTPUT_PIN 0
|
||||||
|
|
||||||
USB Usb; // Create an UHS2 interface object
|
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 );
|
Serial.begin( 115200 );
|
||||||
#if !defined(__MIPSEL__)
|
#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
|
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 );
|
delay( 200 );
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop()
|
void loop() {
|
||||||
{
|
|
||||||
// Get the current output value, toggle then wait half a second
|
// 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);
|
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
|
Serial.print(nValue ? "+" : "."); // Debug to show what the output should be doing
|
||||||
delay(500);
|
delay(500);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,8 +12,7 @@
|
||||||
|
|
||||||
USB Usb;
|
USB Usb;
|
||||||
|
|
||||||
void setup()
|
void setup() {
|
||||||
{
|
|
||||||
Serial.begin( 115200 );
|
Serial.begin( 115200 );
|
||||||
#if !defined(__MIPSEL__)
|
#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
|
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 );
|
delay( 200 );
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop()
|
void loop() {
|
||||||
{
|
|
||||||
// Get the current output value, toggle then wait half a second
|
// Get the current output value, toggle then wait half a second
|
||||||
uint8_t nGPO = Usb.gpioRdOutput();
|
uint8_t nGPO = Usb.gpioRdOutput();
|
||||||
uint8_t nValue = ((nGPO & 0x01) == 0x01) ? 0 : 1;
|
uint8_t nValue = ((nGPO & 0x01) == 0x01) ? 0 : 1;
|
||||||
|
|
|
@ -12,10 +12,9 @@
|
||||||
#define OUTPUT_PIN 0
|
#define OUTPUT_PIN 0
|
||||||
|
|
||||||
USB Usb; // Create an UHS2 interface object
|
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 );
|
Serial.begin( 115200 );
|
||||||
#if !defined(__MIPSEL__)
|
#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
|
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 );
|
delay( 200 );
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop()
|
void loop() {
|
||||||
{
|
|
||||||
// Get the value of input, set value of output
|
// 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);
|
nValue = (nValue ? LOW : HIGH);
|
||||||
GPIO.digitalWrite(OUTPUT_PIN, nValue);
|
Gpio.digitalWrite(OUTPUT_PIN, nValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue