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-04-23
Package Version: 1.0.0.0
mikroSDK Library: 1.0.0.0
Category: Capacitive
Downloaded: 5035 times
Not followed.
License: MIT license
Touch Key 4 click is a capacitive touch sensing Click board, with the advanced touch/proximity sensor IC. Touch Key 4 click has three independently configurable channels and can work in several operating modes, including multiple button pattern detection mode, combo mode, press and hold detection mode, power button mode, and more.
Do you want to subscribe in order to receive notifications regarding "TouchKey 4 click" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "TouchKey 4 click" changes.
Do you want to report abuse regarding "TouchKey 4 click".
Library Description
The library initializes and defines I2C bus driver and driver functions which offer a choice to write data in the registers and to read data from the registers. The library also offers a choice to detect touch on enabled sensor inputs in two possible modes, Active and Standby mode.
Every sensor input can be configured to work in both modes at the same time (Combo mode). The sensor inputs can also be configured to detect when touch is released and can generate an interrupt as long as the touch is detected. For more details check the documentation.
Key functions:
void touchkey4_writeReg( const uint8_t register_address, const uint8_t transfer_data ) - The function writes one-byte data in the register.
void touchkey4_readReg( const uint8_t register_address, uint8_t *dataOut, const uint8_t nBytes ) - The function reads data from the register.
void touchkey4_detectTouch( uint8_t *inputSens ) - The function detects touch on the sensor inputs and checks if touch is detected or if touch is released.
void touchkey4_setComboMode( const uint8_t analogGain, const uint8_t enInput1, const uint8_t enInput2, const uint8_t enInput3 ) - Function puts the device in Combo mode (Active and Standby) and enables desired inputs in Active mode, Standby mode or both modes.
Examples Description
void applicationTask() { touchkey4_detectTouch( &sensorResults[0] ); for (cnt = 0; cnt < 3; cnt++) { if (sensorResults[ cnt ] == 1) { if (cnt == 0) mikrobus_logWrite( "Input 1 is touched", _LOG_LINE ); else if (cnt == 1) mikrobus_logWrite( "Input 2 is touched", _LOG_LINE ); else mikrobus_logWrite( "Input 3 is touched", _LOG_LINE ); } else if (sensorResults[ cnt ] == 2) { if (cnt == 0) mikrobus_logWrite( "Input 1 is released", _LOG_LINE ); else if (cnt == 1) mikrobus_logWrite( "Input 2 is released", _LOG_LINE ); else mikrobus_logWrite( "Input 3 is released", _LOG_LINE ); mikrobus_logWrite( "", _LOG_LINE ); } } }
Other mikroE 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.