aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hwdef-Noctigon_K1-12V.h8
-rw-r--r--spaghetti-monster/fsm-ramping.c6
2 files changed, 12 insertions, 2 deletions
diff --git a/hwdef-Noctigon_K1-12V.h b/hwdef-Noctigon_K1-12V.h
index f34b768..2294bac 100644
--- a/hwdef-Noctigon_K1-12V.h
+++ b/hwdef-Noctigon_K1-12V.h
@@ -19,7 +19,7 @@
* 12 PC3 RESET
* 13 PC2 (none)
* 14 PC1 SCK
- * 15 PC0 (none) PWM0A
+ * 15 PC0 boost PMIC enable (PWM0A not used)
* 16 PB3 main LED PWM (PWM1A)
* 17 PB2 MISO
* 18 PB1 MOSI / battery voltage (ADC6)
@@ -56,6 +56,9 @@
#define LED_ENABLE_PIN PB0 // pin 19, Opamp power
#define LED_ENABLE_PORT PORTB // control port for PB0
+#define LED_ENABLE2_PIN PC0 // pin 15, boost PMIC enable
+#define LED_ENABLE2_PORT PORTC // control port for PC0
+
#define USE_VOLTAGE_DIVIDER // use a dedicated pin, not VCC, because VCC input is flattened
#define VOLTAGE_PIN PB1 // Pin 18 / PB1 / ADC6
@@ -101,6 +104,8 @@
// ... so just hardcode it in each hwdef file instead
inline void hwdef_setup() {
// enable output ports
+ // boost PMIC on/off
+ DDRC = (1 << LED_ENABLE2_PIN);
// Opamp level and Opamp on/off
DDRB = (1 << PWM1_PIN)
| (1 << LED_ENABLE_PIN);
@@ -126,7 +131,6 @@ inline void hwdef_setup() {
;
// set up e-switch
- //PORTA = (1 << SWITCH_PIN); // TODO: configure PORTA / PORTB / PORTC?
PUEA = (1 << SWITCH_PIN); // pull-up for e-switch
SWITCH_PCMSK = (1 << SWITCH_PCINT); // enable pin change interrupt
}
diff --git a/spaghetti-monster/fsm-ramping.c b/spaghetti-monster/fsm-ramping.c
index 20500cc..bae601e 100644
--- a/spaghetti-monster/fsm-ramping.c
+++ b/spaghetti-monster/fsm-ramping.c
@@ -72,6 +72,9 @@ void set_level(uint8_t level) {
#ifdef LED_ENABLE_PIN
LED_ENABLE_PORT &= ~(1 << LED_ENABLE_PIN);
#endif
+ #ifdef LED_ENABLE2_PIN
+ LED_ENABLE2_PORT &= ~(1 << LED_ENABLE2_PIN);
+ #endif
} else {
level --;
@@ -79,6 +82,9 @@ void set_level(uint8_t level) {
#ifdef LED_ENABLE_PIN
LED_ENABLE_PORT |= (1 << LED_ENABLE_PIN);
#endif
+ #ifdef LED_ENABLE2_PIN
+ LED_ENABLE2_PORT |= (1 << LED_ENABLE2_PIN);
+ #endif
#ifdef USE_TINT_RAMPING
#ifndef TINT_RAMPING_CORRECTION