mirror of
https://github.com/felis/USB_Host_Shield_2.0.git
synced 2024-03-22 11:31:26 +01:00
Fixes coding style.
Adds examples to travis.
This commit is contained in:
parent
401f4991e9
commit
1d7dbd640b
6 changed files with 37 additions and 35 deletions
|
@ -39,6 +39,9 @@ env:
|
||||||
- PLATFORMIO_CI_SRC=examples/board_qc
|
- PLATFORMIO_CI_SRC=examples/board_qc
|
||||||
- PLATFORMIO_CI_SRC=examples/cdc_XR21B1411/XR_terminal
|
- PLATFORMIO_CI_SRC=examples/cdc_XR21B1411/XR_terminal
|
||||||
- PLATFORMIO_CI_SRC=examples/ftdi/USBFTDILoopback
|
- PLATFORMIO_CI_SRC=examples/ftdi/USBFTDILoopback
|
||||||
|
- PLATFORMIO_CI_SRC=examples/GPIO/Blink
|
||||||
|
- PLATFORMIO_CI_SRC=examples/GPIO/Blink_LowLevel
|
||||||
|
- PLATFORMIO_CI_SRC=examples/GPIO/Input
|
||||||
- PLATFORMIO_CI_SRC=examples/HID/le3dp
|
- PLATFORMIO_CI_SRC=examples/HID/le3dp
|
||||||
- PLATFORMIO_CI_SRC=examples/HID/scale
|
- PLATFORMIO_CI_SRC=examples/HID/scale
|
||||||
- PLATFORMIO_CI_SRC=examples/HID/SRWS1
|
- PLATFORMIO_CI_SRC=examples/HID/SRWS1
|
||||||
|
|
|
@ -29,16 +29,15 @@ UHS2_GPIO implements "wiring" style GPIO access. Implemented by Brian Walton bri
|
||||||
|
|
||||||
#include "Usb.h"
|
#include "Usb.h"
|
||||||
|
|
||||||
class UHS2_GPIO
|
class UHS2_GPIO {
|
||||||
{
|
public:
|
||||||
public:
|
|
||||||
UHS2_GPIO(USB *pUsb);
|
UHS2_GPIO(USB *pUsb);
|
||||||
|
|
||||||
void digitalWrite(uint8_t pin, uint8_t val);
|
void digitalWrite(uint8_t pin, uint8_t val);
|
||||||
int digitalRead(uint8_t pin);
|
int digitalRead(uint8_t pin);
|
||||||
int digitalReadOutput(uint8_t pin);
|
int digitalReadOutput(uint8_t pin);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
USB* m_pUsb;
|
USB* m_pUsb;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
|
|
||||||
#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()
|
||||||
{
|
{
|
||||||
|
@ -30,11 +30,11 @@ void setup()
|
||||||
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,13 +28,13 @@ void setup()
|
||||||
|
|
||||||
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;
|
||||||
nGPO &= 0xFE; //clear bit 0
|
nGPO &= 0xFE; // Clear bit 0
|
||||||
nGPO |= nValue;
|
nGPO |= nValue;
|
||||||
Usb.gpioWr(nGPO);
|
Usb.gpioWr(nGPO);
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,8 +11,8 @@
|
||||||
#define INPUT_PIN 0
|
#define INPUT_PIN 0
|
||||||
#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()
|
||||||
{
|
{
|
||||||
|
@ -30,9 +30,9 @@ void setup()
|
||||||
|
|
||||||
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?0:1);
|
nValue = (nValue ? LOW : HIGH);
|
||||||
GPIO.digitalWrite(OUTPUT_PIN, nValue);
|
GPIO.digitalWrite(OUTPUT_PIN, nValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue