TOP Contributors

  1. MIKROE (2662 codes)
  2. Alcides Ramos (357 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 (137043 times)
  2. FAT32 Library (70168 times)
  3. Network Ethernet Library (56043 times)
  4. USB Device Library (46365 times)
  5. Network WiFi Library (41981 times)
  6. FT800 Library (41313 times)
  7. GSM click (29080 times)
  8. mikroSDK (26520 times)
  9. PID Library (26454 times)
  10. microSD click (25449 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

Cap Touch 2 click

Rating:

5

Author: MIKROE

Last Updated: 2018-07-06

Package Version: 1.0.0.0

mikroSDK Library: 1.0.0.0

Category: Proximity

Downloaded: 4284 times

Not followed.

License: MIT license  

Cap Touch 2 click is a capacitive touch sensing click board, with the advanced touch/proximity sensor IC, based on the proprietary RightSense technology from Microchip. Cap Touch 2 click has six touch sensitive channels and six independent LED drivers with several operating modes, including touch sensor linking.

No Abuse Reported

Do you want to subscribe in order to receive notifications regarding "Cap Touch 2 click" changes.

Do you want to unsubscribe in order to stop receiving notifications regarding "Cap Touch 2 click" changes.

Do you want to report abuse regarding "Cap Touch 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

Cap Touch 2 click

Cap Touch 2 click

Native view of the Cap Touch 2 click board.

View full image
Cap Touch 2 click

Cap Touch 2 click

Front and back view of the Cap Touch 2 click board.

View full image

Library Description

The library initializes and defines SPI bus driver and driver functions which offer a choice to write data in registers and to read data from registers. The library also offers a choice to detect touch on enabled sensor inputs in two possible modes, Active and Standby mode. 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 captouch2_writeReg( const uint8_t register_address, const uint8_t transfer_data ) - The function writes one byte to register.

void captouch2_readReg( const uint8_t register_address, uint8_t *dataOut, const uint8_t nBytes ) - The function reads data from the register.

void captouch2_detectTouch( uint8_t *inputSens ) - The function detects touch on sensor inputs and checks if touch is detected or if touch is released.

void captouch2_setActiveMode( const uint8_t analogGain, const uint8_t enInput ) - Function puts device in Active mode and enables desired inputs in Active mode.

Examples Description

The demo application is composed of three sections:

  • System Initialization - Initializes peripherals and pins.
  • Application Initialization - Initializes SPI driver and sets configuration for Cap Touch 2 click. Cap Touch 2 is configured to works in Active mode (Normal mode). All inputs are enabled in this mode. In this example, the interrupt will be generated when touch is detected and when touch is released. Also, inputs 4, 5 and 6 will generate an interrupt as long as the touch is detected (press and hold event), while inputs 1, 2 and 3 will generate interrupt only once on one touch detection, after which the touch will be released.
    Note: Standby mode should be used when fewer sensor inputs are enabled, and when they are programmed to have more sensitivity.
  • Application Task - (code snippet) - Calls function to check touch detection (is interrupt occurred) and shows a message on USB UART on which input touch is detected or on which input touch is released. Also turns on LED on which linked input interrupt occurred.
     
void applicationTask()
{
 captouch2_detectTouch( &sensorResults[0] );
 for (cnt = 0; cnt < 6; 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 if (cnt == 2)
 mikrobus_logWrite( "Input 3 is touched", _LOG_LINE );
 else if (cnt == 3)
 mikrobus_logWrite( "Input 4 is touched", _LOG_LINE );
 else if (cnt == 4)
 mikrobus_logWrite( "Input 5 is touched", _LOG_LINE );
 else
 mikrobus_logWrite( "Input 6 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 if (cnt == 2)
 mikrobus_logWrite( "Input 3 is released", _LOG_LINE );
 else if (cnt == 3)
 mikrobus_logWrite( "Input 4 is released", _LOG_LINE );
 else if (cnt == 4)
 mikrobus_logWrite( "Input 5 is released", _LOG_LINE );
 else
 mikrobus_logWrite( "Input 6 is released", _LOG_LINE );
 mikrobus_logWrite( "", _LOG_LINE );
 }
 }
}

Other mikroE libraries used in the example:

  • SPI
  • UART

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.

ALSO FROM THIS AUTHOR

Cap Extend click

0

Cap Extend click is a mikroBUS add-on board with a SEMTECH SX8633 low power, capacitive button touch controller. It has 12 pins for connecting capacitive inputs (either touch-buttons or proximity sensors).

[Learn More]

Water Detect 2 click

0

Water Detect 2 Click is a compact add-on board that can detect the presence/flow of a liquid in a clear tube. This board features the OPB350L250, a tube liquid sensor from TT Electronics. Water Detect 2 Click has multiple output states and can recognize fluid present, no fluid present, and no tube present. This sensor excepts 1/4” tubing (6.3mm) as an outside diameter of the clear tubes, regardless of the direction of the liquid’s flow.

[Learn More]

PROFET 2 3A click

0

PROFET 2 Click is a compact add-on board that contains a smart high-side power switch. This board features the BTS70802EPAXUMA1, a dual-channel, high-side power switch with embedded protection and diagnosis feature from Infineon Technologies.

[Learn More]