resistance touch lcd

This commit is contained in:
2026-07-03 11:22:17 +08:00
commit bf249faed0
8 changed files with 336 additions and 0 deletions

28
main/resistive_touch.h Normal file
View File

@@ -0,0 +1,28 @@
#ifndef RESISTIVE_TOUCH_H
#define RESISTIVE_TOUCH_H
#include <stdbool.h>
#include <stdint.h>
#define TOUCH_WIDTH 320
#define TOUCH_HEIGHT 240
#define TOUCH_PIN_MOSI 11
#define TOUCH_PIN_SCLK 12
#define TOUCH_PIN_CS 7
#define TOUCH_PIN_IRQ 2
#define TOUCH_PIN_MISO 13
typedef struct {
uint16_t x;
uint16_t y;
uint16_t raw_x;
uint16_t raw_y;
bool pressed;
} resistive_touch_point_t;
void resistive_touch_init(void);
bool resistive_touch_read(resistive_touch_point_t *point);
bool resistive_touch_read_raw(uint16_t *x, uint16_t *y);
bool resistive_touch_is_pressed(void);
#endif