ipsdisplay2  2.1.0.0
Main Page

IPS Display 2 click

PRVIH_PAR_RECENICA_SA_PRODUCT_PAGE_DA_ISPRATE_CELINU

[click Product page](CLICK_PRODUCT_PAGE_LINK)


Click library

  • Author : Stefan Filipovic
  • Date : Jan 2024.
  • Type : SPI type

Software Support

We provide a library for the IPS Display 2 Click as well as a demo application (example), developed using MikroElektronika compilers. The demo can run on all the main MikroElektronika development boards.

Package can be downloaded/installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.

Library Description

This library contains API for IPS Display 2 Click driver.

Standard key functions :

Example key functions :

Example Description

This example demonstrates the use of the IPS Display 2 click board by showing a practical example of using the implemented functions.

The demo application is composed of two sections :

Application Init

Initializes the driver and performs the click default configuration.

void application_init ( void )
{
log_cfg_t log_cfg;
ipsdisplay2_cfg_t ipsdisplay2_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, " Application Init " );
// Click initialization.
ipsdisplay2_cfg_setup( &ipsdisplay2_cfg );
IPSDISPLAY2_MAP_MIKROBUS( ipsdisplay2_cfg, MIKROBUS_1 );
if ( SPI_MASTER_ERROR == ipsdisplay2_init( &ipsdisplay2, &ipsdisplay2_cfg ) )
{
log_error( &logger, " Communication init." );
for ( ; ; );
}
if ( IPSDISPLAY2_ERROR == ipsdisplay2_default_cfg ( &ipsdisplay2 ) )
{
log_error( &logger, " Default configuration." );
for ( ; ; );
}
log_info( &logger, " Application Task " );
}

Application Task

Showcases the text writing example as well as drawing pictures and objects, and filling the whole screen with a desired color.

All data is logged on the USB UART where you can track the program flow.

void application_task ( void )
{
ipsdisplay2_point_t start_pt, end_pt;
#if IPSDISPLAY2_RESOURCES_INCLUDE_IMG
log_printf( &logger, " Drawing MIKROE logo example\r\n\n" );
ipsdisplay2_draw_picture ( &ipsdisplay2, IPSDISPLAY2_ROTATION_VERTICAL_0, ipsdisplay2_img_mikroe );
Delay_ms ( 3000 );
#endif
log_printf( &logger, " Writing text example\r\n\n" );
Delay_ms ( 1000 );
start_pt.x = 60;
start_pt.y = 70;
ipsdisplay2_write_string ( &ipsdisplay2, start_pt, " MIKROE ", IPSDISPLAY2_COLOR_RED );
start_pt.y += 20;
ipsdisplay2_write_string ( &ipsdisplay2, start_pt, " IPS display click", IPSDISPLAY2_COLOR_RED );
start_pt.y += 20;
ipsdisplay2_write_string ( &ipsdisplay2, start_pt, " 240x240px ", IPSDISPLAY2_COLOR_RED );
start_pt.y += 20;
ipsdisplay2_write_string ( &ipsdisplay2, start_pt, "ST7789V controller", IPSDISPLAY2_COLOR_RED );
start_pt.y += 20;
ipsdisplay2_write_string ( &ipsdisplay2, start_pt, " TEST EXAMPLE ", IPSDISPLAY2_COLOR_RED );
Delay_ms ( 3000 );
log_printf( &logger, " RGB fill screen example\r\n\n" );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
Delay_ms ( 1000 );
log_printf( &logger, " Drawing objects example\r\n\n" );
Delay_ms ( 1000 );
ipsdisplay2_draw_line ( &ipsdisplay2, start_pt, end_pt, IPSDISPLAY2_COLOR_BLUE );
Delay_ms ( 1000 );
ipsdisplay2_draw_line ( &ipsdisplay2, start_pt, end_pt, IPSDISPLAY2_COLOR_BLUE );
Delay_ms ( 1000 );
start_pt.x = 60;
start_pt.y = 40;
end_pt.x = 180;
end_pt.y = 100;
ipsdisplay2_draw_rectangle ( &ipsdisplay2, start_pt, end_pt, IPSDISPLAY2_COLOR_CYAN );
Delay_ms ( 1000 );
start_pt.y += 100;
end_pt.y += 100;
ipsdisplay2_draw_rectangle ( &ipsdisplay2, start_pt, end_pt, IPSDISPLAY2_COLOR_CYAN );
Delay_ms ( 1000 );
start_pt.x = 120;
start_pt.y = 120;
ipsdisplay2_draw_circle ( &ipsdisplay2, start_pt, start_pt.x, IPSDISPLAY2_COLOR_MAGENTA );
Delay_ms ( 2000 );
}

The full application code, and ready to use projects can be installed directly from NECTO Studio Package Manager(recommended way), downloaded from our LibStock™ or found on Mikroe github account.

