#ifndef __TOUCH_H
#define __TOUCH_H

#include <stdint.h>
#include <wiringPi.h>
#include <wiringPiI2C.h>

// I2C Address
#define CST816D_ADDR 0x15

// BCM Pin Numbers
#define TOUCH_INT_PIN  0//BCM 17
#define TOUCH_RST_PIN  2//BCM 27

// Registers
#define CST816D_REG_GESTURE 0x01
#define CST816D_REG_FINGER  0x02
#define CST816D_REG_X_HIGH  0x03
#define CST816D_REG_X_LOW   0x04
#define CST816D_REG_Y_HIGH  0x05
#define CST816D_REG_Y_LOW   0x06

typedef struct {
    uint16_t x;
    uint16_t y;
    uint8_t  pressed; 
} TouchPoint;

void Touch_Init(void);
uint8_t Touch_Read_Point(TouchPoint *point);

#endif
