aboutsummaryrefslogtreecommitdiffstats
path: root/touchpad.h
blob: fd2826b259348340e5a3e41d91fba0901f733b97 (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
#ifndef TOUCHPAD_H
#define TOUCHPAD_H

#include "ch.h"
#include "hal.h"

#define CONVERSIONS 3

#define SET_CS(a)		(TP_PORT->BSRR = 1 << (TP_CS + (a ? 0 : 16)))

volatile struct cal {
	float xm;
	float ym;
	float xn;
	float yn;
};

void tpInit(void);
uint8_t tpIRQ(void);
uint16_t tpReadX(void);
uint16_t tpReadY(void);
uint16_t tpReadRealX(void);
uint16_t tpReadRealY(void);
void tpCalibrate(void);
void tpCalibrate2(void);
void tpDrawCross(uint16_t x, uint16_t y);

#endif