Other Mikroe Libraries used in the example:

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.IPSDisplay2

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. UART terminal is available in all MikroElektronika compilers.


ipsdisplay2_t
IPS Display 2 Click context object.
Definition: ipsdisplay2.h:477
IPSDISPLAY2_ROTATION_VERTICAL_0
#define IPSDISPLAY2_ROTATION_VERTICAL_0
IPS Display 2 rotation setting.
Definition: ipsdisplay2.h:407
IPSDISPLAY2_POS_HEIGHT_MAX
#define IPSDISPLAY2_POS_HEIGHT_MAX
Definition: ipsdisplay2.h:387
IPSDISPLAY2_MAP_MIKROBUS
#define IPSDISPLAY2_MAP_MIKROBUS(cfg, mikrobus)
MikroBUS pin mapping.
Definition: ipsdisplay2.h:460
IPSDISPLAY2_ERROR
@ IPSDISPLAY2_ERROR
Definition: ipsdisplay2.h:532
ipsdisplay2_point_t::x
uint16_t x
Definition: ipsdisplay2.h:520
IPSDISPLAY2_POS_WIDTH_MAX
#define IPSDISPLAY2_POS_WIDTH_MAX
Definition: ipsdisplay2.h:385
IPSDISPLAY2_POS_HEIGHT_MIN
#define IPSDISPLAY2_POS_HEIGHT_MIN
Definition: ipsdisplay2.h:386
IPSDISPLAY2_POS_WIDTH_MIN
#define IPSDISPLAY2_POS_WIDTH_MIN
IPS Display 2 position and coordinates setting.
Definition: ipsdisplay2.h:384
application_task
void application_task(void)
Definition: main.c:67
IPSDISPLAY2_COLOR_MAGENTA
#define IPSDISPLAY2_COLOR_MAGENTA
Definition: ipsdisplay2.h:423
ipsdisplay2_point_t::y
uint16_t y
Definition: ipsdisplay2.h:521
ipsdisplay2_draw_line
err_t ipsdisplay2_draw_line(ipsdisplay2_t *ctx, ipsdisplay2_point_t start_pt, ipsdisplay2_point_t end_pt, uint16_t color)
IPS Display 2 draw line function.
IPSDISPLAY2_COLOR_RED
#define IPSDISPLAY2_COLOR_RED
Definition: ipsdisplay2.h:418
ipsdisplay2_point_t
IPS Display 2 Click point coordinates object.
Definition: ipsdisplay2.h:519
ipsdisplay2_draw_circle
err_t ipsdisplay2_draw_circle(ipsdisplay2_t *ctx, ipsdisplay2_point_t center_pt, uint8_t radius, uint16_t color)
IPS Display 2 draw circle function.
ipsdisplay2_draw_picture
err_t ipsdisplay2_draw_picture(ipsdisplay2_t *ctx, uint8_t rotation, const uint16_t *image)
IPS Display 2 draw picture function.
IPSDISPLAY2_COLOR_BLUE
#define IPSDISPLAY2_COLOR_BLUE
Definition: ipsdisplay2.h:420
application_init
void application_init(void)
Definition: main.c:31
IPSDISPLAY2_COLOR_CYAN
#define IPSDISPLAY2_COLOR_CYAN
Definition: ipsdisplay2.h:422
ipsdisplay2_cfg_t
IPS Display 2 Click configuration object.
Definition: ipsdisplay2.h:496
ipsdisplay2_init
err_t ipsdisplay2_init(ipsdisplay2_t *ctx, ipsdisplay2_cfg_t *cfg)
IPS Display 2 initialization function.
ipsdisplay2_fill_screen
err_t ipsdisplay2_fill_screen(ipsdisplay2_t *ctx, uint16_t color)
IPS Display 2 fill screen function.
ipsdisplay2_draw_rectangle
err_t ipsdisplay2_draw_rectangle(ipsdisplay2_t *ctx, ipsdisplay2_point_t start_pt, ipsdisplay2_point_t end_pt, uint16_t color)
IPS Display 2 draw rectangle function.
ipsdisplay2_write_string
err_t ipsdisplay2_write_string(ipsdisplay2_t *ctx, ipsdisplay2_point_t start_pt, uint8_t *data_in, uint16_t color)
IPS Display 2 write string function.
ipsdisplay2_default_cfg
err_t ipsdisplay2_default_cfg(ipsdisplay2_t *ctx)
IPS Display 2 default configuration function.
ipsdisplay2_cfg_setup
void ipsdisplay2_cfg_setup(ipsdisplay2_cfg_t *cfg)
IPS Display 2 configuration object setup function.
IPSDISPLAY2_COLOR_LIME
#define IPSDISPLAY2_COLOR_LIME
Definition: ipsdisplay2.h:419
IPSDISPLAY2_COLOR_BLACK
#define IPSDISPLAY2_COLOR_BLACK
IPS Display 2 RGB565 colors definition.
Definition: ipsdisplay2.h:416