483.12.14
by Selene ToyKeeper
switched the rest of FSM + Anduril to use SPDX license headers |
1 |
// misc.c: Misc extra functions for Anduril.
|
2 |
// Copyright (C) 2017-2023 Selene ToyKeeper
|
|
3 |
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
483.1.11
by Selene Scriven
more progress on refactoring Anduril into separate files... nearly done with the initial split |
4 |
|
483.12.14
by Selene ToyKeeper
switched the rest of FSM + Anduril to use SPDX license headers |
5 |
#pragma once
|
483.1.11
by Selene Scriven
more progress on refactoring Anduril into separate files... nearly done with the initial split |
6 |
|
7 |
#include "misc.h" |
|
8 |
||
483.1.67
by Selene Scriven
removed blink_confirm() because it's not used any more |
9 |
/* no longer used
|
483.1.11
by Selene Scriven
more progress on refactoring Anduril into separate files... nearly done with the initial split |
10 |
void blink_confirm(uint8_t num) {
|
483.1.43
by Selene Scriven
reduced ROM 10 bytes by cleaning up blink_confirm() calls |
11 |
uint8_t brightness = actual_level;
|
483.1.117
by Selene Scriven
made blink_once() brightness configurable per build |
12 |
uint8_t bump = actual_level + BLINK_BRIGHTNESS;
|
483.1.43
by Selene Scriven
reduced ROM 10 bytes by cleaning up blink_confirm() calls |
13 |
if (bump > MAX_LEVEL) bump = 0;
|
483.1.11
by Selene Scriven
more progress on refactoring Anduril into separate files... nearly done with the initial split |
14 |
for (; num>0; num--) {
|
483.1.43
by Selene Scriven
reduced ROM 10 bytes by cleaning up blink_confirm() calls |
15 |
set_level(bump);
|
483.1.11
by Selene Scriven
more progress on refactoring Anduril into separate files... nearly done with the initial split |
16 |
delay_4ms(10/4);
|
483.1.43
by Selene Scriven
reduced ROM 10 bytes by cleaning up blink_confirm() calls |
17 |
set_level(brightness);
|
18 |
if (num > 1) { delay_4ms(100/4); }
|
|
483.1.11
by Selene Scriven
more progress on refactoring Anduril into separate files... nearly done with the initial split |
19 |
}
|
20 |
}
|
|
483.1.67
by Selene Scriven
removed blink_confirm() because it's not used any more |
21 |
*/
|
483.1.11
by Selene Scriven
more progress on refactoring Anduril into separate files... nearly done with the initial split |
22 |
|
483.1.67
by Selene Scriven
removed blink_confirm() because it's not used any more |
23 |
// make a short, visible pulse
|
24 |
// (either brighter or darker, depending on current brightness)
|
|
483.1.43
by Selene Scriven
reduced ROM 10 bytes by cleaning up blink_confirm() calls |
25 |
void blink_once() { |
483.1.67
by Selene Scriven
removed blink_confirm() because it's not used any more |
26 |
uint8_t brightness = actual_level; |
483.1.117
by Selene Scriven
made blink_once() brightness configurable per build |
27 |
uint8_t bump = brightness + BLINK_BRIGHTNESS; |
483.1.67
by Selene Scriven
removed blink_confirm() because it's not used any more |
28 |
if (bump > MAX_LEVEL) bump = 0; |
29 |
||
30 |
set_level(bump); |
|
483.2.7
by Selene Scriven
made gradual_tick() work on K9.3 (via override), fixed strobe config, |
31 |
delay_4ms(BLINK_ONCE_TIME/4); |
483.1.67
by Selene Scriven
removed blink_confirm() because it's not used any more |
32 |
set_level(brightness); |
483.1.43
by Selene Scriven
reduced ROM 10 bytes by cleaning up blink_confirm() calls |
33 |
}
|
34 |
||
483.1.11
by Selene Scriven
more progress on refactoring Anduril into separate files... nearly done with the initial split |
35 |
// Just go dark for a moment to indicate to user that something happened
|
36 |
void blip() { |
|
37 |
uint8_t temp = actual_level; |
|
38 |
set_level(0); |
|
39 |
delay_4ms(3); |
|
40 |
set_level(temp); |
|
41 |
}
|
|
42 |