8x8 R 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 : Stefan Ilic
- Date : Jun 2021.
- Type : SPI type
This demo example shows a drawing of Image, new create string and character on the screen.
- MikroSDK.Board
- MikroSDK.Log
- Click.8x8R
c8x8r_cfg_setup
Config Object Initialization function.
void c8x8r_cfg_setup ( c8x8r_cfg_t *cfg );
c8x8r_init
Initialization function.
err_t c8x8r_init ( c8x8r_t *ctx, c8x8r_cfg_t *cfg );
c8x8r_default_cfg
Click Default Configuration function.
void c8x8r_default_cfg ( c8x8r_t *ctx );
c8x8r_write_cmd
This function writes a desired number of data bytes starting from the selected register by using SPI serial interface.
void c8x8r_write_cmd ( c8x8r_t *ctx, uint8_t cmd, uint8_t tx_data );
c8x8r_display_refresh
The function switches off all LEDs.
void c8x8r_display_refresh ( c8x8r_t *ctx );
c8x8r_display_byte
This function displayes one character to the display.
void c8x8r_display_byte ( c8x8r_t *ctx, char tx_byte );
Configuring Clicks and log objects. Settings the Click in the default configuration.
void application_init ( void )
{
log_cfg_t log_cfg; /**< Logger config object. */
c8x8r_cfg_t c8x8r_cfg; /**< Click config object. */
/**
* 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.
c8x8r_cfg_setup( &c8x8r_cfg );
C8X8R_MAP_MIKROBUS( c8x8r_cfg, MIKROBUS_1 );
err_t init_flag = c8x8r_init( &c8x8r, &c8x8r_cfg );
if ( init_flag == SPI_MASTER_ERROR ) {
log_error( &logger, " Application Init Error. " );
log_info( &logger, " Please, run program again... " );
for ( ; ; );
}
c8x8r_default_cfg ( &c8x8r );
log_info( &logger, " Application Task " );
Delay_1sec( );
}
Shows one byte, then scrolls the string and image, every 1 sec.
void application_task ( void )
{
c8x8r_display_byte( &c8x8r, demo_char );
Delay_ms ( 1000 );
c8x8r_display_string( &c8x8r, &demo_string[ 0 ] );
Delay_ms ( 1000 );
c8x8r_display_image( &c8x8r, &demo_img_on[ 0 ] );
Delay_ms ( 500 );
c8x8r_display_image( &c8x8r, &demo_img_off[ 0 ] );
Delay_ms ( 1000 );
}
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.