aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hwdef-Emisar_D4Sv2-tintramp.h3
-rw-r--r--hwdef-Noctigon_KR4-tintramp.h49
-rw-r--r--spaghetti-monster/anduril/cfg-noctigon-kr4-tintramp.h12
3 files changed, 63 insertions, 1 deletions
diff --git a/hwdef-Emisar_D4Sv2-tintramp.h b/hwdef-Emisar_D4Sv2-tintramp.h
index 76f6097..3291c8b 100644
--- a/hwdef-Emisar_D4Sv2-tintramp.h
+++ b/hwdef-Emisar_D4Sv2-tintramp.h
@@ -52,6 +52,7 @@
#define SWITCH_PCIE PCIE0 // PCIE1 is for PCINT[7:0]
#define SWITCH_PCMSK PCMSK0 // PCMSK1 is for PCINT[7:0]
#define SWITCH_PORT PINA // PINA or PINB or PINC
+#define SWITCH_PUE PUEA // pullup group A
#define PCINT_vect PCINT0_vect // ISR for PCINT[7:0]
// usually PWM1_LVL would be a hardware register, but we need to abstract
@@ -173,7 +174,7 @@ inline void hwdef_setup() {
PWM1_TOP = PWM_TOP;
// set up e-switch
- PUEA = (1 << SWITCH_PIN); // pull-up for e-switch
+ SWITCH_PUE = (1 << SWITCH_PIN); // pull-up for e-switch
SWITCH_PCMSK = (1 << SWITCH_PCINT); // enable pin change interrupt
}
diff --git a/hwdef-Noctigon_KR4-tintramp.h b/hwdef-Noctigon_KR4-tintramp.h
new file mode 100644
index 0000000..9857431
--- /dev/null
+++ b/hwdef-Noctigon_KR4-tintramp.h
@@ -0,0 +1,49 @@
+#ifndef HWDEF_KR4_TINTRAMP_H
+#define HWDEF_KR4_TINTRAMP_H
+
+/* Noctigon KR4 w/ tint ramping
+ * (same driver as D4Sv2-tintramp, but with the switch on a different pin)
+ *
+ * Pin / Name / Function
+ * 1 PA6 2nd LED PWM (linear) (PWM1B)
+ * 2 PA5 R: red aux LED (PWM0B)
+ * 3 PA4 G: green aux LED
+ * 4 PA3 B: blue aux LED
+ * 5 PA2 button LED
+ * 6 PA1 Opamp 2 enable (2nd LEDs)
+ * 7 PA0 Opamp 1 enable (main LEDs)
+ * 8 GND GND
+ * 9 VCC VCC
+ * 10 PC5 (none)
+ * 11 PC4 (none)
+ * 12 PC3 RESET
+ * 13 PC2 (none)
+ * 14 PC1 SCK
+ * 15 PC0 main LED PWM (FET) (PWM0A) (unused on some models because tint ramping)
+ * 16 PB3 main LED PWM (linear) (PWM1A)
+ * 17 PB2 MISO / e-switch (PCINT10)
+ * 18 PB1 MOSI / battery voltage (ADC6)
+ * 19 PB0 (none)
+ * 20 PA7 (none)
+ * ADC12 thermal sensor
+ */
+
+#include "hwdef-Emisar_D4Sv2-tintramp.h"
+
+// move the switch to a different pin
+#undef SWITCH_PIN
+#undef SWITCH_PCINT
+#undef SWITCH_PCIE
+#undef SWITCH_PCMSK
+#undef SWITCH_PORT
+#undef SWITCH_PUE
+#undef PCINT_vect
+#define SWITCH_PIN PB2 // pin 17
+#define SWITCH_PCINT PCINT10 // pin 17 pin change interrupt
+#define SWITCH_PCIE PCIE1 // PCIE1 is for PCINT[11:8]
+#define SWITCH_PCMSK PCMSK1 // PCMSK1 is for PCINT[11:8]
+#define SWITCH_PORT PINB // PINA or PINB or PINC
+#define SWITCH_PUE PUEB // pullup group B
+#define PCINT_vect PCINT1_vect // ISR for PCINT[11:8]
+
+#endif
diff --git a/spaghetti-monster/anduril/cfg-noctigon-kr4-tintramp.h b/spaghetti-monster/anduril/cfg-noctigon-kr4-tintramp.h
new file mode 100644
index 0000000..f19744d
--- /dev/null
+++ b/spaghetti-monster/anduril/cfg-noctigon-kr4-tintramp.h
@@ -0,0 +1,12 @@
+// Noctigon KR4 tint-ramping config options for Anduril
+// (basically the same as Emisar D4S V2 tint-ramping,
+// but switch on a different pin, and no lighted button)
+// ATTINY: 1634
+#include "hwdef-Noctigon_KR4-tintramp.h"
+#include "cfg-emisar-d4sv2-tintramp.h"
+#undef MODEL_NUMBER
+#define MODEL_NUMBER "0215"
+
+// the button doesn't light up
+#undef USE_BUTTON_LED
+