1234567891011121314151617181920212223242526272829303132 |
- #include "WS_GPIO.h"
- /************************************************************* I/O *************************************************************/
- void RGB_Light(uint8_t red_val, uint8_t green_val, uint8_t blue_val)
- {
- neopixelWrite(GPIO_PIN_RGB,green_val,red_val,blue_val); // RGB color adjustment
- }
- int relays[6] = { GPIO_PIN_CH1, GPIO_PIN_CH2, GPIO_PIN_CH3, GPIO_PIN_CH4, GPIO_PIN_CH5, GPIO_PIN_CH6 };
- void TriggerRelay(int relay, bool closed)
- {
- digitalWrite(relays[relay], closed ? HIGH : LOW);
- }
- bool RelayStatus(int relay)
- {
- return digitalRead(relays[relay] > 0);
- }
- void GPIO_Init()
- {
- /*************************************************************************
- Relay GPIO
- *************************************************************************/
- for (int i=0; i<6; i++)
- pinMode(relays[i], OUTPUT);
-
- pinMode(GPIO_PIN_RGB, OUTPUT); // Initialize the control GPIO of RGB
- RGB_Light(0, 0, 0);
- }
|