~gabe/flashlight-firmware/anduril2

« back to all changes in this revision

Viewing changes to ToyKeeper/tk-calibration.h

  • Committer: Selene Scriven
  • Date: 2015-03-17 08:56:50 UTC
  • mto: This revision was merged to the branch mainline in revision 124.
  • Revision ID: ubuntu@toykeeper.net-20150317085650-s89wr9h28n2co7z1
Added TheStar firmwares from _the_

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     205
29
 
#define ADC_43     201
30
 
#define ADC_42     196
31
 
#define ADC_41     191
32
 
#define ADC_40     187
33
 
#define ADC_39     182
34
 
#define ADC_38     177
35
 
#define ADC_37     172
36
 
#define ADC_36     168
37
 
#define ADC_35     163
38
 
#define ADC_34     158
39
 
#define ADC_33     153
40
 
#define ADC_32     149
41
 
#define ADC_31     144
42
 
#define ADC_30     139
43
 
#define ADC_29     134
44
 
#define ADC_28     130
45
 
#define ADC_27     125
46
 
#define ADC_26     120
47
 
#define ADC_25     116
48
 
#define ADC_24     111
49
 
#define ADC_23     106
50
 
#define ADC_22     101
51
 
#define ADC_21     97
52
 
#define ADC_20     92
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_28  // 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