fixes
This commit is contained in:
parent
8c95db3a79
commit
e42ed87364
13
gui.c
13
gui.c
@ -18,21 +18,12 @@ static msg_t buttonThread(struct buttonStruct_t *a) {
|
|||||||
|
|
||||||
static msg_t TouchPadThread(void *arg) {
|
static msg_t TouchPadThread(void *arg) {
|
||||||
(void)arg;
|
(void)arg;
|
||||||
unsigned char buffer[10];
|
|
||||||
chRegSetThreadName("GUI");
|
chRegSetThreadName("GUI");
|
||||||
|
|
||||||
while(TRUE) {
|
while(TRUE) {
|
||||||
if(tpIRQ()) {
|
|
||||||
x = tpReadX();
|
x = tpReadX();
|
||||||
y = tpReadY();
|
y = tpReadY();
|
||||||
|
|
||||||
lcdFillArea(10, 10, 80, 80, Black);
|
|
||||||
sprintf(buffer, "X: %d", x);
|
|
||||||
lcdDrawString(10, 10, buffer, White, Black);
|
|
||||||
sprintf(buffer, "Y: %d", y);
|
|
||||||
lcdDrawString(10, 25, buffer, White, Black);
|
|
||||||
}
|
|
||||||
|
|
||||||
chThdSleepMilliseconds(10);
|
chThdSleepMilliseconds(10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -40,7 +31,7 @@ static msg_t TouchPadThread(void *arg) {
|
|||||||
|
|
||||||
void guiInit(void) {
|
void guiInit(void) {
|
||||||
Thread *tp = NULL;
|
Thread *tp = NULL;
|
||||||
tp = chThdCreateFromHeap(NULL, THD_WA_SIZE(512), HIGHPRIO-1, TouchPadThread, NULL);
|
tp = chThdCreateFromHeap(NULL, THD_WA_SIZE(64), HIGHPRIO-1, TouchPadThread, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
Thread *guiDrawButton(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, unsigned char *str, uint16_t fontColor, uint16_t buttonColor, uint8_t *state) {
|
Thread *guiDrawButton(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, unsigned char *str, uint16_t fontColor, uint16_t buttonColor, uint8_t *state) {
|
||||||
@ -56,7 +47,7 @@ Thread *guiDrawButton(uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, unsign
|
|||||||
buttonStruct->state = state;
|
buttonStruct->state = state;
|
||||||
|
|
||||||
lcdDrawRectString(x0, y0, x1, y1, str, fontColor, buttonColor);
|
lcdDrawRectString(x0, y0, x1, y1, str, fontColor, buttonColor);
|
||||||
tp = chThdCreateFromHeap(NULL, THD_WA_SIZE(128), NORMALPRIO+1, buttonThread, buttonStruct);
|
tp = chThdCreateFromHeap(NULL, THD_WA_SIZE(64), NORMALPRIO+1, buttonThread, buttonStruct);
|
||||||
|
|
||||||
return tp;
|
return tp;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user