We strongly encourage users to use Package manager for sharing their code on Libstock website, because it boosts your efficiency and leaves the end user with no room for error. [more info]
Rating:
Author: MIKROE
Last Updated: 2018-03-13
Package Version: 1.0.0.0
mikroSDK Library: 1.0.0.0
Category: Capacitive
Downloaded: 5303 times
Not followed.
License: MIT license
TouchKey 3 click is equipped with advanced capacitive sensors, based on the proprietary QTouch technology, that can be used to sense touch on 7 different keys.
Do you want to subscribe in order to receive notifications regarding "TouchKey 3 click" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "TouchKey 3 click" changes.
Do you want to report abuse regarding "TouchKey 3 click".
Library Description
The library contains functions that communicate with TouchKey 3 click via SPI interface. It covers all the modes of communication with the click that are available.
Key functions
uint8_t touchkey3_sendCommand(uint8_t command) - Sends a command to TouchKey 3 click
uint8_t touchkey3_sendRequest(uint8_t request, uint8_t * pResponse) - Retrieves a response to a request from TouchKey 3 click
uint8_t touchkey3_setData(uint8_t dataAddress, uint8_t writeData) - Writes data into configuration registers
Examples Description
The demo application is composed of three sections:
void applicationTask()
{
uint8_t returnData[ 2 ];
uint8_t counter;
uint8_t temp;
uint8_t text[ 20 ] = { 0 };
touchkey3_sendRequest( _TOUCHKEY3_REQ_ALL_KEYS, &returnData );
for (counter = 0; counter < 7; counter++)
{
if ((returnData[1] >> counter) & 0x01)
{
mikrobus_logWrite( "Touch detected on key ", _LOG_TEXT );
//Converts the key index into ascii character ( 0 - 7 -> '1' - '7')
temp = counter + 49;
WordToStr( temp, text );
mikrobus_logWrite( text, _LOG_TEXT );
mikrobus_logWrite( ".", _LOG_LINE );
Delay_ms( 1000 );
}
}
Delay_ms( 200 );
}
Other MikroElektronika libraries used in the example:
Additional notes and information
Depending on the development board you are using, you may need USB UART click, USB UART 2 click or RS232 click to connect to your PC, for development systems with no UART to USB interface available on the board. The terminal available in all MikroElektronika compilers, or any other terminal application of your choice, can be used to read the message.