#include "glcd_types.h"
#include "types.h"
Go to the source code of this file.
◆ TP_AssignButtonArea()
Assigns a button area to the given button.
- Parameters
-
button | The button to assign the area to. |
pos | The position of the button. |
- Returns
- The button area.
Definition at line 436 of file touch.c.
437{
440 .comps =
444 .pos = pos,
445 .object.button = &button,
446 },
447 },
448 };
449
452 {
454 }
455
457 .pos = pos,
460 };
461}
LCD_Error LCD_CalcBBoxForObject(const LCD_Obj *const obj, LCD_BBox *out_bbox)
Returns the bounding box of a temporary object.
@ LCD_ERR_OK
No error occurred.
LCD_Coordinate bottom_right
Used to store a drawable component of any type.
Represents a generic object, made up of 1 or more basic components, that are rendered on the screen.
◆ TP_Calibrate()
void TP_Calibrate |
( |
void |
| ) |
|
Blocks until calibration is completed successfully.
- Note
- This function is automatically called if skip_calibration is false in TP_Init.
Definition at line 399 of file touch.c.
400{
402 return;
403
405 ;
406}
_PRIVATE bool initialized
◆ TP_GetLCDCoordinateFor()
Converts the touch panel coordinates to LCD coordinates.
- Parameters
-
tp_point | The touch panel coordinates. |
- Returns
- The LCD coordinates, or NULL if either the touch panel is not initialized or tp_point = NULL.
Definition at line 419 of file touch.c.
420{
422 return NULL;
423
426 if (matrix.
divider == 0 || !tp_point)
427 return NULL;
428
429 lcd_point.
x = ((matrix.
a_n * tp_point->
x) + (matrix.
b_n * tp_point->
y) + matrix.
c_n) / matrix.
divider;
430 lcd_point.
y = ((matrix.
d_n * tp_point->
x) + (matrix.
e_n * tp_point->
y) + matrix.
f_n) / matrix.
divider;
431 return &lcd_point;
432}
_PRIVATE TP_CalibrationMatrix current_calib_matrix
Current calibration matrix.
◆ TP_HasButtonBeenPressed()
Checks if the given button area has been pressed during the touch event which occurred at the given touch point.
- Parameters
-
button | The button to check. |
touch_point | The touch point to check. |
- Returns
- True if the button has been pressed, false otherwise.
Definition at line 475 of file touch.c.
476{
477 if (!touch_point)
478 return false;
479
480
481
483 if (!touch_lcd_pos)
484 return false;
485
488 return between_w && between_h;
489}
const LCD_Coordinate * TP_GetLCDCoordinateFor(const TP_Coordinate *const tp_point)
Converts the touch panel coordinates to LCD coordinates.
#define IS_BETWEEN_EQ(value, low, hi)
◆ TP_Init()
void TP_Init |
( |
bool |
skip_calibration | ) |
|
Initializes the touch panel.
- Parameters
-
skip_calibration | If true, calibration is skipped. |
- Note
- If you skip calibration, the TP_WaitForTouch() could return incorrect values.
Definition at line 373 of file touch.c.
374{
375 LPC_GPIO0->FIODIR |= (1 << 6);
376 LPC_GPIO2->FIODIR |= (0 << 13);
378
381
382 if (skip_calibration)
383 return;
384
386
387}
_PRIVATE void spi_init(void)
Initializes the SPI interface for ADS7843.
void TP_Calibrate(void)
Blocks until calibration is completed successfully.
◆ TP_IsCalibrated()
bool TP_IsCalibrated |
( |
void |
| ) |
|
Definition at line 394 of file touch.c.
395{
397}
_PRIVATE bool calibratated
◆ TP_IsInitialized()
bool TP_IsInitialized |
( |
void |
| ) |
|
◆ TP_WaitForButtonPress()
Blocks until the given button area is pressed.
- Parameters
-
button | The button to wait for. |
Definition at line 463 of file touch.c.
464{
466 return;
467
469 do
470 {
473}
const TP_Coordinate * TP_WaitForTouch(void)
Blocks until a touch event is detected.
bool TP_HasButtonBeenPressed(TP_ButtonArea button, const TP_Coordinate *const touch_point)
Checks if the given button area has been pressed during the touch event which occurred at the given t...
◆ TP_WaitForTouch()
Blocks until a touch event is detected.
- Returns
- The X, Y coordinates of the touched point, or NULL if the touch panel is not initialized.
- Note
- If you call this function without first calibrating the panel, the returned value may be incorrect.
Definition at line 408 of file touch.c.
409{
411 return NULL;
412
415 ;
416 return &tp_coords;
417}
_PRIVATE bool poll_touch(TP_Coordinate *out_tp_coords)