Merge lp:~empeka/flashlight-firmware/anduril2-fwaa into lp:~toykeeper/flashlight-firmware/anduril2

Proposed by mkozlowski
Status: Needs review
Proposed branch: lp:~empeka/flashlight-firmware/anduril2-fwaa
Merge into: lp:~toykeeper/flashlight-firmware/anduril2
Diff against target: 100 lines (+91/-0)
2 files modified
ToyKeeper/hwdef-FWAA.h (+59/-0)
ToyKeeper/spaghetti-monster/anduril/cfg-fwaa.h (+32/-0)
To merge this branch: bzr merge lp:~empeka/flashlight-firmware/anduril2-fwaa
Reviewer Review Type Date Requested Status
Selene ToyKeeper Pending
Review via email: mp+414207@code.launchpad.net

Commit message

Initial Lumintop FWAA hwdef and config

To post a comment you must log in.

Unmerged revisions

643. By mkozlowski <email address hidden>

Initial Lumintop FWAA hwdef and config

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added file 'ToyKeeper/hwdef-FWAA.h'
--- ToyKeeper/hwdef-FWAA.h 1970-01-01 00:00:00 +0000
+++ ToyKeeper/hwdef-FWAA.h 2022-01-16 01:57:01 +0000
@@ -0,0 +1,59 @@
1#ifndef HWDEF_FWAA_H
2#define HWDEF_FWAA_H
3
4/* BLF/TLF FWAA driver layout
5 * ----
6 * Reset (NC) -|1 8|- VCC
7 * eswitch -|2 7|- N/C
8 * Voltage -|3 6|- FET
9 * GND -|4 5|- 1x7135
10 * ----
11 */
12
13#define PWM_CHANNELS 2
14
15#ifndef SWITCH_PIN
16#define SWITCH_PIN PB3 // pin 2
17#define SWITCH_PCINT PCINT3 // pin 2 pin change interrupt
18#endif
19
20#ifndef PWM1_PIN
21#define PWM1_PIN PB0 // pin 5, 1x7135 PWM
22#define PWM1_LVL OCR0A // OCR0A is the output compare register for PB0
23#endif
24#ifndef PWM2_PIN
25#define PWM2_PIN PB1 // pin 6, FET PWM
26#define PWM2_LVL OCR0B // OCR0B is the output compare register for PB1
27#endif
28
29
30#define USE_VOLTAGE_DIVIDER
31#define VOLTAGE_ADC ADC2D
32#define VOLTAGE_PIN PB4
33#define VOLTAGE_ADC_DIDR DIDR0
34#define VOLTAGE_CHANNEL 0b10 // MUX 10 = ADC2 (PB4)
35// datasheet 17.13.1
36// REFS1 REFS0 ADLAR REFS2 MUX3 MUX2 MUX1 MUX0
37// REFS for 1.1V internal: REFS0=0, REFS1=1, REFS2=0
38// MUX for PB4: 0010
39//#define ADMUX_VOLTAGE_DIVIDER 0b10000010
40#define ADMUX_VOLTAGE_DIVIDER ((1 << V_REF) | VOLTAGE_CHANNEL)
41
42#define ADC_PRSCL 0x07 // clk/128
43
44// calculated values. need measurements
45// R1 = 910k, R2=200k
46#ifndef ADC_44
47#define ADC_44 738
48#endif
49#ifndef ADC_22
50#define ADC_22 369
51#endif
52
53
54#define FAST 0xA3 // fast PWM both channels
55#define PHASE 0xA1 // phase-correct PWM both channels
56
57#define LAYOUT_DEFINED
58
59#endif
060
=== added file 'ToyKeeper/spaghetti-monster/anduril/cfg-fwaa.h'
--- ToyKeeper/spaghetti-monster/anduril/cfg-fwaa.h 1970-01-01 00:00:00 +0000
+++ ToyKeeper/spaghetti-monster/anduril/cfg-fwaa.h 2022-01-16 01:57:01 +0000
@@ -0,0 +1,32 @@
1// FWAA config options for Anduril
2#define MODEL_NUMBER "0331"
3#include "hwdef-FWAA.h"
4
5#define RAMP_LENGTH 150
6#define PWM1_LEVELS 1,1,1,2,2,2,3,3,4,5,5,6,7,8,9,10,11,12,14,15,17,19,21,23,25,27,29,32,34,37,40,43,46,50,53,57,61,65,69,74,78,83,88,93,99,104,110,116,122,129,135,142,149,157,164,172,180,189,197,206,215,225,235,244,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,0
7#define PWM2_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,3,4,5,7,8,9,11,12,14,15,17,19,20,22,24,25,27,29,31,33,35,37,39,41,43,45,48,50,52,55,57,59,62,64,67,70,72,75,78,81,84,87,90,93,96,99,102,105,109,112,115,119,122,126,129,133,137,141,144,148,152,156,160,165,169,173,177,182,186,191,195,200,205,209,214,219,224,229,234,239,244,250,255
8#define MAX_1x7135 65
9#define HALFSPEED_LEVEL 14
10#define QUARTERSPEED_LEVEL 5
11
12
13#define RAMP_SMOOTH_FLOOR 1
14#define RAMP_SMOOTH_CEIL 120
15// 10, 28, 46, [65], 83, 101, 120
16#define RAMP_DISCRETE_FLOOR 10
17#define RAMP_DISCRETE_CEIL RAMP_SMOOTH_CEIL
18#define RAMP_DISCRETE_STEPS 7
19
20// safe limit ~20% power
21// 20 40 60 80 100
22#define SIMPLE_UI_FLOOR RAMP_DISCRETE_FLOOR
23#define SIMPLE_UI_CEIL 100
24#define SIMPLE_UI_STEPS 5
25
26#define THERM_FASTER_LEVEL 105
27
28// can't reset the normal way because power is connected before the button
29#define USE_SOFT_FACTORY_RESET
30
31//#undef USE_SOS_MODE
32//#undef USE_MOMENTARY_MODE

Subscribers

People subscribed via source and target branches

to status/vote changes: