Compile script
This commit is contained in:
parent
79147a060c
commit
ea47050283
|
@ -33,4 +33,10 @@ Convert to uf2:
|
|||
For RP2040:
|
||||
`arduino-cli compile --fqbn rp2040:rp2040:generic:flash=16777216_15728640,usbstack=tinyusb --output-dir build/`
|
||||
(usually not required, but just in case: `elf2uf2-rs build/USBNova.ino.elf build/USBNova.ino.uf2`)
|
||||
(To install `cargo install elf2uf2-rs`)
|
||||
(To install `cargo install elf2uf2-rs`)
|
||||
|
||||
---
|
||||
|
||||
For Adafruit Trinkey RP2040:
|
||||
`arduino-cli compile --fqbn rp2040:rp2040:adafruit_trinkeyrp2040qt:flash=8388608_7340032,usbstack=tinyusb --output-dir build/`
|
||||
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
# USB Nova MKI (SAMD21)
|
||||
arduino-cli compile --fqbn adafruit:samd:adafruit_qtpy_m0_nova:usbstack=tinyusb,debug=off --output-dir build/
|
||||
uf2conv build/USBNova.ino.bin -o build/USBNova_mkI.uf2
|
||||
|
||||
# USB Nova MKII (RP2040)
|
||||
arduino-cli compile --fqbn rp2040:rp2040:generic:flash=16777216_15728640,usbstack=tinyusb --output-dir build/
|
||||
mv build/USBNova.ino.uf2 build/USBNova_mkII.uf2
|
||||
|
||||
# Adafruit Trinkey
|
||||
arduino-cli compile --fqbn rp2040:rp2040:adafruit_trinkeyrp2040qt:flash=8388608_7340032,usbstack=tinyusb --output-dir build/
|
||||
mv build/USBNova.ino.uf2 build/USBNova_trinkey.uf2
|
||||
|
||||
# Raspberry Pi Pico
|
||||
arduino-cli compile --fqbn rp2040:rp2040:rpipico:flash=2097152_1048576,usbstack=tinyusb --output-dir build/
|
||||
mv build/USBNova.ino.uf2 build/USBNova_pico.uf2
|
||||
|
||||
# Clean up
|
||||
rm build/USBNova.ino.bin
|
||||
rm build/USBNova.ino.elf
|
||||
rm build/USBNova.ino.hex
|
||||
rm build/USBNova.ino.map
|
||||
|
||||
echo "Done!"
|
44
config.h
44
config.h
|
@ -12,25 +12,35 @@
|
|||
// ===== Storage Settings ===== //
|
||||
#define READ_BUFFER 2048
|
||||
|
||||
// ===== LED Settings ===== //
|
||||
|
||||
#if defined(ARDUINO_ARCH_RP2040)
|
||||
#define LED_PIN 12
|
||||
#else // if defined(ARDUINO_ARCH_RP2040)
|
||||
#define LED_PIN 11
|
||||
#endif // if defined(ARDUINO_ARCH_RP2040)
|
||||
|
||||
// ===== SELECTOR SWITCH ===== //
|
||||
|
||||
#if defined(ARDUINO_ARCH_RP2040)
|
||||
#define SELECTOR 13
|
||||
#else // if defined(ARDUINO_ARCH_RP2040)
|
||||
#define SELECTOR A0
|
||||
#endif // if defined(ARDUINO_ARCH_RP2040)
|
||||
|
||||
// ===== Parser Settings ===== //
|
||||
#define CASE_SENSETIVE false
|
||||
#define DEFAULT_SLEEP 5
|
||||
|
||||
// ===== Other Stuff ====== //
|
||||
#define PREFERENCES_PATH "preferences.json"
|
||||
#define PREFERENCES_PATH "preferences.json"
|
||||
|
||||
// ===== Pin Definitions ===== //
|
||||
|
||||
// USB Nova MKI (SAMD21)
|
||||
#if defined(ARDUINO_QTPY_M0)
|
||||
#define LED_PIN 11
|
||||
#define SELECTOR A0
|
||||
|
||||
// USB Nova MKII (RP2040)
|
||||
#elif defined(ARDUINO_GENERIC_RP2040)
|
||||
#define LED_PIN 12
|
||||
#define SELECTOR 13
|
||||
|
||||
// DIY USB Nova using Adafruit Trinkey (RP2040)
|
||||
#elif defined(ARDUINO_ADAFRUIT_TRINKEYQT_RP2040)
|
||||
#define LED_PIN 27
|
||||
#define SELECTOR 12
|
||||
|
||||
// DIY USB Nova using Raspberry Pi Pico (RP2040)
|
||||
#elif defined(ARDUINO_RASPBERRY_PI_PICO)
|
||||
#define LED_PIN -1
|
||||
#define SELECTOR 16
|
||||
|
||||
#else // if defined(ARDUINO_BOARD_QTPY_M0_NOVA)
|
||||
#error "No board defined!"
|
||||
#endif // if defined(ARDUINO_BOARD_QTPY_M0_NOVA)
|
|
@ -17,6 +17,8 @@ namespace led {
|
|||
bool blink_flag { false };
|
||||
|
||||
void change_color(int r, int g, int b) {
|
||||
if (LED_PIN < 0) return;
|
||||
|
||||
for (size_t i = 0; i<led.numPixels(); i++) {
|
||||
led.setPixelColor(i, r, g, b);
|
||||
}
|
||||
|
@ -26,11 +28,15 @@ namespace led {
|
|||
|
||||
// ========== PUBLIC ========= //
|
||||
void init() {
|
||||
if (LED_PIN < 0) return;
|
||||
|
||||
led.begin();
|
||||
led.show();
|
||||
}
|
||||
|
||||
void setEnable(bool enabled) {
|
||||
if (LED_PIN < 0) return;
|
||||
|
||||
if (enabled) {
|
||||
led.setBrightness(255);
|
||||
} else {
|
||||
|
@ -49,7 +55,7 @@ namespace led {
|
|||
blink_color[1] = g;
|
||||
blink_color[2] = b;
|
||||
blink_intv = intv;
|
||||
blink_flag = false;
|
||||
blink_flag = false;
|
||||
}
|
||||
|
||||
void setMode(Color color, Mode mode) {
|
||||
|
|
Loading…
Reference in New Issue