From 72e0a3da8a064a3fbea6271212c2fcec20346923 Mon Sep 17 00:00:00 2001 From: Hugo Pezziardi Date: Mon, 7 Mar 2022 18:40:39 +0100 Subject: [PATCH] :art: (spikes): Upgrade lk_led_kit --- spikes/lk_led_kit/main.cpp | 32 +++++++------------------------- 1 file changed, 7 insertions(+), 25 deletions(-) diff --git a/spikes/lk_led_kit/main.cpp b/spikes/lk_led_kit/main.cpp index 5e9961d33c..1ad1229f14 100644 --- a/spikes/lk_led_kit/main.cpp +++ b/spikes/lk_led_kit/main.cpp @@ -7,6 +7,7 @@ #include "drivers/HighResClock.h" #include "rtos/ThisThread.h" +#include "AngryShort.h" #include "CoreLED.h" #include "CoreSPI.h" #include "HelloWorld.h" @@ -26,42 +27,23 @@ auto animation_thread = rtos::Thread {}; auto animation_event_queue = events::EventQueue {}; auto ledkit = LedKit {animation_thread, animation_event_queue, ears, belt}; - -auto colors_available = std::to_array({ - RGB::pure_green, - RGB::pure_red, - RGB::pure_blue, - RGB::yellow, - RGB::cyan, - RGB::magenta, -}); +led::animation::AngryShort animation_angry_short(ears, belt); HelloWorld hello; -RGB sick1 = RGB {30, 255, 0}; -RGB sick2 = RGB {94, 104, 1}; -RGB singing_green = RGB {29, 168, 0}; -RGB singing_red = RGB {255, 65, 61}; -RGB singing_yellow = RGB {255, 217, 61}; -RGB singing_blue = RGB {21, 125, 230}; - -RGB red_angry = RGB {255, 98, 98}; - auto main() -> int { logger::init(); log_info("Hello, World!\n\n"); - auto start = rtos::Kernel::Clock::now(); - - rtos::ThisThread::sleep_for(2s); - hello.start(); while (true) { - auto t = rtos::Kernel::Clock::now() - start; - log_info("A message from your board %s --> \"%s\" at %i s\n", MBED_CONF_APP_TARGET_NAME, hello.world, - int(t.count() / 1000)); + ledkit.start(animation_angry_short); + rtos::ThisThread::sleep_for(40s); + + ledkit.stop(); + rtos::ThisThread::sleep_for(1s); } }