aboutsummaryrefslogtreecommitdiff
path: root/hw/sofirn
diff options
context:
space:
mode:
authorSelene ToyKeeper2023-11-30 09:19:45 -0700
committerSelene ToyKeeper2023-11-30 09:19:45 -0700
commitf745e12c3bc48d8fe544893871191086cf3cccc9 (patch)
tree0e7f6c2c5f362719ac4efad9d5c2365f3ed3c159 /hw/sofirn
parentadded md5sum to build-all.sh output per target (diff)
parenteliminated direct CCP register access from arch/attiny1616 (diff)
downloadanduril-f745e12c3bc48d8fe544893871191086cf3cccc9.tar.gz
anduril-f745e12c3bc48d8fe544893871191086cf3cccc9.tar.bz2
anduril-f745e12c3bc48d8fe544893871191086cf3cccc9.zip
Merge branch 'avr32dd20-devkit' into trunk
Added support for AVR DD MCUs, particularly avr32dd20. Also did a bunch of refactoring for how MCU support works, cleaned up the ADC code, switched to consistent internal formats for voltage and temperature, fixed the FW3X, and some other little things. * avr32dd20-devkit: (28 commits) eliminated direct CCP register access from arch/attiny1616 made the avr32dd20 flashing script more universal added a build target for FW3X with manually-fixed RGB aux wiring prevent future issues like the FW3X had fixed FW3X thermal regulation fixed incorrect temperature history for a few seconds after waking fsm/adc: removed dead code FW3X: fixed external temperature sensor FW3X: multiple upgrades... fw3x: fixed swapped red+blue, fixed battery measurements, added police color strobe fixed ADC on sp10-pro fixed ADC on attiny85 and related builds fixed ADC on attiny1634 and related builds more ADC / DAC / MCU progress... avr32dd20-devkit: make the defaults a bit more dev friendly (realtime voltage colors, and no simple UI by default) ADC voltage: battcheck 3 digits, fixed t1616, switched back to 8-bit internal volt unit got ADC voltage+temp working on avrdd... but broke all other builds/MCUs 1.55V AA battery should not show as "white" voltage color, only purple started refactoring fsm/adc.*, but need a checkpoint before continuing added dac-scale.py: short script to calculate avrdd DAC+Vref values from level_calc.py ramp data ...
Diffstat (limited to 'hw/sofirn')
-rw-r--r--hw/sofirn/blf-lt1-t1616/hwdef.h4
-rw-r--r--hw/sofirn/blf-lt1/hwdef.h4
-rw-r--r--hw/sofirn/blf-q8-t1616/hwdef.h4
-rw-r--r--hw/sofirn/lt1s-pro/hwdef.h4
-rw-r--r--hw/sofirn/sp10-pro/hwdef.h17
5 files changed, 12 insertions, 21 deletions
diff --git a/hw/sofirn/blf-lt1-t1616/hwdef.h b/hw/sofirn/blf-lt1-t1616/hwdef.h
index 66575de..c9ae1ea 100644
--- a/hw/sofirn/blf-lt1-t1616/hwdef.h
+++ b/hw/sofirn/blf-lt1-t1616/hwdef.h
@@ -12,9 +12,7 @@
* Voltage: VCC
*/
-#include <avr/io.h>
-
-#define HWDEF_C_FILE sofirn/blf-lt1-t1616/hwdef.c
+#define HWDEF_C sofirn/blf-lt1-t1616/hwdef.c
// allow using aux LEDs as extra channel modes
#include "fsm/chan-aux.h"
diff --git a/hw/sofirn/blf-lt1/hwdef.h b/hw/sofirn/blf-lt1/hwdef.h
index 03f3568..a57b1c4 100644
--- a/hw/sofirn/blf-lt1/hwdef.h
+++ b/hw/sofirn/blf-lt1/hwdef.h
@@ -12,9 +12,7 @@
* ----
*/
-#include <avr/io.h>
-
-#define HWDEF_C_FILE sofirn/blf-lt1/hwdef.c
+#define HWDEF_C sofirn/blf-lt1/hwdef.c
// channel modes:
// * 0. channel 1 only
diff --git a/hw/sofirn/blf-q8-t1616/hwdef.h b/hw/sofirn/blf-q8-t1616/hwdef.h
index 29c2ffa..638a2c1 100644
--- a/hw/sofirn/blf-q8-t1616/hwdef.h
+++ b/hw/sofirn/blf-q8-t1616/hwdef.h
@@ -15,11 +15,9 @@
* Voltage: VCC
*/
-#include <avr/io.h>
-
// nearly all t1616-based FET+1 drivers work pretty much the same
// (this one has single-color aux like the TS10)
-#define HWDEF_C_FILE wurkkos/ts10/hwdef.c
+#define HWDEF_C wurkkos/ts10/hwdef.c
// allow using aux LEDs as extra channel modes
#include "fsm/chan-aux.h"
diff --git a/hw/sofirn/lt1s-pro/hwdef.h b/hw/sofirn/lt1s-pro/hwdef.h
index cd4dd4e..7708631 100644
--- a/hw/sofirn/lt1s-pro/hwdef.h
+++ b/hw/sofirn/lt1s-pro/hwdef.h
@@ -13,9 +13,7 @@
* Voltage: VCC
*/
-#include <avr/io.h>
-
-#define HWDEF_C_FILE sofirn/lt1s-pro/hwdef.c
+#define HWDEF_C sofirn/lt1s-pro/hwdef.c
// channel modes:
// * 0. warm/cool white blend
diff --git a/hw/sofirn/sp10-pro/hwdef.h b/hw/sofirn/sp10-pro/hwdef.h
index a52166d..f220318 100644
--- a/hw/sofirn/sp10-pro/hwdef.h
+++ b/hw/sofirn/sp10-pro/hwdef.h
@@ -12,9 +12,7 @@
* PA1 : Boost Enable
*/
-#include <avr/io.h>
-
-#define HWDEF_C_FILE sofirn/sp10-pro/hwdef.c
+#define HWDEF_C sofirn/sp10-pro/hwdef.c
// channel modes:
// * 0. low+high PWM stacked
@@ -61,25 +59,26 @@ enum CHANNEL_MODES {
#define SWITCH_ISC_REG PORTB.PIN3CTRL
#define SWITCH_VECT PORTB_PORT_vect
#define SWITCH_INTFLG VPORTB.INTFLAGS
-#define SWITCH_PCINT PCINT0
-#define PCINT_vect PCINT0_vect // ISR for PCINT[7:0]
// Voltage divider battLVL
#define USE_VOLTAGE_DIVIDER // use a dedicated pin, not VCC, because VCC input is regulated
-#define DUAL_VOLTAGE_FLOOR 21 // for AA/14500 boost drivers, don't indicate low voltage if below this level
-#define DUAL_VOLTAGE_LOW_LOW 7 // the lower voltage range's danger zone 0.7 volts (NiMH)
+#define DUAL_VOLTAGE_FLOOR (4*21) // for AA/14500 boost drivers, don't indicate low voltage if below this level
+#define DUAL_VOLTAGE_LOW_LOW (4*7) // the lower voltage range's danger zone 0.7 volts (NiMH)
#define ADMUX_VOLTAGE_DIVIDER ADC_MUXPOS_AIN9_gc // which ADC channel to read
+#undef voltage_raw2cooked
+#define voltage_raw2cooked mcu_vdivider_raw2cooked
+
// Raw ADC readings at 4.4V and 2.2V
// calibrate the voltage readout here
// estimated / calculated values are:
// (voltage - D1) * (R2/(R2+R1) * 1024 / 1.1)
// Resistors are 300,000 and 100,000
#ifndef ADC_44
-#define ADC_44 1023 // raw value at 4.40V
+#define ADC_44 (4*1023) // raw value at 4.40V
#endif
#ifndef ADC_22
-#define ADC_22 512 // raw value at 2.20V
+#define ADC_22 (4*512) // raw value at 2.20V
#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.