diff options
| author | Selene ToyKeeper | 2024-03-12 13:17:47 -0600 |
|---|---|---|
| committer | Selene ToyKeeper | 2024-03-12 13:17:47 -0600 |
| commit | 8dbc5c8b694a5a60b5f2bbc4228037eff119ba68 (patch) | |
| tree | 4e2404dcbc74c175bc9c60a68bb18708f15cb521 /hw/thefreeman/avr32dd20-devkit/hwdef.c | |
| parent | added wurkkos-ts25-boost (early version made from spec, no clue if it works) (diff) | |
| parent | enabled eeprom read/write stabilization by default on recent MCUs, (diff) | |
| download | anduril-8dbc5c8b694a5a60b5f2bbc4228037eff119ba68.tar.gz anduril-8dbc5c8b694a5a60b5f2bbc4228037eff119ba68.tar.bz2 anduril-8dbc5c8b694a5a60b5f2bbc4228037eff119ba68.zip | |
Merge branch 'trunk' into wurkkos-ts25-boost
* trunk:
enabled eeprom read/write stabilization by default on recent MCUs, to prevent corrupt data
thefreeman-avr32dd20-devkit: enable boost bypass at boot, so AA/NiMH can boot
avr32dd20-devkit: use unimplemented "CH" pin as a boost bypass control
added "emisar-2ch-fet-joined" build, for D4S w/ lighted switch
documented FW3X swapped pins better
documented Wurkkos TS25/TS11/FC13 distinctions
build.sh: don't require DFPs, newer avr-libc doesn't need them
use BLIP_LEVEL instead of 0 for "blip"s
clarified which-hex-file.md a bit; make sure the model number matches
fw3x: reduced pulsing on low modes
Diffstat (limited to 'hw/thefreeman/avr32dd20-devkit/hwdef.c')
| -rw-r--r-- | hw/thefreeman/avr32dd20-devkit/hwdef.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/hw/thefreeman/avr32dd20-devkit/hwdef.c b/hw/thefreeman/avr32dd20-devkit/hwdef.c index 3e5dd79..460082f 100644 --- a/hw/thefreeman/avr32dd20-devkit/hwdef.c +++ b/hw/thefreeman/avr32dd20-devkit/hwdef.c @@ -30,6 +30,11 @@ void set_level_zero() { delay_4ms(IN_NFET_DELAY_TIME/4); IN_NFET_ENABLE_PORT &= ~(1 << IN_NFET_ENABLE_PIN); + #ifdef USE_BST_BYPASS + // turn off bypass + BST_BYPASS_PORT |= (1 << BST_BYPASS_PIN); + #endif + // turn off boost last BST_ENABLE_PORT &= ~(1 << BST_ENABLE_PIN); // BST off } @@ -48,6 +53,14 @@ void set_level_main(uint8_t level) { // BST on first, to give it a few extra microseconds to spin up BST_ENABLE_PORT |= (1 << BST_ENABLE_PIN); + #ifdef USE_BST_BYPASS + // turn on bypass in li-ion mode + if (voltage > DUAL_VOLTAGE_FLOOR) + BST_BYPASS_PORT &= ~(1 << BST_BYPASS_PIN); // low = bypass + else // turn off bypass in AA/NiMH mode + BST_BYPASS_PORT |= (1 << BST_BYPASS_PIN); // high = boost + #endif + // pre-load ramp data so it can be assigned faster later // DAC level register is left-aligned PWM1_DATATYPE dac_lvl = PWM1_GET(level) << 6; |
