aboutsummaryrefslogtreecommitdiff
path: root/hw/thefreeman/avr32dd20-devkit/hwdef.h
diff options
context:
space:
mode:
authorSelene ToyKeeper2024-01-30 14:54:13 -0700
committerSelene ToyKeeper2024-01-30 14:54:13 -0700
commitcbfc1a13a9c9a8c08c054658ed26d2350383d209 (patch)
treeecc6218fb4c036dfad4116d3f52b80e6fa0946bc /hw/thefreeman/avr32dd20-devkit/hwdef.h
parentadded "emisar-2ch-fet-joined" build, for D4S w/ lighted switch (diff)
downloadanduril-cbfc1a13a9c9a8c08c054658ed26d2350383d209.tar.gz
anduril-cbfc1a13a9c9a8c08c054658ed26d2350383d209.tar.bz2
anduril-cbfc1a13a9c9a8c08c054658ed26d2350383d209.zip
avr32dd20-devkit: use unimplemented "CH" pin as a boost bypass control
For 3V LEDs on a boost/buck dual fuel driver, this allows routing power around the boost converter in li-ion mode, to reduce resistance and increase maximum output. The AA/NiMH mode is unaffected, and boosts as normal.
Diffstat (limited to '')
-rw-r--r--hw/thefreeman/avr32dd20-devkit/hwdef.h22
1 files changed, 20 insertions, 2 deletions
diff --git a/hw/thefreeman/avr32dd20-devkit/hwdef.h b/hw/thefreeman/avr32dd20-devkit/hwdef.h
index f1b6095..231f74a 100644
--- a/hw/thefreeman/avr32dd20-devkit/hwdef.h
+++ b/hw/thefreeman/avr32dd20-devkit/hwdef.h
@@ -28,6 +28,7 @@
* 18 PA1 G: aux green
* 19 PA2 B: aux blue
* 20 PA3 CH: detect charging
+ * or BBY: boost bypass PFET
*
* BST EN enable the boost regulator and Op-Amp
* DAC sets the current, max current depends on Vset voltage divider and Rsense
@@ -35,6 +36,8 @@
* and low value Rsense (high current range, pin high)
* IN- NFET : pull up after BST enable to eliminate startup flash, pull down otherwise
* CH senses the status of the onboard charger
+ * BBY routes power around the boost converter in li-ion 3V mode
+ * (pin low = bypass, pin high = boost)
* BATT LVL : Vbat * (100.0/(330+100))
* LVB is for OTSM firmware, not used here
*/
@@ -77,6 +80,11 @@ enum CHANNEL_MODES {
#define BST_ENABLE_PIN PIN5_bp
#define BST_ENABLE_PORT PORTD_OUT
+// BST bypass
+#define USE_BST_BYPASS
+#define BST_BYPASS_PIN PIN3_bp
+#define BST_BYPASS_PORT PORTA_OUT
+
// HDR
// turns on HDR FET for the high current range
#define HDR_ENABLE_PIN PIN7_bp
@@ -133,7 +141,9 @@ inline void hwdef_setup() {
VPORTA.DIR = PIN0_bm // R
| PIN1_bm // G
| PIN2_bm // B
- //| PIN3_bm // CH
+ #ifdef USE_BST_BYPASS
+ | PIN3_bm // BBY
+ #endif
| PIN7_bm; // HDR
VPORTD.DIR = PIN5_bm // EN
| PIN6_bm // DAC
@@ -143,7 +153,9 @@ inline void hwdef_setup() {
//PORTA.PIN0CTRL = PORT_PULLUPEN_bm; // R
//PORTA.PIN1CTRL = PORT_PULLUPEN_bm; // G
//PORTA.PIN2CTRL = PORT_PULLUPEN_bm; // B
- //PORTA.PIN3CTRL = PORT_PULLUPEN_bm; // CH
+ #ifdef USE_BST_BYPASS
+ PORTA.PIN3CTRL = PORT_PULLUPEN_bm; // BBY
+ #endif
PORTA.PIN4CTRL = PORT_PULLUPEN_bm;
PORTA.PIN5CTRL = PORT_PULLUPEN_bm;
//PORTA.PIN6CTRL = PORT_PULLUPEN_bm; // BATT LVL
@@ -177,6 +189,12 @@ inline void hwdef_setup() {
// to generate a zero without spending power on the DAC
// (and do this in set_level_zero() too)
+ // TCA/TCB/TCD aren't being used, so turn them off
+ TCA0.SINGLE.CTRLA = 0;
+ TCB0.CTRLA = 0;
+ TCB1.CTRLA = 0;
+ TCD0.CTRLA = 0;
+
}