blob: 022c2b7d3eccbb7acc05c70edd2d3d0319e741f8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
/* Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
/* Touch scanning module */
#ifndef __BOARD_KEYBORG_TOUCH_SCAN_H
#define __BOARD_KEYBORG_TOUCH_SCAN_H
enum pin_type {
PIN_ROW,
PIN_COL,
PIN_PD,
};
/* 8-bit window */
#define ADC_WINDOW_POS 2
#define ADC_DATA_WINDOW(x) ((x) >> ADC_WINDOW_POS)
/* Threshold for each cell */
#define THRESHOLD 35
/* ADC speed */
#define ADC_SMPR_VAL 0x3 /* 28.5 cycles */
#define ADC_SMPL_CYCLE_2 57
#define ADC_CONV_CYCLE_2 25
/* CPU clock is 4 times faster than ADC clock */
#define ADC_LONG_CPU_CYCLE (ADC_SMPL_CYCLE_2 * 2)
#define ADC_SHORT_CPU_CYCLE ((ADC_SMPL_CYCLE_2 - ADC_CONV_CYCLE_2) * 2)
struct ts_pin {
uint8_t port_id; /* GPIO_A = 0, GPIO_B = 1, ... */
uint8_t pin;
};
#define TS_GPIO_A 0
#define TS_GPIO_B 1
#define TS_GPIO_C 2
#define TS_GPIO_D 3
#define TS_GPIO_E 4
#define TS_GPIO_F 5
#define TS_GPIO_G 6
#define TS_GPIO_H 7
#define TS_GPIO_I 8
extern const struct ts_pin row_pins[];
extern const struct ts_pin col_pins[];
#define ROW_COUNT 41
#define COL_COUNT 60
void touch_scan_init(void);
void touch_scan_slave_start(void);
int touch_scan_full_matrix(void);
#endif /* __BOARD_KEYBORG_TOUCH_SCAN_H */
|