aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSelene ToyKeeper2018-12-18 15:08:05 -0700
committerSelene ToyKeeper2018-12-18 15:08:05 -0700
commita1713978973d478a974387c52f6e00190d4a274c (patch)
treed5e5989026a87036610f404d2cd87b3805d4655b
parentmerged updates from fsm branch (diff)
parentmerged include-fix branch, cleans up how include files / config files get pul... (diff)
downloadanduril-a1713978973d478a974387c52f6e00190d4a274c.tar.gz
anduril-a1713978973d478a974387c52f6e00190d4a274c.tar.bz2
anduril-a1713978973d478a974387c52f6e00190d4a274c.zip
merged include-fix branch for cleaner config file mechanisms
-rw-r--r--hwdef-BLF_GT.h6
-rw-r--r--hwdef-BLF_GT_Mini.h4
-rw-r--r--hwdef-BLF_Q8.h4
-rw-r--r--hwdef-Emisar_D1.h5
-rw-r--r--hwdef-Emisar_D1S.h5
-rw-r--r--hwdef-Emisar_D4.h6
-rw-r--r--hwdef-Emisar_D4S.h4
-rw-r--r--hwdef-FET_7135.h6
-rw-r--r--hwdef-FF_PL47.h4
-rw-r--r--hwdef-FF_ROT66.h4
-rw-r--r--hwdef-FW3A.h6
-rw-r--r--hwdef-Ferrero_Rocher.h7
-rw-r--r--hwdef-TK_Saber.h6
-rw-r--r--hwdef-Tripledown.h6
-rw-r--r--hwdef-nanjg.h6
-rw-r--r--spaghetti-monster/anduril/anduril.c67
-rwxr-xr-xspaghetti-monster/anduril/build-all.sh28
-rw-r--r--spaghetti-monster/anduril/cfg-blf-gt-mini.h1
-rw-r--r--spaghetti-monster/anduril/cfg-blf-gt.h1
-rw-r--r--spaghetti-monster/anduril/cfg-blf-lantern.h2
-rw-r--r--spaghetti-monster/anduril/cfg-blf-q8.h1
-rw-r--r--spaghetti-monster/anduril/cfg-emisar-d1.h2
-rw-r--r--spaghetti-monster/anduril/cfg-emisar-d1s.h2
-rw-r--r--spaghetti-monster/anduril/cfg-emisar-d4-219c.h1
-rw-r--r--spaghetti-monster/anduril/cfg-emisar-d4.h1
-rw-r--r--spaghetti-monster/anduril/cfg-emisar-d4s-219c.h1
-rw-r--r--spaghetti-monster/anduril/cfg-emisar-d4s.h1
-rw-r--r--spaghetti-monster/anduril/cfg-ff-pl47-219.h1
-rw-r--r--spaghetti-monster/anduril/cfg-ff-pl47.h1
-rw-r--r--spaghetti-monster/anduril/cfg-ff-rot66-219.h1
-rw-r--r--spaghetti-monster/anduril/cfg-ff-rot66.h1
-rw-r--r--spaghetti-monster/anduril/cfg-fw3a.h1
-rw-r--r--spaghetti-monster/anduril/cfg-sofirn-sp36.h6
-rw-r--r--spaghetti-monster/baton/baton.c2
-rw-r--r--spaghetti-monster/darkhorse/darkhorse.c2
-rw-r--r--spaghetti-monster/meteor/meteor.c2
-rw-r--r--spaghetti-monster/momentary/momentary.c2
-rw-r--r--spaghetti-monster/ramping-ui/ramping-ui.c2
-rwxr-xr-xspaghetti-monster/rampingios/build-all.sh19
-rw-r--r--spaghetti-monster/rampingios/rampingiosv3.c50
-rwxr-xr-xspaghetti-monster/werner/build-all.sh18
-rw-r--r--spaghetti-monster/werner/werner.c23
-rw-r--r--tk-attiny.h43
-rw-r--r--tk.h17
44 files changed, 158 insertions, 220 deletions
diff --git a/hwdef-BLF_GT.h b/hwdef-BLF_GT.h
index 7dcc8a0..01dbdbd 100644
--- a/hwdef-BLF_GT.h
+++ b/hwdef-BLF_GT.h
@@ -1,3 +1,6 @@
+#ifndef HWDEF_BLF_GT_H
+#define HWDEF_BLF_GT_H
+
/* BLF GT driver layout
* ----
* Reset -|1 8|- VCC (unused)
@@ -52,3 +55,6 @@
#define FAST 0xA3 // fast PWM both channels
#define PHASE 0xA1 // phase-correct PWM both channels
+#define LAYOUT_DEFINED
+
+#endif
diff --git a/hwdef-BLF_GT_Mini.h b/hwdef-BLF_GT_Mini.h
index aacbca4..43f74f3 100644
--- a/hwdef-BLF_GT_Mini.h
+++ b/hwdef-BLF_GT_Mini.h
@@ -1,3 +1,6 @@
+#ifndef HWDEF_BLF_GT_MINI_H
+#define HWDEF_BLF_GT_MINI_H
+
/* BLF/Lumintop GT Mini driver layout
*/
// exactly the same as a D1S, but with a lighted button
@@ -8,3 +11,4 @@
#define AUXLED_PIN PB4 // pin 3
#endif
+#endif
diff --git a/hwdef-BLF_Q8.h b/hwdef-BLF_Q8.h
index 6e13faf..5dac5d2 100644
--- a/hwdef-BLF_Q8.h
+++ b/hwdef-BLF_Q8.h
@@ -1,3 +1,6 @@
+#ifndef HWDEF_BLF_Q8_H
+#define HWDEF_BLF_Q8_H
+
/* BLF Q8 driver layout
* Q8 driver is the same as a D4, basically
*/
@@ -15,3 +18,4 @@
// Q8 driver is the same as a D4, basically
#include "hwdef-Emisar_D4.h"
+#endif
diff --git a/hwdef-Emisar_D1.h b/hwdef-Emisar_D1.h
index 6df8705..caf1d4e 100644
--- a/hwdef-Emisar_D1.h
+++ b/hwdef-Emisar_D1.h
@@ -1,4 +1,9 @@
+#ifndef HWDEF_EMISAR_D1_H
+#define HWDEF_EMISAR_D1_H
+
/* Emisar D1 driver layout
*/
// D1 driver is exactly the same as a D4
#include "hwdef-Emisar_D4.h"
+
+#endif
diff --git a/hwdef-Emisar_D1S.h b/hwdef-Emisar_D1S.h
index 31792c7..2e9fffa 100644
--- a/hwdef-Emisar_D1S.h
+++ b/hwdef-Emisar_D1S.h
@@ -1,4 +1,9 @@
+#ifndef HWDEF_EMISAR_D1S_H
+#define HWDEF_EMISAR_D1S_H
+
/* Emisar D1S driver layout
*/
// D1S driver is exactly the same as a D4
#include "hwdef-Emisar_D4.h"
+
+#endif
diff --git a/hwdef-Emisar_D4.h b/hwdef-Emisar_D4.h
index 0dfcab9..be499f1 100644
--- a/hwdef-Emisar_D4.h
+++ b/hwdef-Emisar_D4.h
@@ -1,3 +1,6 @@
+#ifndef HWDEF_EMISAR_D4_H
+#define HWDEF_EMISAR_D4_H
+
/* Emisar D4 driver layout
* ----
* Reset -|1 8|- VCC
@@ -7,6 +10,8 @@
* ----
*/
+#define LAYOUT_DEFINED
+
#define PWM_CHANNELS 2
//#define AUXLED_PIN PB4 // pin 3
@@ -42,3 +47,4 @@
#define FAST 0xA3 // fast PWM both channels
#define PHASE 0xA1 // phase-correct PWM both channels
+#endif
diff --git a/hwdef-Emisar_D4S.h b/hwdef-Emisar_D4S.h
index 47ef1eb..05a60f9 100644
--- a/hwdef-Emisar_D4S.h
+++ b/hwdef-Emisar_D4S.h
@@ -1,3 +1,6 @@
+#ifndef HWDEF_EMISAR_D4S_H
+#define HWDEF_EMISAR_D4S_H
+
/* Emisar D4S driver layout
*/
// same as a D4, basically
@@ -8,3 +11,4 @@
#define AUXLED_PIN PB4 // pin 3
#endif
+#endif
diff --git a/hwdef-FET_7135.h b/hwdef-FET_7135.h
index 58df7b2..c89d3ce 100644
--- a/hwdef-FET_7135.h
+++ b/hwdef-FET_7135.h
@@ -1,3 +1,6 @@
+#ifndef HWDEF_FET_7135_H
+#define HWDEF_FET_7135_H
+
/* FET + 7135 driver layout
* ----
* Reset -|1 8|- VCC
@@ -30,3 +33,6 @@
#define FAST 0xA3 // fast PWM both channels
#define PHASE 0xA1 // phase-correct PWM both channels
+#define LAYOUT_DEFINED
+
+#endif
diff --git a/hwdef-FF_PL47.h b/hwdef-FF_PL47.h
index 217ce45..5cd9684 100644
--- a/hwdef-FF_PL47.h
+++ b/hwdef-FF_PL47.h
@@ -1,3 +1,6 @@
+#ifndef HWDEF_FF_PL47_H
+#define HWDEF_FF_PL47_H
+
/* Fireflies PL47 driver layout
* same as a D4S, basically, except ...
*/
@@ -21,3 +24,4 @@
#undef FSM_EMISAR_D4S_DRIVER
#undef FSM_EMISAR_D4_DRIVER
+#endif
diff --git a/hwdef-FF_ROT66.h b/hwdef-FF_ROT66.h
index 0913a76..7348ab2 100644
--- a/hwdef-FF_ROT66.h
+++ b/hwdef-FF_ROT66.h
@@ -1,3 +1,6 @@
+#ifndef HWDEF_FF_ROT66_H
+#define HWDEF_FF_ROT66_H
+
/* Fireflies ROT66 driver layout
* same as a FW3A, basically, except ...
*/
@@ -19,3 +22,4 @@
#undef VISION_PIN
#endif
+#endif
diff --git a/hwdef-FW3A.h b/hwdef-FW3A.h
index 8abab9a..0b94635 100644
--- a/hwdef-FW3A.h
+++ b/hwdef-FW3A.h
@@ -1,3 +1,6 @@
+#ifndef HWDEF_FW3A_H
+#define HWDEF_FW3A_H
+
/* BLF/TLF FW3A driver layout
* ----
* Reset -|1 8|- VCC
@@ -45,3 +48,6 @@
#define FAST 0xA3 // fast PWM both channels
#define PHASE 0xA1 // phase-correct PWM both channels
+#define LAYOUT_DEFINED
+
+#endif
diff --git a/hwdef-Ferrero_Rocher.h b/hwdef-Ferrero_Rocher.h
index a46f19d..48519ef 100644
--- a/hwdef-Ferrero_Rocher.h
+++ b/hwdef-Ferrero_Rocher.h
@@ -1,3 +1,6 @@
+#ifndef HWDEF_FERRERO_ROCHER_H
+#define HWDEF_FERRERO_ROCHER_H
+
/* Ferrero Rocher driver layout
* ----
* Reset -|1 8|- VCC
@@ -9,3 +12,7 @@
// TODO: fill in this section, update Ferrero_Rocher code to use it.
#define FAST 0x23 // fast PWM channel 1 only
#define PHASE 0x21 // phase-correct PWM channel 1 only
+
+#define LAYOUT_DEFINED
+
+#endif
diff --git a/hwdef-TK_Saber.h b/hwdef-TK_Saber.h
index e90d5dd..3f49d30 100644
--- a/hwdef-TK_Saber.h
+++ b/hwdef-TK_Saber.h
@@ -1,3 +1,6 @@
+#ifndef HWDEF_TK_SABER_H
+#define HWDEF_TK_SABER_H
+
/* TK 4-color lightsaber driver layout
* ----
* Reset -|1 8|- VCC
@@ -31,3 +34,6 @@
#define FAST 0xA3 // fast PWM both channels
#define PHASE 0xA1 // phase-correct PWM both channels
+#define LAYOUT_DEFINED
+
+#endif
diff --git a/hwdef-Tripledown.h b/hwdef-Tripledown.h
index 4676e69..6bde976 100644
--- a/hwdef-Tripledown.h
+++ b/hwdef-Tripledown.h
@@ -1,3 +1,6 @@
+#ifndef HWDEF_TRIPLEDOWN_H
+#define HWDEF_TRIPLEDOWN_H
+
/* Tripledown driver layout
* ----
* Reset -|1 8|- VCC
@@ -31,3 +34,6 @@
#define FAST 0xA3 // fast PWM both channels
#define PHASE 0xA1 // phase-correct PWM both channels
+#define LAYOUT_DEFINED
+
+#endif
diff --git a/hwdef-nanjg.h b/hwdef-nanjg.h
index add10d1..135edbc 100644
--- a/hwdef-nanjg.h
+++ b/hwdef-nanjg.h
@@ -1,3 +1,6 @@
+#ifndef HWDEF_NANJG_H
+#define HWDEF_NANJG_H
+
/* NANJG driver layout
*/
#define STAR2_PIN PB0
@@ -14,3 +17,6 @@
#define FAST 0x23 // fast PWM channel 1 only
#define PHASE 0x21 // phase-correct PWM channel 1 only
+#define LAYOUT_DEFINED
+
+#endif
diff --git a/spaghetti-monster/anduril/anduril.c b/spaghetti-monster/anduril/anduril.c
index 3987d92..c99ea82 100644
--- a/spaghetti-monster/anduril/anduril.c
+++ b/spaghetti-monster/anduril/anduril.c
@@ -19,20 +19,8 @@
*/
/********* User-configurable options *********/
-// Physical driver type (uncomment one of the following or define it at the gcc command line)
-//#define FSM_BLF_GT_DRIVER
-//#define FSM_BLF_GT_MINI_DRIVER
-//#define FSM_BLF_Q8_DRIVER
-//#define FSM_EMISAR_D1_DRIVER
-//#define FSM_EMISAR_D1S_DRIVER
-//#define FSM_EMISAR_D4_DRIVER
-//#define FSM_EMISAR_D4_219C_DRIVER
-//#define FSM_EMISAR_D4S_DRIVER
-//#define FSM_EMISAR_D4S_219C_DRIVER
-//#define FSM_FF_ROT66_DRIVER
-//#define FSM_FF_ROT66_219_DRIVER
-//#define FSM_FW3A_DRIVER
-//#define FSM_SOFIRN_SP36_DRIVER
+// Anduril config file name (set it here or define it at the gcc command line)
+//#define CONFIGFILE cfg-blf-q8.h
#define USE_LVP // FIXME: won't build when this option is turned off
@@ -76,55 +64,8 @@
//#define START_AT_MEMORIZED_LEVEL
/***** specific settings for known driver types *****/
-#if defined(FSM_BLF_GT_DRIVER)
-#include "cfg-blf-gt.h"
-
-#elif defined(FSM_BLF_GT_MINI_DRIVER)
-#include "cfg-blf-gt-mini.h"
-
-#elif defined(FSM_BLF_LANTERN_DRIVER)
-#include "cfg-blf-lantern.h"
-
-#elif defined(FSM_BLF_Q8_DRIVER)
-#include "cfg-blf-q8.h"
-
-#elif defined(FSM_EMISAR_D1_DRIVER)
-#include "cfg-emisar-d1.h"
-
-#elif defined(FSM_EMISAR_D1S_DRIVER)
-#include "cfg-emisar-d1s.h"
-
-#elif defined(FSM_EMISAR_D4_219C_DRIVER)
-#include "cfg-emisar-d4-219c.h"
-
-#elif defined(FSM_EMISAR_D4_DRIVER)
-#include "cfg-emisar-d4.h"
-
-#elif defined(FSM_EMISAR_D4S_219C_DRIVER)
-#include "cfg-emisar-d4s-219c.h"
-
-#elif defined(FSM_EMISAR_D4S_DRIVER)
-#include "cfg-emisar-d4s.h"
-
-#elif defined(FSM_FF_PL47_DRIVER)
-#include "cfg-ff-pl47.h"
-
-#elif defined(FSM_FF_PL47_219_DRIVER)
-#include "cfg-ff-pl47-219.h"
-
-#elif defined(FSM_FF_ROT66_DRIVER)
-#include "cfg-ff-rot66.h"
-
-#elif defined(FSM_FF_ROT66_219_DRIVER)
-#include "cfg-ff-rot66-219.h"
-
-#elif defined(FSM_FW3A_DRIVER)
-#include "cfg-fw3a.h"
-
-#elif defined(FSM_SOFIRN_SP36_DRIVER)
-#include "cfg-sofirn-sp36.h"
-
-#endif
+#include "tk.h"
+#include incfile(CONFIGFILE)
// thermal properties, if not defined per-driver
diff --git a/spaghetti-monster/anduril/build-all.sh b/spaghetti-monster/anduril/build-all.sh
index ea79347..c355f1e 100755
--- a/spaghetti-monster/anduril/build-all.sh
+++ b/spaghetti-monster/anduril/build-all.sh
@@ -2,26 +2,10 @@
UI=anduril
-for TARGET in \
- BLF_GT \
- BLF_GT_MINI \
- BLF_LANTERN \
- BLF_Q8 \
- EMISAR_D1 \
- EMISAR_D1S \
- EMISAR_D4 \
- EMISAR_D4_219C \
- EMISAR_D4S \
- EMISAR_D4S_219C \
- FF_PL47 \
- FF_PL47_219 \
- FF_ROT66 \
- FF_ROT66_219 \
- FW3A \
- SOFIRN_SP36 \
- ; do
- echo "===== $TARGET ====="
- echo ../../../bin/build.sh 85 "$UI" "-DFSM_${TARGET}_DRIVER"
- ../../../bin/build.sh 85 "$UI" "-DFSM_${TARGET}_DRIVER"
- mv -f "$UI".hex "$UI".$TARGET.hex
+for TARGET in cfg-*.h ; do
+ NAME=$(echo "$TARGET" | perl -ne '/cfg-(.*).h/ && print "$1\n";')
+ echo "===== $NAME ====="
+ echo ../../../bin/build.sh 85 "$UI" "-DCONFIGFILE=${TARGET}"
+ ../../../bin/build.sh 85 "$UI" "-DCONFIGFILE=${TARGET}"
+ mv -f "$UI".hex "$UI".$NAME.hex
done
diff --git a/spaghetti-monster/anduril/cfg-blf-gt-mini.h b/spaghetti-monster/anduril/cfg-blf-gt-mini.h
index 885024a..3728f98 100644
--- a/spaghetti-monster/anduril/cfg-blf-gt-mini.h
+++ b/spaghetti-monster/anduril/cfg-blf-gt-mini.h
@@ -1,4 +1,5 @@
// BLF/Lumintop GT Mini config options for Anduril
+#include "hwdef-BLF_GT_Mini.h"
// Same as an Emisar D1S, except it has a lighted button
#include "cfg-emisar-d1s.h"
diff --git a/spaghetti-monster/anduril/cfg-blf-gt.h b/spaghetti-monster/anduril/cfg-blf-gt.h
index a29d7e7..b8f4d6d 100644
--- a/spaghetti-monster/anduril/cfg-blf-gt.h
+++ b/spaghetti-monster/anduril/cfg-blf-gt.h
@@ -1,4 +1,5 @@
// BLF GT config options for Anduril
+#include "hwdef-BLF_GT.h"
// the button lights up
#define USE_INDICATOR_LED
diff --git a/spaghetti-monster/anduril/cfg-blf-lantern.h b/spaghetti-monster/anduril/cfg-blf-lantern.h
index 26e5b5a..de593d4 100644
--- a/spaghetti-monster/anduril/cfg-blf-lantern.h
+++ b/spaghetti-monster/anduril/cfg-blf-lantern.h
@@ -9,7 +9,7 @@
*/
// basically the same as a Q8... sort of
-#define FSM_BLF_Q8_DRIVER
+#include "hwdef-BLF_Q8.h"
// the button lights up
#define USE_INDICATOR_LED
diff --git a/spaghetti-monster/anduril/cfg-blf-q8.h b/spaghetti-monster/anduril/cfg-blf-q8.h
index 90099c3..970fedb 100644
--- a/spaghetti-monster/anduril/cfg-blf-q8.h
+++ b/spaghetti-monster/anduril/cfg-blf-q8.h
@@ -1,4 +1,5 @@
// BLF Q8 config options for Anduril
+#include "hwdef-BLF_Q8.h"
// the button lights up
#define USE_INDICATOR_LED
diff --git a/spaghetti-monster/anduril/cfg-emisar-d1.h b/spaghetti-monster/anduril/cfg-emisar-d1.h
index d35480c..35e91db 100644
--- a/spaghetti-monster/anduril/cfg-emisar-d1.h
+++ b/spaghetti-monster/anduril/cfg-emisar-d1.h
@@ -1,4 +1,6 @@
// Emisar D1 config options for Anduril
+#include "hwdef-Emisar_D1.h"
+// same as Emisar D4, mostly
#include "cfg-emisar-d4.h"
// stop panicking at ~75% power or ~1000 lm (D1 has a decent power-to-thermal-mass ratio)
diff --git a/spaghetti-monster/anduril/cfg-emisar-d1s.h b/spaghetti-monster/anduril/cfg-emisar-d1s.h
index eb98c2e..56200a2 100644
--- a/spaghetti-monster/anduril/cfg-emisar-d1s.h
+++ b/spaghetti-monster/anduril/cfg-emisar-d1s.h
@@ -1,4 +1,6 @@
// Emisar D1S config options for Anduril
+#include "hwdef-Emisar_D1S.h"
+// same as Emisar D4, mostly
#include "cfg-emisar-d4.h"
// stop panicking at ~90% power or ~1200 lm (D1S has a good power-to-thermal-mass ratio)
diff --git a/spaghetti-monster/anduril/cfg-emisar-d4-219c.h b/spaghetti-monster/anduril/cfg-emisar-d4-219c.h
index 55ae1eb..cf245a2 100644
--- a/spaghetti-monster/anduril/cfg-emisar-d4-219c.h
+++ b/spaghetti-monster/anduril/cfg-emisar-d4-219c.h
@@ -1,7 +1,6 @@
// Emisar D4-219C config options for Anduril
// same as D4S but with FET modes limited to 80% power
// to avoid destroying the LEDs
-#define FSM_EMISAR_D4_DRIVER
#include "cfg-emisar-d4.h"
#undef PWM2_LEVELS
diff --git a/spaghetti-monster/anduril/cfg-emisar-d4.h b/spaghetti-monster/anduril/cfg-emisar-d4.h
index e83c62d..2f4df49 100644
--- a/spaghetti-monster/anduril/cfg-emisar-d4.h
+++ b/spaghetti-monster/anduril/cfg-emisar-d4.h
@@ -1,4 +1,5 @@
// Emisar D4 config options for Anduril
+#include "hwdef-Emisar_D4.h"
// ../../bin/level_calc.py 1 65 7135 1 0.8 150
// ... mixed with this:
diff --git a/spaghetti-monster/anduril/cfg-emisar-d4s-219c.h b/spaghetti-monster/anduril/cfg-emisar-d4s-219c.h
index c02274d..0c68bc4 100644
--- a/spaghetti-monster/anduril/cfg-emisar-d4s-219c.h
+++ b/spaghetti-monster/anduril/cfg-emisar-d4s-219c.h
@@ -1,7 +1,6 @@
// Emisar D4S-219C config options for Anduril
// same as D4S but with FET modes limited to 80% power
// to avoid destroying the LEDs
-#define FSM_EMISAR_D4S_DRIVER
#include "cfg-emisar-d4s.h"
#undef PWM2_LEVELS
diff --git a/spaghetti-monster/anduril/cfg-emisar-d4s.h b/spaghetti-monster/anduril/cfg-emisar-d4s.h
index 1070ee7..e26634a 100644
--- a/spaghetti-monster/anduril/cfg-emisar-d4s.h
+++ b/spaghetti-monster/anduril/cfg-emisar-d4s.h
@@ -1,4 +1,5 @@
// Emisar D4S config options for Anduril
+#include "hwdef-Emisar_D4S.h"
// the button lights up
#define USE_INDICATOR_LED
diff --git a/spaghetti-monster/anduril/cfg-ff-pl47-219.h b/spaghetti-monster/anduril/cfg-ff-pl47-219.h
index ea701bd..3ded2aa 100644
--- a/spaghetti-monster/anduril/cfg-ff-pl47-219.h
+++ b/spaghetti-monster/anduril/cfg-ff-pl47-219.h
@@ -1,7 +1,6 @@
// Fireflies PL47-219B config options for Anduril
// same as PL47 but with FET modes limited to 67% power
// to avoid destroying the LEDs
-#define FSM_FF_PL47_DRIVER
#include "cfg-ff-pl47.h"
#undef PWM2_LEVELS
diff --git a/spaghetti-monster/anduril/cfg-ff-pl47.h b/spaghetti-monster/anduril/cfg-ff-pl47.h
index 2e5647d..8e21013 100644
--- a/spaghetti-monster/anduril/cfg-ff-pl47.h
+++ b/spaghetti-monster/anduril/cfg-ff-pl47.h
@@ -1,4 +1,5 @@
// Fireflies PL47 config options for Anduril
+#include "hwdef-FF_PL47.h"
// the button lights up
#define USE_INDICATOR_LED
diff --git a/spaghetti-monster/anduril/cfg-ff-rot66-219.h b/spaghetti-monster/anduril/cfg-ff-rot66-219.h
index 46ceb9f..efaad94 100644
--- a/spaghetti-monster/anduril/cfg-ff-rot66-219.h
+++ b/spaghetti-monster/anduril/cfg-ff-rot66-219.h
@@ -1,6 +1,5 @@
// Fireflies ROT66-219 (7x7135) config options for Anduril
// same as regular ROT66, but calibrated for Nichia 219B with 7x7135 chips
-#define FSM_FF_ROT66_DRIVER
#include "cfg-ff-rot66.h"
// driver is a FET+N+1,
diff --git a/spaghetti-monster/anduril/cfg-ff-rot66.h b/spaghetti-monster/anduril/cfg-ff-rot66.h
index 165b2ba..78d7f66 100644
--- a/spaghetti-monster/anduril/cfg-ff-rot66.h
+++ b/spaghetti-monster/anduril/cfg-ff-rot66.h
@@ -1,4 +1,5 @@
// Fireflies ROT66 (14x7135) config options for Anduril
+#include "hwdef-FF_ROT66.h"
// the button lights up
#define USE_INDICATOR_LED
diff --git a/spaghetti-monster/anduril/cfg-fw3a.h b/spaghetti-monster/anduril/cfg-fw3a.h
index efa70ae..dd77137 100644
--- a/spaghetti-monster/anduril/cfg-fw3a.h
+++ b/spaghetti-monster/anduril/cfg-fw3a.h
@@ -1,4 +1,5 @@
// FW3A config options for Anduril
+#include "hwdef-FW3A.h"
// ../../bin/level_calc.py 1 65 7135 1 0.8 150
// ... mixed with this:
diff --git a/spaghetti-monster/anduril/cfg-sofirn-sp36.h b/spaghetti-monster/anduril/cfg-sofirn-sp36.h
index 2d6717f..1150a62 100644
--- a/spaghetti-monster/anduril/cfg-sofirn-sp36.h
+++ b/spaghetti-monster/anduril/cfg-sofirn-sp36.h
@@ -1,11 +1,11 @@
// Sofirn SP36 (small Q8) config options for Anduril
+// same as the BLF Q8, mostly
+#include "cfg-blf-q8.h"
// voltage readings were a little high with the Q8 value
+#undef VOLTAGE_FUDGE_FACTOR
#define VOLTAGE_FUDGE_FACTOR 5 // add 0.25V, not 0.35V
-#define FSM_BLF_Q8_DRIVER
-#include "cfg-blf-q8.h"
-
// the high button LED mode on this light uses too much power
// off mode: low (1)
// lockout: blinking (3)
diff --git a/spaghetti-monster/baton/baton.c b/spaghetti-monster/baton/baton.c
index d138297..8a80134 100644
--- a/spaghetti-monster/baton/baton.c
+++ b/spaghetti-monster/baton/baton.c
@@ -17,7 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#define FSM_EMISAR_D4_DRIVER
+#include "hwdef-Emisar_D4.h"
#define USE_LVP
#define USE_THERMAL_REGULATION
#define USE_DELAY_MS
diff --git a/spaghetti-monster/darkhorse/darkhorse.c b/spaghetti-monster/darkhorse/darkhorse.c
index d76afc2..ce1db2b 100644
--- a/spaghetti-monster/darkhorse/darkhorse.c
+++ b/spaghetti-monster/darkhorse/darkhorse.c
@@ -17,7 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#define FSM_EMISAR_D4_DRIVER
+#include "hwdef-Emisar_D4.h"
#define USE_LVP
#define USE_THERMAL_REGULATION
#define DEFAULT_THERM_CEIL 45
diff --git a/spaghetti-monster/meteor/meteor.c b/spaghetti-monster/meteor/meteor.c
index a50b034..5e925e2 100644
--- a/spaghetti-monster/meteor/meteor.c
+++ b/spaghetti-monster/meteor/meteor.c
@@ -18,7 +18,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#define FSM_EMISAR_D4_DRIVER
+#include "hwdef-Emisar_D4.h"
#define USE_LVP
#define USE_THERMAL_REGULATION
#define DEFAULT_THERM_CEIL 45
diff --git a/spaghetti-monster/momentary/momentary.c b/spaghetti-monster/momentary/momentary.c
index 0372b3d..26acd44 100644
--- a/spaghetti-monster/momentary/momentary.c
+++ b/spaghetti-monster/momentary/momentary.c
@@ -19,7 +19,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#define FSM_EMISAR_D4_DRIVER
+#include "hwdef-Emisar_D4.h"
#define USE_LVP
#define USE_DEBUG_BLINK
#define USE_DELAY_4MS
diff --git a/spaghetti-monster/ramping-ui/ramping-ui.c b/spaghetti-monster/ramping-ui/ramping-ui.c
index 234cdf4..18f488d 100644
--- a/spaghetti-monster/ramping-ui/ramping-ui.c
+++ b/spaghetti-monster/ramping-ui/ramping-ui.c
@@ -17,7 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#define FSM_EMISAR_D4_DRIVER
+#include "hwdef-Emisar_D4.h"
#define USE_LVP
#define USE_THERMAL_REGULATION
#define DEFAULT_THERM_CEIL 32
diff --git a/spaghetti-monster/rampingios/build-all.sh b/spaghetti-monster/rampingios/build-all.sh
index 5b75fe4..106dc15 100755
--- a/spaghetti-monster/rampingios/build-all.sh
+++ b/spaghetti-monster/rampingios/build-all.sh
@@ -1,18 +1,13 @@
#!/bin/sh
-cp -av ../anduril/cfg*.h .
+cp -av ../anduril/cfg-emisar*.h .
UI=rampingiosv3
-for TARGET in \
- EMISAR_D1 \
- EMISAR_D1S \
- EMISAR_D4 \
- EMISAR_D4_219C \
- EMISAR_D4S \
- EMISAR_D4S_219C \
- ; do
- echo "===== $TARGET ====="
- ../../../bin/build.sh 85 "$UI" "-DFSM_${TARGET}_DRIVER"
- mv -f "$UI".hex "$UI".$TARGET.hex
+for TARGET in cfg-*.h ; do
+ NAME=$(echo "$TARGET" | perl -ne '/cfg-(.*).h/ && print "$1\n";')
+ echo "===== $NAME ====="
+ echo ../../../bin/build.sh 85 "$UI" "-DCONFIGFILE=${TARGET}"
+ ../../../bin/build.sh 85 "$UI" "-DCONFIGFILE=${TARGET}"
+ mv -f "$UI".hex "$UI".$NAME.hex
done
diff --git a/spaghetti-monster/rampingios/rampingiosv3.c b/spaghetti-monster/rampingios/rampingiosv3.c
index 4142121..ff81f61 100644
--- a/spaghetti-monster/rampingios/rampingiosv3.c
+++ b/spaghetti-monster/rampingios/rampingiosv3.c
@@ -18,18 +18,8 @@
*/
/********* User-configurable options *********/
-// Physical driver type (uncomment one of the following or define it at the gcc command line)
-//#define FSM_BLF_GT_DRIVER
-//#define FSM_BLF_GT_MINI_DRIVER
-//#define FSM_BLF_Q8_DRIVER
-//#define FSM_EMISAR_D1_DRIVER
-//#define FSM_EMISAR_D1S_DRIVER
-//#define FSM_EMISAR_D4_DRIVER
-//#define FSM_EMISAR_D4_219C_DRIVER
-//#define FSM_EMISAR_D4S_DRIVER
-//#define FSM_EMISAR_D4S_219C_DRIVER
-//#define FSM_FF_ROT66_DRIVER
-//#define FSM_FW3A_DRIVER
+// Anduril config file name (set it here or define it at the gcc command line)
+//#define CONFIGFILE cfg-emisar-d4s.h
#define USE_LVP // FIXME: won't build when this option is turned off
@@ -57,40 +47,8 @@
//#define BATTCHECK_4bars // FIXME: breaks build
/***** specific settings for known driver types *****/
-#if defined(FSM_BLF_GT_DRIVER)
-#include "cfg-blf-gt.h"
-
-#elif defined(FSM_BLF_GT_MINI_DRIVER)
-#include "cfg-blf-gt-mini.h"
-
-#elif defined(FSM_BLF_Q8_DRIVER)
-#include "cfg-blf-q8.h"
-
-#elif defined(FSM_EMISAR_D1_DRIVER)
-#include "cfg-emisar-d1.h"
-
-#elif defined(FSM_EMISAR_D1S_DRIVER)
-#include "cfg-emisar-d1s.h"
-
-#elif defined(FSM_EMISAR_D4_219C_DRIVER)
-#include "cfg-emisar-d4-219c.h"
-
-#elif defined(FSM_EMISAR_D4_DRIVER)
-#include "cfg-emisar-d4.h"
-
-#elif defined(FSM_EMISAR_D4S_219C_DRIVER)
-#include "cfg-emisar-d4s-219c.h"
-
-#elif defined(FSM_EMISAR_D4S_DRIVER)
-#include "cfg-emisar-d4s.h"
-
-#elif defined(FSM_FF_ROT66_DRIVER)
-#include "cfg-ff-rot66.h"
-
-#elif defined(FSM_FW3A_DRIVER)
-#include "cfg-fw3a.h"
-
-#endif
+#include "tk.h"
+#include incfile(CONFIGFILE)
// thermal properties, if not defined per-driver
diff --git a/spaghetti-monster/werner/build-all.sh b/spaghetti-monster/werner/build-all.sh
index 43879bb..87d4f0d 100755
--- a/spaghetti-monster/werner/build-all.sh
+++ b/spaghetti-monster/werner/build-all.sh
@@ -4,16 +4,10 @@ cp -av ../anduril/cfg*.h .
UI=werner
-for TARGET in \
- BLF_GT \
- BLF_Q8 \
- EMISAR_D1 \
- EMISAR_D1S \
- EMISAR_D4 \
- EMISAR_D4S \
- FW3A \
- ; do
- echo "===== $TARGET ====="
- ../../../bin/build.sh 85 "$UI" "-DFSM_${TARGET}_DRIVER"
- mv -f "$UI".hex "$UI".$TARGET.hex
+for TARGET in cfg-*.h ; do
+ NAME=$(echo "$TARGET" | perl -ne '/cfg-(.*).h/ && print "$1\n";')
+ echo "===== $NAME ====="
+ echo ../../../bin/build.sh 85 "$UI" "-DCONFIGFILE=${TARGET}"
+ ../../../bin/build.sh 85 "$UI" "-DCONFIGFILE=${TARGET}"
+ mv -f "$UI".hex "$UI".$NAME.hex
done
diff --git a/spaghetti-monster/werner/werner.c b/spaghetti-monster/werner/werner.c
index b6cdf12..7c47cd7 100644
--- a/spaghetti-monster/werner/werner.c
+++ b/spaghetti-monster/werner/werner.c
@@ -20,10 +20,7 @@
/********* User-configurable options *********/
// Physical driver type (uncomment one of the following or define it at the gcc command line)
-//#define FSM_EMISAR_D4_DRIVER
-//#define FSM_BLF_Q8_DRIVER
-//#define FSM_FW3A_DRIVER
-//#define FSM_BLF_GT_DRIVER
+//#define CONFIGFILE cfg-emisar-d4.h
#define USE_LVP // FIXME: won't build when this option is turned off
@@ -37,21 +34,13 @@
//#define BATTCHECK_4bars // FIXME: breaks build
/***** specific settings for known driver types *****/
-#if defined(FSM_BLF_GT_DRIVER)
-#include "cfg-blf-gt.h"
-
-#elif defined(FSM_BLF_Q8_DRIVER)
-#include "cfg-blf-q8.h"
-
-#elif defined(FSM_EMISAR_D4_DRIVER)
-#include "cfg-emisar-d4.h"
-
-#elif defined(FSM_FW3A_DRIVER)
-#include "cfg-fw3a.h"
-
+#ifdef CONFIGFILE
+#include "tk.h"
+#include incfile(CONFIGFILE)
+#else
+#error You need to define CONFIGFILE
#endif
-
// thermal properties, if not defined per-driver
#ifndef MIN_THERM_STEPDOWN
#define MIN_THERM_STEPDOWN MAX_1x7135 // lowest value it'll step down to
diff --git a/tk-attiny.h b/tk-attiny.h
index 54856bf..3c985f2 100644
--- a/tk-attiny.h
+++ b/tk-attiny.h
@@ -61,6 +61,11 @@
#include <avr/interrupt.h>
/******************** I/O pin and register layout ************************/
+#ifdef HWDEFFILE
+#include "tk.h"
+#include incfile(HWDEFFILE)
+#endif
+
#if 0 // placeholder
#elif defined(NANJG_LAYOUT)
@@ -75,42 +80,10 @@
#elif defined(FERRERO_ROCHER_LAYOUT)
#include "hwdef-Ferrero_Rocher.h"
-#elif defined(FSM_BLF_GT_DRIVER)
-#include "hwdef-BLF_GT.h"
-
-#elif defined(FSM_BLF_GT_MINI_DRIVER)
-#include "hwdef-BLF_GT_Mini.h"
-
-#elif defined(FSM_BLF_Q8_DRIVER)
-#include "hwdef-BLF_Q8.h"
-
-#elif defined(FSM_EMISAR_D4_DRIVER)
-#include "hwdef-Emisar_D4.h"
-
-#elif defined(FSM_EMISAR_D4S_DRIVER)
-#include "hwdef-Emisar_D4S.h"
-
-#elif defined(FSM_EMISAR_D1_DRIVER)
-#include "hwdef-Emisar_D1.h"
-
-#elif defined(FSM_EMISAR_D1S_DRIVER)
-#include "hwdef-Emisar_D1S.h"
-
-#elif defined(FSM_FF_PL47_DRIVER)
-#include "hwdef-FF_PL47.h"
-
-#elif defined(FSM_FF_ROT66_DRIVER)
-#include "hwdef-FF_ROT66.h"
-
-#elif defined(FSM_FW3A_DRIVER)
-#include "hwdef-FW3A.h"
-
-#elif defined(FSM_TKSABER_DRIVER)
-#include "hwdef-TK_Saber.h"
+#endif // no more recognized driver types
-#else
+#ifndef LAYOUT_DEFINED
#error Hey, you need to define an I/O pin layout.
-
-#endif // no more recognized driver types
+#endif
#endif // TK_ATTINY_H
diff --git a/tk.h b/tk.h
new file mode 100644
index 0000000..b61db08
--- /dev/null
+++ b/tk.h
@@ -0,0 +1,17 @@
+#ifndef TK_H
+#define TK_H
+
+/////
+// tk.h
+// misc tricks which need to be available before other includes,
+// but which don't need to be repeated in every source file
+////
+
+// create a way to include files defined at the command line,
+// like with "gcc -DCONFIGFILE=foo.h"
+#define incfile2(s) #s
+#define incfile(s) incfile2(s)
+// use it like this:
+//#include incfile(CONFIGFILE)
+
+#endif