Skip to content
This repository was archived by the owner on Jun 9, 2025. It is now read-only.

Commit 4e5470f

Browse files
committed
Library for TouchPad click
0 parents  commit 4e5470f

File tree

285 files changed

+55776
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

285 files changed

+55776
-0
lines changed

README.md

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
![MikroE](http://www.mikroe.com/img/designs/beta/logo_small.png)
2+
3+
---
4+
5+
# Touchpad Click
6+
7+
- **CIC Prefix** : TOUCHPAD
8+
- **Author** : MikroE Team
9+
- **Verison** : 1.0.0
10+
- **Date** : Jul 2018.
11+
12+
---
13+
14+
15+
### Software Support
16+
17+
We provide a library for the Touchpad Click on our [LibStock](https://libstock.mikroe.com/projects/view/1634/touchpad-click)
18+
page, as well as a demo application (example), developed using MikroElektronika
19+
[compilers](http://shop.mikroe.com/compilers). The demo can run on all the main
20+
MikroElektronika [development boards](http://shop.mikroe.com/development-boards).
21+
22+
**Library Description**
23+
24+
The library contains all the functions required to operate the Touchpad click.
25+
26+
Key functions :
27+
28+
- ``` void touchpad_getPosition( T_touchpad_touchPoint *posData ) ``` - Gets coordinate X and Y of touch and puts them in structure touch_point
29+
- ``` void touchpad_readRegister( uint8_t rAddr, uint8_t *buffer) ``` - Reads register on rAddr address and returns value through buffer
30+
- ``` void touchpad_writeGesture( uint8_t _data, char *str ) ``` - Writes gesture through *str based on red value _data
31+
- ``` void touchpad_readBytes( uint8_t rAddr, uint8_t *buffer, uint8_t nBytes) ``` - Reads register for more bytes on consecutive addresses and returns value through buffer
32+
33+
**Examples Description**
34+
35+
The application is composed of three sections :
36+
37+
- System Initialization - Initializes I2C module and sets INT pin as OUTPUT and RST pin as INPUT.
38+
- Application Initialization - Initializes driver init.
39+
- Application Task - (code snippet) - Reads every touch and gesture and logs to USBUART_A.
40+
41+
```.c
42+
void applicationTask()
43+
{
44+
Delay_ms( 50 );
45+
touchpad_readRegister( _TOUCHPAD_TOUCHSTATE, &touchpad_data );
46+
if( (touchpad_data & _TOUCHPAD_TOUCH_ONLY) != 0 )
47+
{
48+
mikrobus_logWrite( "", _LOG_LINE );
49+
touchpad_getPosition( &touchpad_posData );
50+
WordToStr( touchpad_posData.posX, touchpad_text );
51+
mikrobus_logWrite( "Position X: ", _LOG_TEXT );
52+
mikrobus_logWrite( touchpad_text, _LOG_LINE );
53+
WordToStr( touchpad_posData.posY, touchpad_text );
54+
mikrobus_logWrite( "Position Y: ", _LOG_TEXT );
55+
mikrobus_logWrite( touchpad_text, _LOG_LINE );
56+
mikrobus_logWrite( "-----------", _LOG_LINE );
57+
Delay_ms( 50 );
58+
}
59+
else if( (touchpad_data & _TOUCHPAD_GESTURE) != 0 )
60+
{
61+
Delay_ms( 50 );
62+
touchpad_readRegister( _TOUCHPAD_GESTURESTATE, &touchpad_data );
63+
if( touchpad_data != _TOUCHPAD_NO_GESTURE_PRESENT )
64+
{
65+
touchpad_writeGesture( touchpad_data, &touchpad_text );
66+
mikrobus_logWrite( touchpad_text , _LOG_LINE );
67+
}
68+
}
69+
}
70+
```
71+
72+
The full application code, and ready to use projects can be found on our
73+
[LibStock](https://libstock.mikroe.com/projects/view/1634/touchpad-click) page.
74+
75+
Other mikroE Libraries used in the example:
76+
77+
- I2C
78+
79+
**Additional notes and informations**
80+
81+
Depending on the development board you are using, you may need
82+
[USB UART click](http://shop.mikroe.com/usb-uart-click),
83+
[USB UART 2 Click](http://shop.mikroe.com/usb-uart-2-click) or
84+
[RS232 Click](http://shop.mikroe.com/rs232-click) to connect to your PC, for
85+
development systems with no UART to USB interface available on the board. The
86+
terminal available in all Mikroelektronika
87+
[compilers](http://shop.mikroe.com/compilers), or any other terminal application
88+
of your choice, can be used to read the message.
89+
90+
---
91+
---

0 commit comments

Comments
 (0)