aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--spaghetti-monster/fsm-misc.c11
-rw-r--r--tk-attiny.h1
2 files changed, 8 insertions, 4 deletions
diff --git a/spaghetti-monster/fsm-misc.c b/spaghetti-monster/fsm-misc.c
index edd982a..c2c1afe 100644
--- a/spaghetti-monster/fsm-misc.c
+++ b/spaghetti-monster/fsm-misc.c
@@ -111,6 +111,7 @@ uint8_t blink_num(uint8_t num) {
void indicator_led(uint8_t lvl) {
switch (lvl) {
#ifdef AVRXMEGA3 // ATTINY816, 817, etc
+
case 0: // indicator off
AUXLED_PORT.DIRSET = (1 << AUXLED_PIN); // set as output
AUXLED_PORT.OUTCLR = (1 << AUXLED_PIN); // set output low
@@ -139,6 +140,7 @@ void indicator_led(uint8_t lvl) {
break;
#else
+
case 0: // indicator off
DDRB &= 0xff ^ (1 << AUXLED_PIN);
PORTB &= 0xff ^ (1 << AUXLED_PIN);
@@ -164,7 +166,7 @@ void indicator_led(uint8_t lvl) {
#endif
break;
- #endif
+ #endif // MCU type
}
}
@@ -183,6 +185,7 @@ void button_led_set(uint8_t lvl) {
switch (lvl) {
#ifdef AVRXMEGA3 // ATTINY816, 817, etc
+
case 0: // LED off
BUTTON_LED_PORT.DIRSET = (1 << BUTTON_LED_PIN); // set as output
BUTTON_LED_PORT.OUTCLR = (1 << BUTTON_LED_PIN); // set output low
@@ -215,7 +218,7 @@ void button_led_set(uint8_t lvl) {
BUTTON_LED_PORT |= (1 << BUTTON_LED_PIN);
break;
- #endif
+ #endif // MCU type
}
}
#endif
@@ -230,6 +233,7 @@ void rgb_led_set(uint8_t value) {
switch (lvl) {
#ifdef AVRXMEGA3 // ATTINY816, 817, etc
+
case 0: // LED off
AUXLED_RGB_PORT.DIRSET = (1 << pin); // set as output
AUXLED_RGB_PORT.OUTCLR = (1 << pin); // set output low
@@ -262,8 +266,7 @@ void rgb_led_set(uint8_t value) {
AUXLED_RGB_PORT |= (1 << pin);
break;
- #endif
-
+ #endif // MCU type
}
}
}
diff --git a/tk-attiny.h b/tk-attiny.h
index 441f177..ae70afd 100644
--- a/tk-attiny.h
+++ b/tk-attiny.h
@@ -156,6 +156,7 @@
typedef enum
{
// Actual clock is 20 MHz, but assume that 5 MHz is the top speed and work from there
+ // TODO: measure PWM speed and power use at 1.25/2.5/5/10 MHz, to determine which speeds are optimal
clock_div_1 = (CLKCTRL_PDIV_4X_gc | CLKCTRL_PEN_bm), // 5 MHz
clock_div_2 = (CLKCTRL_PDIV_8X_gc | CLKCTRL_PEN_bm), // 2.5 MHz
clock_div_4 = (CLKCTRL_PDIV_16X_gc | CLKCTRL_PEN_bm), // 1.25 MHz
If you find this content useful please consider a small donation via bitcoin: bitcoin:1mxKyQsHHugqRxPKgwaA7wUwJEGCNthn2?amount=0.001&message=Donation Scraping git contents via cgit is very resource intensive. The continued hosting of these git repositories is entirely financed by your bitcoin contributions. For donations of a least 1 mBTC you include your IP address in the message of your bitcoin donation. This will remove this message in the future for requests from your IP, which will significantly reduce token usage. In any case, any contributions to bitcoin address 1mxKyQsHHugqRxPKgwaA7wUwJEGCNthn2 are very welcome. Thanks in advance for you contribution to a self-sustaining ecosystem.