picofuse

ft6236.h
Go to the documentation of this file.
1 
10 #pragma once
11 
12 #include <picofuse/hw.h>
13 #include <stdbool.h>
14 #include <stdint.h>
15 
17 // TYPES
18 
23 typedef struct dev_ft6236_t dev_ft6236_t;
24 
33 #define DEV_FT6236_I2C_ADDR_DEFAULT 0x38u
34 
39 #define DEV_FT6236_MAX_POINTS 2u
40 
45 typedef struct {
48 
53 typedef enum {
58 
63 typedef struct {
65  uint8_t id;
66  uint16_t x;
67  uint16_t y;
69 
71 // LIFECYCLE
72 
82 
95  const dev_ft6236_config_t *config);
96 
104 void dev_ft6236_deinit(dev_ft6236_t *ft6236);
105 
108 // PROPERTIES
110 
121 bool dev_ft6236_irq_active(const dev_ft6236_t *ft6236);
122 
125 // METHODS
127 
146 bool dev_ft6236_poll(dev_ft6236_t *ft6236,
148  uint8_t *out_touch_count);
149 
uint16_t x
X coordinate, in panel pixels.
Definition: ft6236.h:66
struct hw_deviceio_t hw_deviceio_t
Opaque device I/O handle.
Definition: deviceio.h:48
struct hw_gpio_t hw_gpio_t
GPIO logical pin structure.
Definition: gpio.h:50
A single touch contact.
Definition: ft6236.h:63
struct dev_ft6236_t dev_ft6236_t
Opaque FT6236 handle.
Definition: ft6236.h:23
dev_ft6236_touch_event_t
Touch contact state reported by dev_ft6236_poll().
Definition: ft6236.h:53
Contact lifted - no longer touching.
Definition: ft6236.h:54
dev_ft6236_touch_event_t event
Contact state for this touch slot.
Definition: ft6236.h:64
Hardware abstraction headers for on-board peripherals.
A new contact.
Definition: ft6236.h:55
An existing contact moved.
Definition: ft6236.h:56
uint8_t id
Touch/track ID assigned by the controller.
Definition: ft6236.h:65
bool dev_ft6236_irq_active(const dev_ft6236_t *ft6236)
Report whether the FT6236 interrupt line is currently asserted.
#define DEV_FT6236_MAX_POINTS
Maximum number of simultaneous touch contacts reported by FT6236.
Definition: ft6236.h:39
bool dev_ft6236_poll(dev_ft6236_t *ft6236, dev_ft6236_touch_t touches[DEV_FT6236_MAX_POINTS], uint8_t *out_touch_count)
Poll the controller and parse the latest touch frame.
uint16_t y
Y coordinate, in panel pixels.
Definition: ft6236.h:67
bool irq_active_low
True when the interrupt pin is active low.
Definition: ft6236.h:46
void dev_ft6236_default_config(dev_ft6236_config_t *config)
Fill an FT6236 config struct with safe defaults.
Optional FT6236 initialization options.
Definition: ft6236.h:45
dev_ft6236_t * dev_ft6236_init(hw_deviceio_t *device, hw_gpio_t *int_pin, const dev_ft6236_config_t *config)
Initialize an FT6236-compatible touch controller over I2C.
void dev_ft6236_deinit(dev_ft6236_t *ft6236)
Deinitialize an FT6236 controller.