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: 2019-05-17
Package Version: 1.0.0.2
mikroSDK Library: 1.0.0.0
Category: Capacitive
Downloaded: 4616 times
Not followed.
License: MIT license
TouchKey 2 click has four capacitive pads powered by ATtiny817 which has an integrated touch QTouch® controller. The click is designed to run on a 3.3V power supply. The four LEDs onboard the click indicate the Key (Pad) is pressed. TouchKey 2 click communicates with the target microcontroller over UART and SPI interface.
Do you want to subscribe in order to receive notifications regarding "TouchKey 2 click" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "TouchKey 2 click" changes.
Do you want to report abuse regarding "TouchKey 2 click".
Library Description
Defines and initializes driver's UART bus. Declares and defines driver's functions for sending and receiving data bytes, also for checking if data byte ready for reading. It also offers set, clear reset pin and target reset functions.
Key functions:
uint8_t touchkey2_readByte()
- Read received byte.uint8_t touchkey2_byteReady()
- Checks is there a new byte received.void touchkey2_targetReset()
- Function is used to reset the device.Examples description
The application is composed of the three sections :
void applicationTask( ) { char tmp; uint8_t rdyFlag; rdyFlag = touchkey2_byteReady(); if (1 == rdyFlag) { tmp = touchkey2_readByte(); if( tmp == 0x00 ) { mikrobus_logWrite( " Key released ", _LOG_LINE ); mikrobus_logWrite( "-------------------", _LOG_LINE ); } else if( tmp == 0x01 ) { mikrobus_logWrite( " Key A pressed", _LOG_LINE ); mikrobus_logWrite( "-------------------", _LOG_LINE ); } else if( tmp == 0x02 ) { mikrobus_logWrite( " Key B pressed", _LOG_LINE ); mikrobus_logWrite( "-------------------", _LOG_LINE ); } else if( tmp == 0x04 ) { mikrobus_logWrite( " Key C pressed", _LOG_LINE ); mikrobus_logWrite( "-------------------", _LOG_LINE ); } else if( tmp == 0x08 ) { mikrobus_logWrite( " Key D pressed", _LOG_LINE ); mikrobus_logWrite( "-------------------", _LOG_LINE ); } else { mikrobus_logWrite( " Error!!! ", _LOG_LINE ); touchkey2_targetReset(); }
Other mikroE Libraries used in the example:
UART
Additional notes and informations
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.