-
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.
feat(blink): update led blink library to the latest version
- Loading branch information
Showing
11 changed files
with
91 additions
and
65 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* @file blink.h | ||
* @brief Blink a led as many times as the index of the current cellboard | ||
* | ||
* @date Feb 21, 2024 | ||
* | ||
* @author Antonio Gelain [antonio.gelain@studenti.unitn.it] | ||
*/ | ||
|
||
#ifndef BLINK_H | ||
#define BLINK_H | ||
|
||
#include "blinky.h" | ||
|
||
/** @brief Initialize the blinking behaviour of the led */ | ||
void blink_init(void); | ||
|
||
/** | ||
* @brief Get the led state at any given time | ||
* | ||
* @param t The current time | ||
* @return BlinkyState The current led state | ||
*/ | ||
BlinkyState blink_routine(uint32_t t); | ||
|
||
#endif // BLINK_H |
This file was deleted.
Oops, something went wrong.
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
Submodule micro-libs
updated
195 files
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,45 @@ | ||
/** | ||
* @file blink.c | ||
* @brief Blink a led as many times as the index of the current cellboard | ||
* | ||
* @date Feb 21, 2024 | ||
* | ||
* @author Antonio Gelain [antonio.gelain@studenti.unitn.it] | ||
*/ | ||
|
||
#include "blink.h" | ||
|
||
#include <stdbool.h> | ||
|
||
#include "../../../fenice_config.h" | ||
#include "main.h" | ||
|
||
Blinky blinker; | ||
uint16_t pattern[2 * (CELLBOARD_COUNT - 1)]; | ||
|
||
void blink_init(void) { | ||
// If the index is 0 the led is always on | ||
size_t pattern_size = 0; | ||
if (cellboard_index > 0) { | ||
// Create pattern | ||
for (size_t i = 0; i < cellboard_index; ++i) { | ||
pattern[pattern_size++] = 150; // On (in ms) | ||
pattern[pattern_size++] = 250; // Off (in ms) | ||
} | ||
pattern[pattern_size - 1] += 750; // Pause between patterns (in ms) | ||
} | ||
|
||
blinky_init( | ||
&blinker, | ||
pattern, | ||
pattern_size, | ||
true | ||
); | ||
|
||
if (cellboard_index == 0) | ||
blinky_enable(&blink_init, false); | ||
} | ||
|
||
BlinkyState blink_routine(uint32_t t) { | ||
return blinky_routine(&blinker, t); | ||
} |
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 was deleted.
Oops, something went wrong.
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