Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
zjwhitehead committed Apr 19, 2024
1 parent 3fb3be7 commit e90dfd6
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ X4 code has been migrated to a separate repo - https://github.com/openppg/x4-con

It may not be stable and is not recommended for flying.
See stable releases [here](https://github.com/openppg/eppg-controller/releases)
> Version 6.1 was intially released only for the reworked RP2040 module based controller and being ported to the original RP2040 PCB which is currently in testing. The version shipped with that hardware can be found on the [rp2040-module-release branch](https://github.com/openppg/eppg-controller/tree/rp2040-module-release)
> Version 6.0 introduced [FreeRTOS](https://www.freertos.org/index.html) and is currently only working with RP2040 processors. For M0/SAMD21 processors please use [version/5 branch](https://github.com/openppg/eppg-controller/tree/version/5).
Expand Down Expand Up @@ -38,7 +39,7 @@ Suitable for Mac, Windows, and Linux
#### Install the driver

Batch 3+ OpenPPG controllers and early SP140 controllers are powered by Atmel’s SAMD21G18A MCU, featuring a 32-bit ARM Cortex® M0+ core. On some operating systems you may need extra drivers to communicate with it.
Newer SP140 controllers feature the RP2040 MCU which is a dual-core variant of the ARM Cortex® M0+.
Newer SP140 controllers feature the RP2040 MCU which is a dual-core variant of the ARM Cortex® M0+.

#### Download and Prepare OpenPPG Code

Expand Down
30 changes: 30 additions & 0 deletions src/sp140/utilities.ino
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,26 @@ String convertToDigits(byte digits) {
return digits_string;
}

#define ENABLE_NEOPIXEL true

// set LED color
void setLEDColor(uint32_t color) {
if (ENABLE_NEOPIXEL) {
led_color = color;
pixels.setPixelColor(0, color);
pixels.show();
}
}

/**
* Sets the state of the LEDs.
*
* If ENABLE_NEOPIXEL is true, sets the color of the NeoPixel LED to led_color
* when the state is HIGH, and clears the NeoPixel LED when the state is LOW.
* Otherwise, sets the state of the LED_SW pin to the given state.
*
* @param state The state to set the LEDs to (HIGH or LOW).
*/
void setLEDs(byte state) {
// digitalWrite(LED_2, state);
// digitalWrite(LED_3, state);
Expand All @@ -44,6 +64,13 @@ bool runVibe(unsigned int sequence[], int siz) {
return true;
}

/**
* Plays a melody using a piezo buzzer.
*
* @param melody An array of uint16_t values representing the notes of the melody.
* @param siz The size of the melody array.
* @return Returns true if the melody was played successfully, false otherwise.
*/
bool playMelody(uint16_t melody[], int siz) {
if (!ENABLE_BUZ) { return false; }
for (int thisNote = 0; thisNote < siz; thisNote++) {
Expand All @@ -62,6 +89,9 @@ void playNote(uint16_t note, uint16_t duration) {
noTone(BUZZER_PIN);
}

/**
* Plays a melody to indicate arm failure.
*/
void handleArmFail() {
uint16_t arm_fail_melody[] = { 820, 640 };
playMelody(arm_fail_melody, 2);
Expand Down

0 comments on commit e90dfd6

Please sign in to comment.