aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSelene ToyKeeper2020-02-25 23:43:33 -0700
committerSelene ToyKeeper2020-02-25 23:43:33 -0700
commit7d07887e11cf7804ce8eb15fac666551b9a2497e (patch)
treef0b1d770aa80cc37f9e47e5ee30219846b38f912
parentAdded template files for Noctigon K1 12V model. (diff)
downloadanduril-7d07887e11cf7804ce8eb15fac666551b9a2497e.tar.gz
anduril-7d07887e11cf7804ce8eb15fac666551b9a2497e.tar.bz2
anduril-7d07887e11cf7804ce8eb15fac666551b9a2497e.zip
added support for boost PMIC enable pin (K1 12V has 2 pins which need to turn on/off for main LED output)
-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
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.