From 0dbfc80cf32a0a4eb83ef3eb25cacfe4d0296e8c Mon Sep 17 00:00:00 2001 From: Kyle Isom Date: Mon, 21 Dec 2020 17:38:22 -0800 Subject: [PATCH] tweaking test code --- stage2/Makefile | 32 ++++++++++++++++++++++++++++++++ stage2/platformio.ini | 19 +++++++++++-------- stage2/src/main.cc | 28 +++++++++++++++++++++------- 3 files changed, 64 insertions(+), 15 deletions(-) create mode 100644 stage2/Makefile diff --git a/stage2/Makefile b/stage2/Makefile new file mode 100644 index 0000000..7353a60 --- /dev/null +++ b/stage2/Makefile @@ -0,0 +1,32 @@ +BOARD := adafruit_feather_m0 +FIRMWARE := .pioenvs/$(BOARD)/firmware.bin +SOURCES := \ + src/main.cc + +PIO := pio run -e $(BOARD) + +$(FIRMWARE): $(SOURCES) + $(PIO) + +PHONY: all +all: $(FIRMWARE) + +.PHONY: upload +upload: $(FIRMWARE) + $(PIO) -t upload + +.PHONY: monitor +monitor: + $(PIO) -t monitor + +.PHONY: deploy +deploy: $(FIRMWARE) + $(PIO) -t upload && sleep 0.5 && $(PIO) -t monitor + +.PHONY: clean +clean: + $(PIO) -t clean + +.PHONY: cloc +cloc: + cloc include lib src diff --git a/stage2/platformio.ini b/stage2/platformio.ini index c6f977a..d27e669 100644 --- a/stage2/platformio.ini +++ b/stage2/platformio.ini @@ -16,11 +16,14 @@ framework = arduino ; 28: Adafruit NeoPixel library ; 83: Adafruit RTClib ; 571: Adafruit ILI9341 library -lib_deps = - - Wire - - SPI - - SD - - 28 - - 83 - - 571 - - arturo182/BBQ10Keyboard +lib_deps = SD, SPI, Wire, 28, 83, 571, arturo182/BBQ10Keyboard, 2082, 13, 6214 + +[env:adafruit_feather_m0] +platform = atmelsam +board = adafruit_feather_m0 +framework = arduino + +; 28: Adafruit NeoPixel library +; 83: Adafruit RTClib +; 571: Adafruit ILI9341 library +lib_deps = SD, SPI, Wire, 28, 83, 571, arturo182/BBQ10Keyboard, 2082, 13, 6214 diff --git a/stage2/src/main.cc b/stage2/src/main.cc index 89489f0..131bf02 100644 --- a/stage2/src/main.cc +++ b/stage2/src/main.cc @@ -2,27 +2,41 @@ Adafruit_NeoPixel pixels(1, 11, NEO_GRB + NEO_KHZ800); +auto cRed = pixels.Color(255, 0, 0); +auto cBlue = pixels.Color(0, 0, 255); void -init() +setup() { Serial.begin(115200); + pixels.begin(); + pixels.clear(); + pixels.show(); } void -main() +loop() { static bool on = false; Serial.println("blink"); if (on) { - pixels.clear(); + for (int i = 10; i < 255; i++) { + auto c = pixels.Color(0, (uint8_t)i, 0); + pixels.setPixelColor(0, c); + pixels.show(); + delay(4); + } + on = false; } else { - pixels.setPixelColor(0, pixels.color(0, 255, 0)); + for (int i = 255; i > 9; i--) { + auto c = pixels.Color(0, (uint8_t)i, 0); + pixels.setPixelColor(0, c); + pixels.show(); + delay(4); + } + on = true; } - pixels.show(); - - delay(1000); }