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
1=== added file 'ToyKeeper/hwdef-FWAA.h'
2--- ToyKeeper/hwdef-FWAA.h 1970-01-01 00:00:00 +0000
3+++ ToyKeeper/hwdef-FWAA.h 2022-01-16 01:57:01 +0000
4@@ -0,0 +1,59 @@
5+#ifndef HWDEF_FWAA_H
6+#define HWDEF_FWAA_H
7+
8+/* BLF/TLF FWAA driver layout
9+ * ----
10+ * Reset (NC) -|1 8|- VCC
11+ * eswitch -|2 7|- N/C
12+ * Voltage -|3 6|- FET
13+ * GND -|4 5|- 1x7135
14+ * ----
15+ */
16+
17+#define PWM_CHANNELS 2
18+
19+#ifndef SWITCH_PIN
20+#define SWITCH_PIN PB3 // pin 2
21+#define SWITCH_PCINT PCINT3 // pin 2 pin change interrupt
22+#endif
23+
24+#ifndef PWM1_PIN
25+#define PWM1_PIN PB0 // pin 5, 1x7135 PWM
26+#define PWM1_LVL OCR0A // OCR0A is the output compare register for PB0
27+#endif
28+#ifndef PWM2_PIN
29+#define PWM2_PIN PB1 // pin 6, FET PWM
30+#define PWM2_LVL OCR0B // OCR0B is the output compare register for PB1
31+#endif
32+
33+
34+#define USE_VOLTAGE_DIVIDER
35+#define VOLTAGE_ADC ADC2D
36+#define VOLTAGE_PIN PB4
37+#define VOLTAGE_ADC_DIDR DIDR0
38+#define VOLTAGE_CHANNEL 0b10 // MUX 10 = ADC2 (PB4)
39+// datasheet 17.13.1
40+// REFS1 REFS0 ADLAR REFS2 MUX3 MUX2 MUX1 MUX0
41+// REFS for 1.1V internal: REFS0=0, REFS1=1, REFS2=0
42+// MUX for PB4: 0010
43+//#define ADMUX_VOLTAGE_DIVIDER 0b10000010
44+#define ADMUX_VOLTAGE_DIVIDER ((1 << V_REF) | VOLTAGE_CHANNEL)
45+
46+#define ADC_PRSCL 0x07 // clk/128
47+
48+// calculated values. need measurements
49+// R1 = 910k, R2=200k
50+#ifndef ADC_44
51+#define ADC_44 738
52+#endif
53+#ifndef ADC_22
54+#define ADC_22 369
55+#endif
56+
57+
58+#define FAST 0xA3 // fast PWM both channels
59+#define PHASE 0xA1 // phase-correct PWM both channels
60+
61+#define LAYOUT_DEFINED
62+
63+#endif
64
65=== added file 'ToyKeeper/spaghetti-monster/anduril/cfg-fwaa.h'
66--- ToyKeeper/spaghetti-monster/anduril/cfg-fwaa.h 1970-01-01 00:00:00 +0000
67+++ ToyKeeper/spaghetti-monster/anduril/cfg-fwaa.h 2022-01-16 01:57:01 +0000
68@@ -0,0 +1,32 @@
69+// FWAA config options for Anduril
70+#define MODEL_NUMBER "0331"
71+#include "hwdef-FWAA.h"
72+
73+#define RAMP_LENGTH 150
74+#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
75+#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
76+#define MAX_1x7135 65
77+#define HALFSPEED_LEVEL 14
78+#define QUARTERSPEED_LEVEL 5
79+
80+
81+#define RAMP_SMOOTH_FLOOR 1
82+#define RAMP_SMOOTH_CEIL 120
83+// 10, 28, 46, [65], 83, 101, 120
84+#define RAMP_DISCRETE_FLOOR 10
85+#define RAMP_DISCRETE_CEIL RAMP_SMOOTH_CEIL
86+#define RAMP_DISCRETE_STEPS 7
87+
88+// safe limit ~20% power
89+// 20 40 60 80 100
90+#define SIMPLE_UI_FLOOR RAMP_DISCRETE_FLOOR
91+#define SIMPLE_UI_CEIL 100
92+#define SIMPLE_UI_STEPS 5
93+
94+#define THERM_FASTER_LEVEL 105
95+
96+// can't reset the normal way because power is connected before the button
97+#define USE_SOFT_FACTORY_RESET
98+
99+//#undef USE_SOS_MODE
100+//#undef USE_MOMENTARY_MODE

Subscribers

People subscribed via source and target branches

to status/vote changes: