Derek Jamison 2 лет назад
Родитель
Сommit
6696e166f3
3 измененных файлов с 35 добавлено и 4 удалено
  1. 5 2
      .flipcorg/README.md
  2. 5 2
      README.md
  3. 25 0
      gpio_badge.c

+ 5 - 2
.flipcorg/README.md

@@ -1,6 +1,9 @@
 #gpio_badge
+
 This is an app for the [GPIO Diagnostics Card](https://tindie.com/stores/MakeItHackin) by MakeItHackin.
 
 ## Instructions
-Left/Right buttons to change speed.
-Back button to exit.
+
+- Left/Right buttons to change speed. Up/Down buttons to change effect.
+- When effect is Left/Right, you can use OK button to stop/start (try to get it to start near the middle RED led!)
+- Back button to exit.

+ 5 - 2
README.md

@@ -1,6 +1,9 @@
 #gpio_badge
+
 This is an app for the [GPIO Diagnostics Card](https://tindie.com/stores/MakeItHackin) by MakeItHackin.
 
 ## Instructions
-Left/Right buttons to change speed.
-Back button to exit.
+
+- Left/Right buttons to change speed. Up/Down buttons to change effect.
+- When effect is Left/Right, you can use OK button to stop/start (try to get it to start near the middle RED led!)
+- Back button to exit.

+ 25 - 0
gpio_badge.c

@@ -23,6 +23,7 @@ typedef enum {
     EffectIdLRL,
     EffectIdBothLRL,
     EffectIdLR,
+    EffectIdCounter,
     EffectIdCount // Make sure this is last
 } EffectId;
 
@@ -137,6 +138,27 @@ void do_effect_lr() {
     }
 }
 
+void do_effect_counter() {
+    uint32_t c = 0;
+
+    while(true) {
+        for(size_t i = 0; i < COUNT_OF(pin_leds); i++) {
+            if((c & (1 << i)) != 0) {
+                furi_hal_gpio_write(pin_leds[i], true);
+            }
+        }
+        furi_delay_ms(speed);
+        for(size_t i = 0; i < COUNT_OF(pin_leds); i++) {
+            furi_hal_gpio_write(pin_leds[i], false);
+        }
+        c++;
+
+        if(furi_hal_gpio_read(pin_back) == false || effect != EffectIdCounter) {
+            break;
+        }
+    }
+}
+
 void do_effects() {
     while(furi_hal_gpio_read(pin_back)) {
         switch(effect) {
@@ -146,6 +168,9 @@ void do_effects() {
         case EffectIdBothLRL:
             do_effect_both_lrl();
             break;
+        case EffectIdCounter:
+            do_effect_counter();
+            break;
         default:
             do_effect_lr();
             break;