Core2 for AWS IoT EduKit BSP 1.5.1
Macros | Functions
ft6336u.c File Reference
#include "stdio.h"
#include "stdbool.h"
#include "driver/gpio.h"
#include "freertos/FreeRTOS.h"
#include "freertos/semphr.h"
#include "ft6336u.h"
#include "i2c_device.h"

Macros

#define FT6336U_I2C_ADDR   0x38
 
#define FT6336U_INTR_PIN   39
 

Functions

void FT6336U_Init ()
 Initializes the FT6336U over I2C. More...
 
void FT6336U_GetTouch (uint16_t *x, uint16_t *y, bool *press_down)
 Retrieves the most recent touch data from the FT6336U. More...
 
bool FT6336U_WasPressed ()
 Retrieves the pressed state of the touch screen. More...
 
uint16_t FT6336U_GetPressPosX ()
 Retrieves the X-coordinate of the screen press. More...
 
uint16_t FT6336U_GetPressPosY ()
 Retrieves the Y-coordinate of the screen press. More...
 

Macro Definition Documentation

◆ FT6336U_I2C_ADDR

#define FT6336U_I2C_ADDR   0x38

◆ FT6336U_INTR_PIN

#define FT6336U_INTR_PIN   39

Function Documentation

◆ FT6336U_Init()

void FT6336U_Init ( )

Initializes the FT6336U over I2C.

Note
The Core2ForAWS_Init() calls this function when the hardware feature is enabled.
It creates a FreeRTOS task with the task name FT6336Task and installs an ISR on the interrupt pin FT6336U_INTR_PIN.

The most recent button press state is stored within the library and can be queried using the functions provided by this library.

The FreeRTOS task remains suspended and only resumes when the screen is pressed (which is informed by the FT6336U using the interrupt on the FT6336U_INTR_PIN). If multiple press events are stashed by the hardware, the FreeRTOS task keeps retrieving them one by one at an interval of 20 ticks. Once all the events are retrieved, the task suspends itself.

◆ FT6336U_GetTouch()

void FT6336U_GetTouch ( uint16_t *  x,
uint16_t *  y,
bool *  press_down 
)

Retrieves the most recent touch data from the FT6336U.

Example:

Print the touch coordinates and if the screen is currently being pressed.

uint16_t x, y;
bool press;
FT6336U_GetTouch(&x, &y, &press);
printf( "X: %d, Y: %d, Pressed: %d", x, y, press);
void FT6336U_GetTouch(uint16_t *x, uint16_t *y, bool *press_down)
Retrieves the most recent touch data from the FT6336U.
Definition: ft6336u.c:66
Parameters
[in]xThe X-coordinate of the touch input.
[in]yThe Y-coordinate of the touch input.
[in]press_downThe pressed state of the touch screen.

◆ FT6336U_WasPressed()

bool FT6336U_WasPressed ( )

Retrieves the pressed state of the touch screen.

Returns
The screen pressed state.

◆ FT6336U_GetPressPosX()

uint16_t FT6336U_GetPressPosX ( )

Retrieves the X-coordinate of the screen press.

Returns
The X-coordinate of the screen press.

◆ FT6336U_GetPressPosY()

uint16_t FT6336U_GetPressPosY ( )

Retrieves the Y-coordinate of the screen press.

Returns
The Y-coordinate of the screen press.