From 39976836572e493854b535ed9ab1cbd592bae1b6 Mon Sep 17 00:00:00 2001 From: Kyle Isom Date: Sat, 26 Dec 2020 11:48:07 -0800 Subject: [PATCH] renaming boards --- stage2/Makefile | 2 +- stage2/platformio.ini | 4 ++-- stage2/src/main.cc | 35 ++++++++++++++++++++++++++++++----- 3 files changed, 33 insertions(+), 8 deletions(-) diff --git a/stage2/Makefile b/stage2/Makefile index 8b8c98e..6982a40 100644 --- a/stage2/Makefile +++ b/stage2/Makefile @@ -1,4 +1,4 @@ -BOARD := adafruit_feather_m4 +BOARD := m4 FIRMWARE := .pioenvs/$(BOARD)/firmware.bin SOURCES := \ src/main.cc diff --git a/stage2/platformio.ini b/stage2/platformio.ini index 68287bb..b462576 100644 --- a/stage2/platformio.ini +++ b/stage2/platformio.ini @@ -27,8 +27,8 @@ lib_deps = SPI Wire -[env:adafruit_feather_m4] +[env:m4] board = adafruit_feather_m4 -[env:adafruit_feather_m0] +[env:m0] board = adafruit_feather_m0 diff --git a/stage2/src/main.cc b/stage2/src/main.cc index 131bf02..f4e6810 100644 --- a/stage2/src/main.cc +++ b/stage2/src/main.cc @@ -2,6 +2,8 @@ Adafruit_NeoPixel pixels(1, 11, NEO_GRB + NEO_KHZ800); +auto cOff = pixels.Color(0, 0, 0); +auto cGreen = pixels.Color(0, 255, 0); auto cRed = pixels.Color(255, 0, 0); auto cBlue = pixels.Color(0, 0, 255); @@ -16,12 +18,9 @@ setup() } -void -loop() +bool +blink(bool on) { - static bool on = false; - Serial.println("blink"); - if (on) { for (int i = 10; i < 255; i++) { auto c = pixels.Color(0, (uint8_t)i, 0); @@ -39,4 +38,30 @@ loop() } on = true; } + + return on; +} + + +void +pixelOn(uint32_t c) +{ + pixels.setPixelColor(0, c); + pixels.show(); +} + +void +pixelOff() +{ + pixels.setPixelColor(0, cOff); + pixels.show(); +} + + +void +loop() +{ + static bool on = false; + + on = blink(on); }