Skip to content

Commit

Permalink
🎨 (spikes): Upgrade lk_led_kit
Browse files Browse the repository at this point in the history
  • Loading branch information
HPezz committed Mar 7, 2022
1 parent dfdbb3d commit 72e0a3d
Showing 1 changed file with 7 additions and 25 deletions.
32 changes: 7 additions & 25 deletions spikes/lk_led_kit/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "drivers/HighResClock.h"
#include "rtos/ThisThread.h"

#include "AngryShort.h"
#include "CoreLED.h"
#include "CoreSPI.h"
#include "HelloWorld.h"
Expand All @@ -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);
}
}

0 comments on commit 72e0a3d

Please sign in to comment.