Thunder EMU Click
Thunder EMU Click demo application is developed using the NECTO Studio, ensuring compatibility with mikroSDK's open-source libraries and tools. Designed for plug-and-play implementation and testing, the demo is fully compatible with all development, starter, and mikromedia boards featuring a mikroBUS™ socket.
Click Library
- Author : Stefan Filipovic
- Date : Sep 2023.
- Type : I2C type
Software Support
Example Description
This example demonstrates the use of Thunder EMU Click board by generating CLOSE, MID, or FAR range thunder signal depending on the Click push-buttons state.
Example Libraries
- MikroSDK.Board
- MikroSDK.Log
- Click.ThunderEMU
Example Key Functions
- thunderemu_cfg_setup Config Object Initialization function.
void thunderemu_cfg_setup(thunderemu_cfg_t *cfg)
Thunder EMU configuration object setup function.
Thunder EMU Click configuration object.
Definition thunderemu.h:159
- thunderemu_init Initialization function.
err_t thunderemu_init(thunderemu_t *ctx, thunderemu_cfg_t *cfg)
Thunder EMU initialization function.
Thunder EMU Click context object.
Definition thunderemu.h:137
- thunderemu_default_cfg Click Default Configuration function.
err_t thunderemu_default_cfg(thunderemu_t *ctx)
Thunder EMU default configuration function.
- thunderemu_generate_thunder This function generates close, mid or far range thunder signal by setting the predefined DAC output profile at the specific timing.
err_t thunderemu_generate_thunder(thunderemu_t *ctx, uint8_t mode)
Thunder EMU generate thunder function.
- thunderemu_get_close_pin This function returns the CLOSE pin logic state.
uint8_t thunderemu_get_close_pin(thunderemu_t *ctx)
Thunder EMU get close pin function.
- thunderemu_get_mid_pin This function returns the MID pin logic state.
uint8_t thunderemu_get_mid_pin(thunderemu_t *ctx)
Thunder EMU get mid pin function.
Application Init
Initializes the driver and performs the Click default configuration.
{
log_cfg_t log_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}
#define THUNDEREMU_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition thunderemu.h:121
void application_init(void)
Definition main.c:35
@ THUNDEREMU_ERROR
Definition thunderemu.h:180
Application Task
Checks if any of the Click board buttons are pressed and then generates a thunder signal related to the pressed button and displays an appropriate message on the USB UART.
{
{
{
log_printf( &logger, " Close range thunder signal generated!\r\n\n" );
Delay_ms ( 500 );
}
}
{
{
log_printf( &logger, " Mid range thunder signal generated!\r\n\n" );
Delay_ms ( 500 );
}
}
{
{
log_printf( &logger, " Far range thunder signal generated!\r\n\n" );
Delay_ms ( 500 );
}
}
}
#define THUNDEREMU_MODE_FAR
Definition thunderemu.h:75
#define THUNDEREMU_MODE_MID
Definition thunderemu.h:74
#define THUNDEREMU_MODE_CLOSE
Thunder EMU mode setting.
Definition thunderemu.h:73
uint8_t thunderemu_get_far_pin(thunderemu_t *ctx)
Thunder EMU get far pin function.
void application_task(void)
Definition main.c:71
@ THUNDEREMU_OK
Definition thunderemu.h:179
Note
Thunder EMU Click should be used in combination with a Thunder Click which detects a lightning presence. The emulator is calibrated for ranges of up to 15cm from the sensor board. It's recommended to distant both Click boards from their development boards using a Shuttle Click to reduce the board noise that can affect the sensor and emulator performance.
Application Output
This Click board can be interfaced and monitored in two ways:
- Application Output - Use the "Application Output" window in Debug mode for real-time data monitoring. Set it up properly by following this tutorial.
- UART Terminal - Monitor data via the UART Terminal using a USB to UART converter. For detailed instructions, check out this tutorial.
Additional Notes and Information
The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.