TOP Contributors

  1. MIKROE (2659 codes)
  2. Alcides Ramos (356 codes)
  3. Shawon Shahryiar (307 codes)
  4. jm_palomino (112 codes)
  5. Chisanga Mumba (90 codes)
  6. S P (73 codes)
  7. dany (71 codes)
  8. MikroBUS.NET Team (35 codes)
  9. NART SCHINACKOW (34 codes)
  10. Armstrong Subero (27 codes)

Most Downloaded

  1. Timer Calculator (136987 times)
  2. FAT32 Library (70100 times)
  3. Network Ethernet Library (56023 times)
  4. USB Device Library (46345 times)
  5. Network WiFi Library (41961 times)
  6. FT800 Library (41274 times)
  7. GSM click (29051 times)
  8. mikroSDK (26489 times)
  9. PID Library (26447 times)
  10. microSD click (25411 times)
Libstock prefers package manager

Package Manager

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]

< Back
mikroSDK Library

TouchKey 2 click

Rating:

1

Author: MIKROE

Last Updated: 2019-05-17

Package Version: 1.0.0.2

mikroSDK Library: 1.0.0.0

Category: Capacitive

Downloaded: 4223 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.

No Abuse Reported

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".

  • mikroSDK Library 2.0.0.0
  • Comments (0)
DOWNLOAD LINK RELATED COMPILER CONTAINS
mikroBasic PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroBasic PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroC PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for ARM
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for AVR
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for dsPIC30/33 & PIC24
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for FT90x
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for PIC
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc
mikroPascal PRO for PIC32
  • lib
  • src
  • exa
  • hlp
  • hex
  • sch
  • pcb
  • doc

mikroSDK Library Blog

TouchKey 2 click

TouchKey 2 click

Front and back view of the TouchKey 2 click board.

View full image

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 :

  • System Initialization - Initializes UART and LOG structures and sets CS as output.
  • Application Initialization - Initalizes UART driver and makes an initial log.
  • Application Task - (code snippet) Checks if new data byte have received in rx buffer (ready for reading), and if ready than reads one byte from rx buffer, that show if and what key is pressed.
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 clickUSB 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.

ALSO FROM THIS AUTHOR

SPIRIT click

0

SPIRIT click carries the SP1ML 868MHz ultra low-power RF module. The board is designed to use 3.3V power supply and 3.3V or 5V I/O voltage levels. It communicates with the target MCU over UART interface, with additional functionality provided by the following pins on the mikroBUS™ line: PWM, RST, CS.

[Learn More]

GSM 2 click

7

GSM2 Click is a board in mikroBUSâ„¢ form factor which is a solution for adding GSM/GPRS communication layer to your device. It features Quectel M95 GSM/GPRS module which supports most GSM quad-band frequencies with 85.6 kbps GPRS data transfer.

[Learn More]

Flash 2 click

7

Flash 2 click is a mikroBUS add-on board for adding more Flash Memory to your target board microcontroller. It carries Microchip’s SST26VF064B flash-memory module with 64 Mbits capacity. It’s a highly reliable module with a specified minimum of 100,000 read and write cycles and with over 100 years of Data Retention.

[Learn More]