-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
dc049da
commit 3dd87a4
Showing
16 changed files
with
326 additions
and
204 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#pragma once | ||
|
||
#include <effects/context.hpp> | ||
#include <effects/leds.hpp> | ||
|
||
namespace BotEffects { | ||
void setup(BotContext *context) { | ||
LedsEffects::setup(context); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#pragma once | ||
|
||
#include <store.hpp> | ||
#include <timer.hpp> | ||
|
||
struct BotContext { | ||
BotStore *store; | ||
BotTimer *timer; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#pragma once | ||
|
||
#include <Arduino.h> | ||
#include <STM32_ISR_Timer.h> | ||
|
||
#include <effects/context.hpp> | ||
|
||
namespace LedsEffects { | ||
void output(void *params) { | ||
BotContext *context = (BotContext*) params; | ||
auto store = context->store; | ||
auto state = store->get_state(); | ||
digitalWrite(LED_GREEN, state.leds.green); | ||
digitalWrite(LED_BLUE, state.leds.blue); | ||
digitalWrite(LED_RED, state.leds.red); | ||
} | ||
|
||
void setup(BotContext *context) { | ||
pinMode(LED_GREEN, OUTPUT); | ||
pinMode(LED_BLUE, OUTPUT); | ||
pinMode(LED_RED, OUTPUT); | ||
|
||
auto timer = context->timer; | ||
timer->set_interval(10L, output, context); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.