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-10-04
Package Version: 1.0.0.0
mikroSDK Library: 1.0.0.0
Category: Capacitive
Downloaded: 3267 times
Not followed.
License: MIT license
Power/Reset Click is equipped with two capacitive touch pads on a single click boardâ„¢. It can be activated by touch, and unlike the mechanical button, the capacitive touch button lasts much longer, it is not prone to damage and wear over time and it is very reliable.
Do you want to subscribe in order to receive notifications regarding "Power/Reset click" changes.
Do you want to unsubscribe in order to stop receiving notifications regarding "Power/Reset click" changes.
Do you want to report abuse regarding "Power/Reset click".
Library Description
This library allows user to check which button is pressed or activated. Also initializes GPIO driver. For more details check documentation.
Key functions:
void touchbutt_gpioDriverInit(T_TOUCHBUTT_P gpioObj)
- This function initializes GPIO driver.T_TOUCHBUTT_STATE touchbutt_getPWR( void )
- This function returns a state of the PWR pin (ON/OFF button).T_TOUCHBUTT_STATE touchbutt_getRST( void )
- This function returns a state of the RST pin (RESET button).Examples description
The application is composed of three sections :
void applicationTask()
{
pwr_state = touchbutt_getPWR();
rst_state = touchbutt_getRST();
if ((pwr_state == _TOUCHBUTT_ACTIVE) && (time_cnt_prev != time_cnt) && (rst_state == _TOUCHBUTT_INACTIVE))
{
time_val_dec = time_cnt / 10;
time_val_real = time_cnt % 10;
LongWordToStr( time_val_dec, text );
Ltrim( text );
mikrobus_logWrite( text, _LOG_TEXT );
mikrobus_logWrite( ".", _LOG_TEXT );
ByteToStr( time_val_real, text );
Ltrim( text );
mikrobus_logWrite( text, _LOG_LINE );
if ((time_val_dec >= target_time) && (alarm_flag == _TOUCHBUTT_ACTIVE))
{
mikrobus_logWrite( "** Target time is reached! **", _LOG_LINE );
alarm_flag = _TOUCHBUTT_INACTIVE;
Sound_Play( 1000, 50 );
Delay_ms( 40 );
Sound_Play( 1000, 50 );
Delay_ms( 40 );
}
}
if (rst_state == _TOUCHBUTT_ACTIVE)
{
time_cnt = 0;
alarm_flag = _TOUCHBUTT_ACTIVE;
}
else
{
time_cnt_prev = time_cnt;
}
}
The full application code, and ready to use projects can be found on our LibStock page.
Other mikroE Libraries used in the example:
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.