Compare commits
No commits in common. "c9cd379e2d290e5492a2617e94a4c467cc2c3f22" and "601e2ad4f0dd7643d4d0998e384087af96b62ca5" have entirely different histories.
c9cd379e2d
...
601e2ad4f0
|
@ -46,10 +46,6 @@ A debug console for serial TTL. This can be used to work with serial TTL directl
|
||||||
- Battery level on feather neopixel (green = >80% ; yellow >=40% ; orange >= 25% ; red < 25%)
|
- Battery level on feather neopixel (green = >80% ; yellow >=40% ; orange >= 25% ; red < 25%)
|
||||||
- User LED (red) always on when feather is running
|
- User LED (red) always on when feather is running
|
||||||
|
|
||||||
## Building / Uploading
|
|
||||||
|
|
||||||
The ```make.ps1```, ```build.ps1``` and ```upload.ps1``` scripts can be used to build/upload this project. These scripts call the ```arduino-cli``` commands programatically.
|
|
||||||
|
|
||||||
## Licensing
|
## Licensing
|
||||||
|
|
||||||
Unless otherwise stated all source code is licensed under the [Apache 2 License](LICENSE-APACHE-2.0.txt).
|
Unless otherwise stated all source code is licensed under the [Apache 2 License](LICENSE-APACHE-2.0.txt).
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
arduino-cli compile --log-level=warn --fqbn adafruit:nrf52:feather52840 serial_debugger.ino
|
|
9
make.ps1
9
make.ps1
|
@ -1,8 +1 @@
|
||||||
# Ensure this script fails if either build or upload fails
|
arduino-cli compile --log-level=warn --fqbn adafruit:nrf52:feather52840 serial_debugger.ino
|
||||||
$ErrorActionPreference = "Stop"
|
|
||||||
|
|
||||||
# Ensure we actually build before upload (common mistake)
|
|
||||||
& .\build.ps1
|
|
||||||
|
|
||||||
# Upload to board
|
|
||||||
& .\upload.ps1
|
|
||||||
|
|
|
@ -3,8 +3,6 @@
|
||||||
|
|
||||||
// Various library includes
|
// Various library includes
|
||||||
#include <Adafruit_NeoPixel.h>
|
#include <Adafruit_NeoPixel.h>
|
||||||
#include <Adafruit_GFX.h>
|
|
||||||
#include <Adafruit_ILI9341.h>
|
|
||||||
|
|
||||||
// Debugging via serial monitor (don't turn this on unless you're hacking on the firmware code)
|
// Debugging via serial monitor (don't turn this on unless you're hacking on the firmware code)
|
||||||
#define DEBUG true
|
#define DEBUG true
|
||||||
|
@ -14,26 +12,10 @@
|
||||||
float measuredVBat;
|
float measuredVBat;
|
||||||
float batteryPercent;
|
float batteryPercent;
|
||||||
|
|
||||||
// TFT Setup
|
|
||||||
#define TFT_CS 9
|
|
||||||
#define TFT_DC 10
|
|
||||||
Adafruit_ILI9341 tft(TFT_CS, TFT_DC);
|
|
||||||
#include <Fonts/FreeMono9pt7b.h>
|
|
||||||
#define CHARS_HORIZONTAL 28
|
|
||||||
#define CHARS_ROWS 13
|
|
||||||
|
|
||||||
// NeoPixels
|
// NeoPixels
|
||||||
#define NUMPIXELS 1
|
#define NUMPIXELS 1
|
||||||
Adafruit_NeoPixel pixels(NUMPIXELS, PIN_NEOPIXEL, NEO_GRB + NEO_KHZ800);
|
Adafruit_NeoPixel pixels(NUMPIXELS, PIN_NEOPIXEL, NEO_GRB + NEO_KHZ800);
|
||||||
|
|
||||||
// UI screens
|
|
||||||
void screenClear();
|
|
||||||
|
|
||||||
// Color conversion (RGB888 -> RGB565 used by Adafruit GFX)
|
|
||||||
uint16_t RGB565(uint8_t r, uint8_t g, uint8_t b) {
|
|
||||||
return ((r & 0b11111000) << 8) | ((g & 0b11111100) << 3) | (b >> 3);
|
|
||||||
}
|
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
// Setup red LED to indicate device is on (in case we disable NeoPixel battery level later)
|
// Setup red LED to indicate device is on (in case we disable NeoPixel battery level later)
|
||||||
pinMode(3, OUTPUT);
|
pinMode(3, OUTPUT);
|
||||||
|
@ -50,13 +32,6 @@ void setup() {
|
||||||
// Red : pixels.Color(255, 0, 0)
|
// Red : pixels.Color(255, 0, 0)
|
||||||
pixels.setPixelColor(0, pixels.Color(0, 0, 0));
|
pixels.setPixelColor(0, pixels.Color(0, 0, 0));
|
||||||
pixels.show();
|
pixels.show();
|
||||||
|
|
||||||
// Setup TFT
|
|
||||||
tft.begin();
|
|
||||||
tft.setRotation(1);
|
|
||||||
screenClear();
|
|
||||||
tft.println("");
|
|
||||||
tft.setFont(&FreeMono9pt7b);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Measure battery level and change NeoPixel accordingly
|
// Measure battery level and change NeoPixel accordingly
|
||||||
|
@ -91,10 +66,4 @@ void loop() {
|
||||||
batteryLevel();
|
batteryLevel();
|
||||||
|
|
||||||
delay(250);
|
delay(250);
|
||||||
}
|
|
||||||
|
|
||||||
// Clear the screen
|
|
||||||
void screenClear() {
|
|
||||||
tft.setCursor(0, 0);
|
|
||||||
tft.fillScreen(RGB565(0, 0, 0));
|
|
||||||
}
|
}
|
|
@ -1,4 +1 @@
|
||||||
# Get list of boards
|
arduino-cli upload --fqbn adafruit:nrf52:feather52840 -p COM5
|
||||||
$COM_PORT=$(arduino-cli board list | Select-String -Pattern "adafruit:nrf52:feather52840" | %{ $_.ToString().Split(' ')[0]; })
|
|
||||||
Write-Host "Using serial port $($COM_PORT)"
|
|
||||||
arduino-cli upload --fqbn adafruit:nrf52:feather52840 -p $COM_PORT
|
|
||||||
|
|
Reference in a new issue