~toykeeper/flashlight-firmware/trunk

« back to all changes in this revision

Viewing changes to ToyKeeper/hwdef-Mateminco_MF01S.h

  • Committer: Selene Scriven
  • Date: 2019-08-11 21:16:23 UTC
  • mfrom: (188.1.250 fsm)
  • Revision ID: bzr@toykeeper.net-20190811211623-i2i2rcud9kbx3hdw
merged fsm to trunk...  lots of updates:
+ attiny1634 support
+ Emisar D4v2 support
+ Mateminco MF01S / MT18 support
+ Fireflies E01 and E07v2 support
+ RGB aux LED support
+ added factory reset function
+ added manual / automatic memory toggle
+ added 2-level brightness during lockout
+ added Fireflies UI
+ made momentary mode also support strobe-group modes
* thermal regulation rewritten, behaves mostly better now
* strobe modes auto-reverse their ramp now
* muggle mode fixes
* UI diagram and manual updated
* button timing adjusted, and compile-time options added for it
* general refactoring

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef HWDEF_MF01S_H
 
2
#define HWDEF_MF01S_H
 
3
 
 
4
/* MF01S driver layout
 
5
 *           ----
 
6
 *   Reset -|1  8|- VCC (unused)
 
7
 * eswitch -|2  7|- Voltage divider (2S)
 
8
 * AUX LED -|3  6|- PWM (FET)
 
9
 *     GND -|4  5|- PWM (smaller FET)
 
10
 *           ----
 
11
 */
 
12
 
 
13
#define PWM_CHANNELS 2
 
14
 
 
15
#ifndef AUXLED_PIN
 
16
#define AUXLED_PIN   PB4    // pin 3
 
17
#endif
 
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
#define USE_VOLTAGE_DIVIDER // use a voltage divider on pin 7, not VCC
 
34
#ifndef VOLTAGE_PIN
 
35
#define VOLTAGE_PIN PB2     // pin 7, voltage ADC
 
36
#define VOLTAGE_CHANNEL 0x01 // MUX 01 corresponds with PB2
 
37
#define VOLTAGE_ADC_DIDR ADC1D  // Digital input disable bit corresponding with PB2
 
38
// 1.1V reference, left-adjust, ADC1/PB2
 
39
//#define ADMUX_VOLTAGE_DIVIDER ((1 << V_REF) | (1 << ADLAR) | VOLTAGE_CHANNEL)
 
40
// 1.1V reference, no left-adjust, ADC1/PB2
 
41
#define ADMUX_VOLTAGE_DIVIDER ((1 << V_REF) | VOLTAGE_CHANNEL)
 
42
#endif
 
43
#define ADC_PRSCL   0x06    // clk/64
 
44
 
 
45
// Raw ADC readings at 4.4V and 2.2V (in-between, we assume values form a straight line)
 
46
#ifndef ADC_44
 
47
#define ADC_44 234
 
48
#endif
 
49
#ifndef ADC_22
 
50
#define ADC_22 117
 
51
#endif
 
52
 
 
53
#define TEMP_CHANNEL 0b00001111
 
54
 
 
55
#define FAST 0xA3           // fast PWM both channels
 
56
#define PHASE 0xA1          // phase-correct PWM both channels
 
57
 
 
58
#define LAYOUT_DEFINED
 
59
 
 
60
#endif