~gabe/flashlight-firmware/anduril2

« back to all changes in this revision

Viewing changes to gchart/tk-calibration.h

  • Committer: Selene Scriven
  • Date: 2019-05-24 00:00:21 UTC
  • mto: (483.1.1 fsm)
  • mto: This revision was merged to the branch mainline in revision 443.
  • Revision ID: bzr@toykeeper.net-20190524000021-2f8tp4zvfe9aas7f
added GXB172 firmware from loneoceans (tiny841 boost driver)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef TK_CALIBRATION_H
 
2
#define TK_CALIBRATION_H
 
3
/*
 
4
 * Attiny calibration header.
 
5
 * This allows using a single set of hardcoded values across multiple projects.
 
6
 *
 
7
 * Copyright (C) 2015 Selene Scriven
 
8
 *
 
9
 * This program is free software: you can redistribute it and/or modify
 
10
 * it under the terms of the GNU General Public License as published by
 
11
 * the Free Software Foundation, either version 3 of the License, or
 
12
 * (at your option) any later version.
 
13
 *
 
14
 * This program is distributed in the hope that it will be useful,
 
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
17
 * GNU General Public License for more details.
 
18
 *
 
19
 * You should have received a copy of the GNU General Public License
 
20
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
21
 *
 
22
 */
 
23
 
 
24
/********************** Voltage ADC calibration **************************/
 
25
// These values were measured using RMM's FET+7135.
 
26
// See battcheck/readings.txt for reference values.
 
27
// the ADC values we expect for specific voltages
 
28
#define ADC_44     194
 
29
#define ADC_43     189
 
30
#define ADC_42     184
 
31
#define ADC_41     178
 
32
#define ADC_40     173
 
33
#define ADC_39     168
 
34
#define ADC_38     163
 
35
#define ADC_37     158
 
36
#define ADC_36     152
 
37
#define ADC_35     147
 
38
#define ADC_34     142
 
39
#define ADC_33     137
 
40
#define ADC_32     131
 
41
#define ADC_31     126
 
42
#define ADC_30     121
 
43
#define ADC_29     116
 
44
#define ADC_28     111
 
45
#define ADC_27     105
 
46
#define ADC_26     100
 
47
#define ADC_25     95
 
48
#define ADC_24     90
 
49
#define ADC_23     84
 
50
#define ADC_22     79
 
51
#define ADC_21     74
 
52
#define ADC_20     69
 
53
 
 
54
#define ADC_100p   ADC_42  // the ADC value for 100% full (resting)
 
55
#define ADC_75p    ADC_40  // the ADC value for 75% full (resting)
 
56
#define ADC_50p    ADC_38  // the ADC value for 50% full (resting)
 
57
#define ADC_25p    ADC_35  // the ADC value for 25% full (resting)
 
58
#define ADC_0p     ADC_30  // the ADC value for 0% full (resting)
 
59
#define ADC_LOW    ADC_30  // When do we start ramping down
 
60
#define ADC_CRIT   ADC_27  // When do we shut the light off
 
61
 
 
62
 
 
63
/********************** Offtime capacitor calibration ********************/
 
64
// Values are between 1 and 255, and can be measured with offtime-cap.c
 
65
// See battcheck/otc-readings.txt for reference values.
 
66
// These #defines are the edge boundaries, not the center of the target.
 
67
#ifdef OFFTIM3
 
68
// The OTC value 0.5s after being disconnected from power
 
69
// (anything higher than this is a "short press")
 
70
#define CAP_SHORT           190
 
71
// The OTC value 1.5s after being disconnected from power
 
72
// Between CAP_MED and CAP_SHORT is a "medium press"
 
73
#define CAP_MED             94
 
74
// Below CAP_MED is a long press
 
75
#else
 
76
// The OTC value 1.0s after being disconnected from power
 
77
// Anything higher than this is a short press, lower is a long press
 
78
#define CAP_SHORT           115
 
79
#endif
 
80
 
 
81
 
 
82
#endif  // TK_CALIBRATION_H