16x12 G 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.
- Author : MikroE Team
- Date : Nov 2019.
- Type : I2C type
This application draw object with led diodes.
- MikroSDK.Board
- MikroSDK.Log
- Click.16x12
c16x12_cfg_setup
Config Object Initialization function.
void c16x12_cfg_setup ( c16x12_cfg_t *cfg );
c16x12_init
Initialization function.
err_t c16x12_init ( c16x12_t *ctx, c16x12_cfg_t *cfg );
c16x12_default_cfg
Click Default Configuration function.
void c16x12_default_cfg ( c16x12_t *ctx );
c16x12g_display_image
Functions for display Image .
void c16x12g_display_image( c16x12_t *ctx, uint16_t *pImage );
c16x12g_display_byte
Functions for display one Byte.
void c16x12g_display_byte( c16x12_t *ctx, char ch );
c16x12g_display_text
Functions for display text with scroll .
void c16x12g_display_text( c16x12_t *ctx, char *p_text, uint8_t n_char, uint8_t speed );
Initialization default device configuration, sets LED mode, configuration ABM and display one character.
void application_init ( void )
{
log_cfg_t log_cfg;
c16x12_cfg_t cfg;
/**
* Logger initialization.
* Default baud rate: 115200
* Default log level: LOG_LEVEL_DEBUG
* @note If USB_UART_RX and USB_UART_TX
* are defined as HAL_PIN_NC, you will
* need to define them manually for log to work.
* See @b LOG_MAP_USB_UART macro definition for detailed explanation.
*/
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, "---- Application Init ----" );
// Click initialization.
c16x12_cfg_setup( &cfg );
C16X12_MAP_MIKROBUS( cfg, MIKROBUS_1 );
c16x12_init( &c16x12, &cfg );
c16x12g_device_reset( &c16x12 );
Delay_ms ( 1000 );
c16x12_default_cfg( &c16x12 );
c16x12g_set_global_current_control( &c16x12, 255 );
c16x12g_set_leds_mode( &c16x12, C16X12G_LED_MODE_ABM1 );
abm_1.time_1 = C16X12G_ABM_T1_840MS;
abm_1.time_2 = C16X12G_ABM_T2_840MS;
abm_1.time_3 = C16X12G_ABM_T3_840MS;
abm_1.time_4 = C16X12G_ABM_T4_840MS;
abm_1.loop_begin = C16X12G_ABM_LOOP_BEGIN_T1;
abm_1.loop_end = C16X12G_ABM_LOOP_END_T3;
abm_1.loop_times = C16X12G_ABM_LOOP_FOREVER;
abm_2.time_1 = C16X12G_ABM_T1_210MS;
abm_2.time_2 = C16X12G_ABM_T2_0MS;
abm_2.time_3 = C16X12G_ABM_T3_210MS;
abm_2.time_4 = C16X12G_ABM_T4_0MS;
abm_2.loop_begin = C16X12G_ABM_LOOP_BEGIN_T1;
abm_2.loop_end = C16X12G_ABM_LOOP_END_T3;
abm_2.loop_times = C16X12G_ABM_LOOP_FOREVER;
c16x12g_configABM( &c16x12, C16X12G_ABM_NUM_1, &abm_1 );
c16x12g_startABM( &c16x12 );
c16x12g_displayByte( &c16x12, 'G' );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
c16x12g_configABM( &c16x12, C16X12G_ABM_NUM_1, &abm_2 );
c16x12g_startABM( &c16x12 );
}
Clear display, display one by one leds, display one character, display image and display text with scroll
void applicationTask ( void )
{
uint8_t cnt = 0;
c16x12g_clear_display( &c16x12 );
// Display point
for ( cnt = 1; cnt <= 12; cnt++ )
{
c16x12g_set_led( &c16x12, cnt, cnt, C16X12G_LED_STATE_ON, C16X12G_STOP_SETTINGS );
Delay_ms ( 200 );
}
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
c16x12g_display_byte( &c16x12, 'G' );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
c16x12g_display_image( &c16x12, &demo_image_light[ 0 ] );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
c16x12g_display_image( &c16x12, &demo_image_dark[ 0 ] );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
c16x12g_display_text( &c16x12, &demo_text[ 0 ], 16, scroll_speed );
}
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.
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.