~toykeeper/flashlight-firmware/trunk

188.33.14 by Selene ToyKeeper
switched the rest of FSM + Anduril to use SPDX license headers
1
// MF01-Mini driver layout
2
// Copyright (C) 2019-2023 Selene ToyKeeper
3
// SPDX-License-Identifier: GPL-3.0-or-later
4
#pragma once
188.11.7 by Selene Scriven
added support for Mateminco MF01-Mini
5
188.33.14 by Selene ToyKeeper
switched the rest of FSM + Anduril to use SPDX license headers
6
/*
188.11.7 by Selene Scriven
added support for Mateminco MF01-Mini
7
 *           ----
8
 *   Reset -|1  8|- VCC
9
 * eswitch -|2  7|- aux LEDs
10
 * FET PWM -|3  6|- PWM (7x7135)
11
 *     GND -|4  5|- PWM (1x7135)
12
 *           ----
13
 */
14
15
#define PWM_CHANNELS 3
16
17
#ifndef AUXLED_PIN
18
#define AUXLED_PIN   PB2    // pin 7
19
#endif
20
21
#ifndef SWITCH_PIN
22
#define SWITCH_PIN   PB3    // pin 2
23
#define SWITCH_PCINT PCINT3 // pin 2 pin change interrupt
24
#endif
25
26
#ifndef PWM1_PIN
27
#define PWM1_PIN PB0        // pin 5, 1x7135 PWM
28
#define PWM1_LVL OCR0A      // OCR0A is the output compare register for PB0
29
#endif
30
#ifndef PWM2_PIN
188.11.10 by Selene Scriven
just cleaning up some comments
31
#define PWM2_PIN PB1        // pin 6, 7x7135 PWM
188.11.7 by Selene Scriven
added support for Mateminco MF01-Mini
32
#define PWM2_LVL OCR0B      // OCR0B is the output compare register for PB1
33
#endif
34
#ifndef PWM3_PIN
35
#define PWM3_PIN PB4        // pin 3, FET PWM
36
#define PWM3_LVL OCR1B      // OCR1B is the output compare register for PB4
37
#endif
38
188.15.11 by Selene Scriven
went back to slower clk/128 ADC timing
39
#define ADC_PRSCL   0x07    // clk/128
188.11.7 by Selene Scriven
added support for Mateminco MF01-Mini
40
41
// average drop across diode on this hardware
42
#ifndef VOLTAGE_FUDGE_FACTOR
43
#define VOLTAGE_FUDGE_FACTOR 5  // add 0.25V
44
#endif
45
46
#define FAST 0xA3           // fast PWM both channels
47
#define PHASE 0xA1          // phase-correct PWM both channels
48
49
#define LAYOUT_DEFINED
50