2012-06-01 10:33:08 +02:00
|
|
|
#ifndef TOUCHPAD_H
|
|
|
|
#define TOUCHPAD_H
|
|
|
|
|
|
|
|
#include "ch.h"
|
|
|
|
#include "hal.h"
|
|
|
|
|
2012-06-01 12:44:48 +02:00
|
|
|
#define CONVERSIONS 3
|
|
|
|
|
2012-06-01 10:33:08 +02:00
|
|
|
#define SET_CS(a) (TP_PORT->BSRR = 1 << (TP_CS + (a ? 0 : 16)))
|
|
|
|
|
2012-06-04 09:06:55 +02:00
|
|
|
volatile struct cal {
|
2012-06-04 16:40:38 +02:00
|
|
|
float xm;
|
|
|
|
float ym;
|
|
|
|
float xn;
|
|
|
|
float yn;
|
2012-06-04 09:06:55 +02:00
|
|
|
};
|
|
|
|
|
2012-06-01 10:33:08 +02:00
|
|
|
void tpInit(void);
|
2012-06-04 00:15:38 +02:00
|
|
|
uint8_t tpIRQ(void);
|
2012-06-01 10:33:08 +02:00
|
|
|
uint16_t tpReadX(void);
|
|
|
|
uint16_t tpReadY(void);
|
2012-06-07 01:08:12 +02:00
|
|
|
uint16_t tpReadRealX(void);
|
|
|
|
uint16_t tpReadRealY(void);
|
2012-06-04 09:06:55 +02:00
|
|
|
void tpCalibrate(void);
|
|
|
|
void tpCalibrate2(void);
|
2012-06-04 00:15:38 +02:00
|
|
|
void tpDrawCross(uint16_t x, uint16_t y);
|
2012-06-01 10:33:08 +02:00
|
|
|
|
|
|
|
#endif
|