aboutsummaryrefslogtreecommitdiff
path: root/hw/hank/emisar-d4v2
diff options
context:
space:
mode:
authorSelene ToyKeeper2023-11-03 09:07:37 -0600
committerSelene ToyKeeper2023-11-03 09:07:37 -0600
commitcf0ed5c4bd07e191088977722010e9eec94a7c05 (patch)
tree4c2e4156a74cf3a6f1bad1f1d4b5087bb74a9f32 /hw/hank/emisar-d4v2
parentfixed compile scripts and added a "./make" wrapper for convenience (diff)
downloadanduril-cf0ed5c4bd07e191088977722010e9eec94a7c05.tar.gz
anduril-cf0ed5c4bd07e191088977722010e9eec94a7c05.tar.bz2
anduril-cf0ed5c4bd07e191088977722010e9eec94a7c05.zip
moved variant builds under their parent, like "d4-219" -> "d4/219"
Diffstat (limited to 'hw/hank/emisar-d4v2')
-rw-r--r--hw/hank/emisar-d4v2/219/anduril.h17
-rw-r--r--hw/hank/emisar-d4v2/nofet/anduril.h62
-rw-r--r--hw/hank/emisar-d4v2/nofet/hwdef.c55
3 files changed, 134 insertions, 0 deletions
diff --git a/hw/hank/emisar-d4v2/219/anduril.h b/hw/hank/emisar-d4v2/219/anduril.h
new file mode 100644
index 0000000..1022a04
--- /dev/null
+++ b/hw/hank/emisar-d4v2/219/anduril.h
@@ -0,0 +1,17 @@
+// Emisar D4v2-219 config options for Anduril
+// Copyright (C) 2019-2023 Selene ToyKeeper
+// SPDX-License-Identifier: GPL-3.0-or-later
+#pragma once
+
+#include "hank/emisar-d4v2/anduril.h"
+#undef MODEL_NUMBER
+#define MODEL_NUMBER "0114"
+// ATTINY: 1634
+
+// don't turn off the low channel at turbo level
+#undef LOW_PWM_LEVELS
+#define LOW_PWM_LEVELS 1,1,2,2,3,3,4,4,5,6,7,8,9,10,12,13,14,15,17,19,20,22,24,26,29,31,34,36,39,42,45,48,51,55,59,62,66,70,75,79,84,89,93,99,104,110,115,121,127,134,140,147,154,161,168,176,184,192,200,209,217,226,236,245,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255
+// 65% DDFET power
+#undef HIGH_PWM_LEVELS
+#define HIGH_PWM_LEVELS 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,13,15,16,17,18,19,21,22,23,25,26,27,28,30,32,33,34,36,38,39,41,42,44,46,47,49,51,53,55,57,59,61,63,65,67,69,71,73,75,78,80,82,84,87,90,92,94,97,99,102,104,108,110,113,116,119,121,125,127,130,134,136,140,143,146,149,153,156,159,163,166
+
diff --git a/hw/hank/emisar-d4v2/nofet/anduril.h b/hw/hank/emisar-d4v2/nofet/anduril.h
new file mode 100644
index 0000000..b0a9960
--- /dev/null
+++ b/hw/hank/emisar-d4v2/nofet/anduril.h
@@ -0,0 +1,62 @@
+// Emisar D4v2-noFET config options for Anduril
+// Copyright (C) 2020-2023 Selene ToyKeeper
+// SPDX-License-Identifier: GPL-3.0-or-later
+#pragma once
+
+// switch to 1-channel support functions
+#define HWDEF_C_FILE hank/emisar-d4v2/nofet/hwdef.c
+
+#include "hank/emisar-d4v2/anduril.h"
+#undef MODEL_NUMBER
+#define MODEL_NUMBER "0115"
+// ATTINY: 1634
+
+// the ramp uses only 1x7135 chip, max ~130 lm
+#undef PWM_CHANNELS
+#define PWM_CHANNELS 1
+
+#undef PWM1_LEVELS
+#undef PWM2_LEVELS
+#undef PWM_TOPS
+//#define PWM1_LEVELS 1,1,1,2,2,2,2,3,3,3,3,4,4,5,5,6,6,6,7,8,8,9,9,10,10,11,12,13,13,14,15,16,16,17,18,19,20,21,22,23,23,24,26,27,28,29,30,31,32,33,34,36,37,38,39,41,42,43,45,46,47,49,50,52,53,55,56,58,59,61,62,64,66,67,69,71,72,74,76,78,80,81,83,85,87,89,91,93,95,97,99,101,103,105,107,109,111,113,116,118,120,122,125,127,129,132,134,136,139,141,144,146,148,151,154,156,159,161,164,166,169,172,174,177,180,183,185,188,191,194,197,200,203,205,208,211,214,217,220,223,226,230,233,236,239,242,245,249,252,255
+// level_calc.py 3.01 1 150 7135 -1 0.1 140 --pwm dyn:64:4096:255:3 --clock 11:21:8.0
+// (and some manual tweaks to make half/quarter speed levels less bumpy)
+#define PWM1_LEVELS 1,1,2,2,3,4,4,5,6,7,9,10,11,11,12,13,13,14,15,15,18,18,17,18,18,19,19,19,19,19,20,20,20,20,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,19,20,20,20,21,21,22,23,24,24,26,27,28,29,30,31,32,33,34,35,36,38,39,40,42,43,44,46,47,49,50,52,53,55,56,58,60,62,63,65,67,69,71,73,75,77,79,81,83,85,88,90,92,95,97,100,102,105,107,110,112,115,118,121,124,127,129,132,135,139,142,145,148,151,155,158,162,165,169,172,176,179,183,187,191,195,199,203,207,211,215,219,223,228,232,237,241,246,250,255
+#define PWM_TOPS 4094,2719,3280,1954,2599,3032,2342,2548,2626,2635,2246,2261,2244,1964,1956,1929,1743,1733,1763,1697,1492,1362,1245,1231,1132,1118,1034,958,889,826,821,767,717,671,629,591,556,523,493,465,440,416,394,373,354,336,319,304,299,293,279,282,269,257,260,249,251,252,253,243,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255
+
+#undef MAX_1x7135
+#define MAX_1x7135 150
+#undef QUARTERSPEED_LEVEL
+#undef HALFSPEED_LEVEL
+#define QUARTERSPEED_LEVEL 11
+#define HALFSPEED_LEVEL 21
+
+#undef DEFAULT_LEVEL
+#define DEFAULT_LEVEL 80
+
+#undef RAMP_SMOOTH_CEIL
+#define RAMP_SMOOTH_CEIL 150
+// 10, 45, 80, 115, 150
+#undef RAMP_DISCRETE_FLOOR
+#undef RAMP_DISCRETE_CEIL
+#undef RAMP_DISCRETE_STEPS
+#define RAMP_DISCRETE_FLOOR 10
+#define RAMP_DISCRETE_CEIL 150
+#define RAMP_DISCRETE_STEPS 5
+
+// safe limit ~100% power because no FET
+#undef SIMPLE_UI_FLOOR
+#undef SIMPLE_UI_CEIL
+#define SIMPLE_UI_FLOOR RAMP_DISCRETE_FLOOR
+#define SIMPLE_UI_CEIL RAMP_DISCRETE_CEIL
+
+#undef CANDLE_AMPLITUDE
+#define CANDLE_AMPLITUDE 60
+
+#undef THERM_FASTER_LEVEL
+#define THERM_FASTER_LEVEL 150
+
+// maybe keep this, in case someone uses a higher power channel?
+//#undef USE_THERMAL_REGULATION
+//#undef USE_SET_LEVEL_GRADUALLY
+
diff --git a/hw/hank/emisar-d4v2/nofet/hwdef.c b/hw/hank/emisar-d4v2/nofet/hwdef.c
new file mode 100644
index 0000000..971c06e
--- /dev/null
+++ b/hw/hank/emisar-d4v2/nofet/hwdef.c
@@ -0,0 +1,55 @@
+// Emisar D4v2 (no DD FET, 1x7135 only) PWM helper functions
+// Copyright (C) 2017-2023 Selene ToyKeeper
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+#pragma once
+
+#include "fsm/chan-rgbaux.c"
+
+void set_level_zero();
+
+void set_level_main(uint8_t level);
+bool gradual_tick_main(uint8_t gt);
+
+
+Channel channels[] = {
+ { // main LEDs
+ .set_level = set_level_main,
+ .gradual_tick = gradual_tick_main
+ },
+ RGB_AUX_CHANNELS
+};
+
+
+void set_level_zero() {
+ CH1_PWM = 0;
+ PWM_CNT = 0; // reset phase
+}
+
+// single set of LEDs with just a 1x7135 chip, max 350 mA or ~130 lm
+void set_level_main(uint8_t level) {
+ PWM_DATATYPE ch1_pwm = PWM_GET(pwm1_levels, level);
+ // pulse frequency modulation, a.k.a. dynamic PWM
+ uint16_t top = PWM_GET16(pwm_tops, level);
+
+ CH1_PWM = ch1_pwm;
+ // wait to sync the counter and avoid flashes
+ while(actual_level && (PWM_CNT > (top - 32))) {}
+ PWM_TOP = top;
+ // force reset phase when turning on from zero
+ // (because otherwise the initial response is inconsistent)
+ if (! actual_level) PWM_CNT = 0;
+}
+
+bool gradual_tick_main(uint8_t gt) {
+ PWM_DATATYPE pwm1 = PWM_GET(pwm1_levels, gt);
+
+ GRADUAL_ADJUST_SIMPLE (pwm1, CH1_PWM);
+
+ if ( (pwm1 == CH1_PWM)
+ ) {
+ return true; // done
+ }
+ return false; // not done yet
+}
+
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.