~gabe/flashlight-firmware/anduril2

« back to all changes in this revision

Viewing changes to ToyKeeper/s7/brass-edc-calibration.h

  • Committer: Selene Scriven
  • Date: 2015-11-24 09:48:09 UTC
  • mfrom: (150.1.16 sandbox)
  • Revision ID: ubuntu@toykeeper.net-20151124094809-gkxohuxfrre3aucx
Merged updates to s7 and brass-edc.

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     193
 
29
#define ADC_43     188
 
30
#define ADC_42     183
 
31
#define ADC_41     179
 
32
#define ADC_40     174
 
33
#define ADC_39     169
 
34
#define ADC_38     164
 
35
#define ADC_37     159
 
36
#define ADC_36     154
 
37
#define ADC_35     149
 
38
#define ADC_34     144
 
39
#define ADC_33     140
 
40
#define ADC_32     135
 
41
#define ADC_31     130
 
42
#define ADC_30     125
 
43
#define ADC_29     120
 
44
#define ADC_28     115
 
45
#define ADC_27     110
 
46
#define ADC_26     106
 
47
#define ADC_25     101
 
48
#define ADC_24     96
 
49
#define ADC_23     91
 
50
#define ADC_22     86
 
51
#define ADC_21     81
 
52
#define ADC_20     76
 
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