aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorSelene ToyKeeper2021-11-12 03:15:21 -0700
committerSelene ToyKeeper2021-11-12 03:15:21 -0700
commit4873134411e7309c951478c2c3739bdd4b3ff9fb (patch)
tree3c24418836fdafe140c05e16735dc03964cb7ce4 /hw
parentfine-tuned DM11-12V build a bit based on actual measurements (diff)
parentfixed KR4-tintramp build (switch wasn't working) and added it to MODELS (diff)
downloadanduril-4873134411e7309c951478c2c3739bdd4b3ff9fb.tar.gz
anduril-4873134411e7309c951478c2c3739bdd4b3ff9fb.tar.bz2
anduril-4873134411e7309c951478c2c3739bdd4b3ff9fb.zip
merged anduril2 branch for updates
Diffstat (limited to '')
-rw-r--r--hwdef-BLF_LT1.h4
-rw-r--r--hwdef-Emisar_D4Sv2-tintramp.h5
-rw-r--r--hwdef-Noctigon_KR4-tintramp.h46
3 files changed, 52 insertions, 3 deletions
diff --git a/hwdef-BLF_LT1.h b/hwdef-BLF_LT1.h
index d0c2821..16e1c90 100644
--- a/hwdef-BLF_LT1.h
+++ b/hwdef-BLF_LT1.h
@@ -14,7 +14,7 @@
#include <avr/io.h>
#define PWM_CHANNELS 1 // 1 virtual channel (1 for main LEDs + 1 for 2nd LEDs)
-#define PWM_BITS 8 // 0 to 255 at 15.6 kHz
+#define PWM_BITS 9 // 0 to 255 at 15.6 kHz, but goes to 510 for "200%" turbo
#define PWM_TOP 255
// dynamic PWM with tint ramping (not supported on attiny85)
@@ -25,7 +25,7 @@
// it out to a soft brightness value, in order to handle tint ramping
// (this allows smooth thermal regulation to work, and makes things
// otherwise simpler and easier)
-uint8_t PWM1_LVL;
+uint16_t PWM1_LVL;
#define PWM1_PIN PB0 // pin 5, warm tint PWM
#define TINT1_LVL OCR0A // OCR0A is the output compare register for PB0
diff --git a/hwdef-Emisar_D4Sv2-tintramp.h b/hwdef-Emisar_D4Sv2-tintramp.h
index 76f6097..90545f4 100644
--- a/hwdef-Emisar_D4Sv2-tintramp.h
+++ b/hwdef-Emisar_D4Sv2-tintramp.h
@@ -47,12 +47,15 @@
#define USE_DYN_PWM // dynamic frequency and speed
#define PWM_DATATYPE2 uint32_t // only needs 32-bit if ramp values go over 255
+#ifndef SWITCH_PIN
#define SWITCH_PIN PA7 // pin 20
#define SWITCH_PCINT PCINT7 // pin 20 pin change interrupt
#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]
+#endif
// usually PWM1_LVL would be a hardware register, but we need to abstract
// it out to a soft brightness value, in order to handle tint ramping
@@ -173,7 +176,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..3bd57fe
--- /dev/null
+++ b/hwdef-Noctigon_KR4-tintramp.h
@@ -0,0 +1,46 @@
+#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
+ */
+
+#define ATTINY 1634
+#include <avr/io.h>
+
+// move the switch to a different pin
+#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]
+
+// the rest of the config is the same as D4Sv2-tintramp
+#include "hwdef-Emisar_D4Sv2-tintramp.h"
+
+#endif
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.