touchpad demo update
This commit is contained in:
parent
f0a7643598
commit
7b10e441c8
1 changed files with 15 additions and 5 deletions
|
@ -23,8 +23,19 @@
|
||||||
#include "gdisp.h"
|
#include "gdisp.h"
|
||||||
#include "touchpad.h"
|
#include "touchpad.h"
|
||||||
|
|
||||||
|
static const SPIConfig spicfg = {
|
||||||
|
NULL, // no callback
|
||||||
|
GPIOC, // CS PORT
|
||||||
|
6, // CS PIN
|
||||||
|
SPI_CR1_BR_1 | SPI_CR1_BR_0,
|
||||||
|
};
|
||||||
|
|
||||||
TOUCHPADDriver TOUCHPADD1 = {
|
TOUCHPADDriver TOUCHPADD1 = {
|
||||||
&SPID1,
|
&SPID1, // SPI driver
|
||||||
|
&spicfg, // SPI config
|
||||||
|
GPIO, // IRQ PORT
|
||||||
|
4, // IRQ PIN
|
||||||
|
TRUE // start SPI
|
||||||
};
|
};
|
||||||
|
|
||||||
int main(void) {
|
int main(void) {
|
||||||
|
@ -32,15 +43,14 @@ int main(void) {
|
||||||
chSysInit();
|
chSysInit();
|
||||||
|
|
||||||
gdispInit();
|
gdispInit();
|
||||||
gdispClear(Lime);
|
|
||||||
|
|
||||||
tpInit(&TOUCHPADD1);
|
tpInit(&TOUCHPADD1);
|
||||||
tpCalibrate();
|
tpCalibrate();
|
||||||
|
|
||||||
gdispClear(Lime);
|
gdispClear(Black);
|
||||||
|
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
gdispDrawFillCircle(tpReadX(), tpReadY(), 3, Black);
|
gdispDrawPixel(tpReadX(), tpReadY(), Green);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue