Intermediate
30 min

Keep your electronics safe and sound with ADuM4154 and STM32F031K6

Unlocking the power of SPI isolators

SPI Isolator Click with Nucleo 32 with STM32F031K6 MCU

Published Oct 01, 2024

Click board™

SPI Isolator Click

Dev. board

Nucleo 32 with STM32F031K6 MCU

Compiler

NECTO Studio

MCU

STM32F031K6

This isolator represents a versatile solution for isolating and protecting digital signals, making them an essential component in electronic systems where signal integrity and safety are paramount

A

A

Hardware Overview

How does it work?

SPI Isolator Click is based on the ADuM4154, a 5kV digital isolator optimized for a serial peripheral interface (SPI) from Analog Devices. The click is designed to run on either a 3.3V or 5V power supply. It communicates with the target microcontroller over the SPI interface. The ADuM4154 has four high-speed channels. The first

three channels, CLK, MI/SO, and MO/SI (the slash indicates the connection of the particular input and output channel across the isolator), are optimized for either low propagation delay in the B grade or high noise immunity in the A grade. This Click board™ can operate with either 3.3V or 5V logic voltage levels selected via the VIO SEL

jumper. This way, both 3.3V and 5V capable MCUs can use the communication lines properly. Also, this Click board™ comes equipped with a library containing easy-to-use functions and an example code that can be used as a reference for further development.

SPI Isolator Click top side image
SPI Isolator Click bottom side image

Features overview

Development board

Nucleo 32 with STM32F031K6 MCU board provides an affordable and flexible platform for experimenting with STM32 microcontrollers in 32-pin packages. Featuring Arduino™ Nano connectivity, it allows easy expansion with specialized shields, while being mbed-enabled for seamless integration with online resources. The

board includes an on-board ST-LINK/V2-1 debugger/programmer, supporting USB reenumeration with three interfaces: Virtual Com port, mass storage, and debug port. It offers a flexible power supply through either USB VBUS or an external source. Additionally, it includes three LEDs (LD1 for USB communication, LD2 for power,

and LD3 as a user LED) and a reset push button. The STM32 Nucleo-32 board is supported by various Integrated Development Environments (IDEs) such as IAR™, Keil®, and GCC-based IDEs like AC6 SW4STM32, making it a versatile tool for developers.

Nucleo 32 with STM32F031K6 MCU double side image

Microcontroller Overview

MCU Card / MCU

default

Architecture

ARM Cortex-M0

MCU Memory (KB)

32

Silicon Vendor

STMicroelectronics

Pin count

32

RAM (Bytes)

4096

You complete me!

Accessories

Click Shield for Nucleo-32 is the perfect way to expand your development board's functionalities with STM32 Nucleo-32 pinout. The Click Shield for Nucleo-32 provides two mikroBUS™ sockets to add any functionality from our ever-growing range of Click boards™. We are fully stocked with everything, from sensors and WiFi transceivers to motor control and audio amplifiers. The Click Shield for Nucleo-32 is compatible with the STM32 Nucleo-32 board, providing an affordable and flexible way for users to try out new ideas and quickly create prototypes with any STM32 microcontrollers, choosing from the various combinations of performance, power consumption, and features. The STM32 Nucleo-32 boards do not require any separate probe as they integrate the ST-LINK/V2-1 debugger/programmer and come with the STM32 comprehensive software HAL library and various packaged software examples. This development platform provides users with an effortless and common way to combine the STM32 Nucleo-32 footprint compatible board with their favorite Click boards™ in their upcoming projects.

Click Shield for Nucleo-32 accessories 1 image

Used MCU Pins

mikroBUS™ mapper

NC
NC
AN
NC
NC
RST
SPI Chip Select
PA4
CS
SPI Clock
PB3
SCK
SPI Data OUT
PB4
MISO
SPI Data IN
PB5
MOSI
Power Supply
3.3V
3.3V
Ground
GND
GND
NC
NC
PWM
NC
NC
INT
NC
NC
TX
NC
NC
RX
NC
NC
SCL
NC
NC
SDA
Power Supply
5V
5V
Ground
GND
GND
1

Take a closer look

Click board™ Schematic

SPI Isolator Click Schematic schematic

Step by step

Project assembly

Click Shield for Nucleo-144 front image hardware assembly

Start by selecting your development board and Click board™. Begin with the Nucleo 32 with STM32F031K6 MCU as your development board.

Click Shield for Nucleo-144 front image hardware assembly
Nucleo 144 with STM32L4A6ZG MCU front image hardware assembly
Stepper 22 Click front image hardware assembly
Prog-cut hardware assembly
Stepper 22 Click complete accessories setup image hardware assembly
Board mapper by product8 hardware assembly
Necto image step 2 hardware assembly
Necto image step 3 hardware assembly
Necto image step 4 hardware assembly
Necto image step 5 hardware assembly
Necto image step 6 hardware assembly
STM32 M4 Clicker HA MCU/Select Step hardware assembly
Necto No Display image step 8 hardware assembly
Necto image step 9 hardware assembly
Necto image step 10 hardware assembly
Debug Image Necto Step hardware assembly

Track your results in real time

Application Output

1. Application Output - In Debug mode, the 'Application Output' window enables real-time data monitoring, offering direct insight into execution results. Ensure proper data display by configuring the environment correctly using the provided tutorial.

2. UART Terminal - Use the UART Terminal to monitor data transmission via a USB to UART converter, allowing direct communication between the Click board™ and your development system. Configure the baud rate and other serial settings according to your project's requirements to ensure proper functionality. For step-by-step setup instructions, refer to the provided tutorial.

3. Plot Output - The Plot feature offers a powerful way to visualize real-time sensor data, enabling trend analysis, debugging, and comparison of multiple data points. To set it up correctly, follow the provided tutorial, which includes a step-by-step example of using the Plot feature to display Click board™ readings. To use the Plot feature in your code, use the function: plot(*insert_graph_name*, variable_name);. This is a general format, and it is up to the user to replace 'insert_graph_name' with the actual graph name and 'variable_name' with the parameter to be displayed.

Software Support

Library Description

This library contains API for SPI Isolator Click driver.

Key functions:

  • spiisolator_generic_transfer - Generic transfer function

  • spiisolator_write_byte - Write the byte of data function

  • spiisolator_read_byte - Read the byte of data function

Open Source

Code example

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.

/*!
 * \file 
 * \brief Spiisolator Click example
 * 
 * # Description
 * The Click is designed to run on either 3.3V or 5V power supply. It communicates with the target microcontroller over SPI interface.
 * In this example we have used an 8x8 Click board connected to a SPI Isolator Click board. 
 *
 * The demo application is composed of two sections :
 * 
 * ## Application Init 
 * Initialization driver enables - SPI, set default configuration, also write log.
 * 
 * ## Application Task  
 * Controls an 8x8 Click board and displays the steps on UART Terminal.
 * 
 * \author MikroE Team
 *
 */
// ------------------------------------------------------------------- INCLUDES

#include "board.h"
#include "log.h"
#include "spiisolator.h"

// ------------------------------------------------------------------ VARIABLES

static spiisolator_t spiisolator;
static log_t logger;

uint8_t demo_string[ 11 ] = { ' ', '-', 'M', 'i', 'k', 'r', 'o', 'E', '-', ' ', 0 };
uint8_t demo_img_on [ 8 ] = { 0x08, 0x1c, 0x36, 0x22, 0x08, 0x1c, 0x36, 0x22 };
uint8_t demo_img_off[ 8 ] = { 0xf7, 0xe3, 0xc9, 0xdd, 0xf7, 0xe3, 0xc9, 0xdd };
char demo_char = 'A';


static const uint8_t ascii_matrix[][ 10 ] = {

          { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0 },   // space -- 32
          { 0x00, 0x00, 0x0,  0x0,  0x60, 0xfa, 0xfa, 0x60, 0x0,  0x0 },   // ! -- 33
          { 0x00, 0x00, 0x0,  0xc0, 0xe0, 0x0,  0x0,  0xe0, 0xc0, 0x0 },   // " -- 34
          { 0x00, 0x00, 0x28, 0xfe, 0xfe, 0x28, 0xfe, 0xfe, 0x28, 0x0 },   // # -- 35
          { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0 },   // $ -- 36
          { 0x00, 0x00, 0x62, 0x66, 0xc,  0x18, 0x30, 0x66, 0x46, 0x0 },   // % -- 37
          { 0x00, 0x00, 0xc,  0x5e, 0xf2, 0xba, 0xec, 0x5e, 0x12, 0x0 },   // & -- 38
          { 0x00, 0x00, 0x0,  0x0,  0x20, 0xe0, 0xc0, 0x0,  0x0,  0x0 },   // ' -- 39
          { 0x00, 0x00, 0x0,  0x0,  0x38, 0x7c, 0xc6, 0x82, 0x0,  0x0 },   // ( -- 40
          { 0x00, 0x00, 0x0,  0x0,  0x82, 0xc6, 0x7c, 0x38, 0x0,  0x0 },   // ) -- 41
          { 0x00, 0x00, 0x10, 0x54, 0x7c, 0x38, 0x38, 0x7c, 0x54, 0x10},   // * -- 42
          { 0x00, 0x00, 0x0,  0x10, 0x10, 0x7c, 0x7c, 0x10, 0x10, 0x0 },   // + -- 43
          { 0x00, 0x00, 0x0,  0x0,  0x0,  0x18, 0x1c, 0x0,  0x0,  0x0 },   // , -- 44
          { 0x00, 0x00, 0x0,  0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x0 },   // - -- 45
          { 0x00, 0x00, 0x0,  0x0,  0x0,  0x6,  0x6,  0x0,  0x0,  0x0 },   // . -- 46
          { 0x00, 0x00, 0x6,  0xc,  0x18, 0x30, 0x60, 0xc0, 0x80, 0x0 },   // / -- 47

          { 0x00, 0x00, 0x7c, 0xfe, 0x8a, 0x92, 0xa2, 0xfe, 0x7c, 0x00},   // 0 -- 48
          { 0x00, 0x00, 0x0,  0x2,  0x42, 0xfe, 0xfe, 0x2,  0x2,  0x00},   // 1 -- 49
          { 0x00, 0x00, 0x42, 0xc6, 0x8e, 0x9a, 0x92, 0xf6, 0x66, 0x00},   // 2 -- 50
          { 0x00, 0x00, 0x22, 0x63, 0x49, 0x49, 0x49, 0x7F, 0x36, 0x00},   // 3 -- 51
          { 0x00, 0x00, 0x18, 0x38, 0x68, 0xca, 0xfe, 0xfe, 0xa,  0x0 },   // 4 -- 52
          { 0x00, 0x00, 0x0 , 0xf4, 0xf6, 0x92, 0x92, 0x92, 0x9e, 0x8c},   // 5 -- 53
          { 0x00, 0x00, 0x3c, 0x7e, 0xd2, 0x92, 0x92, 0x1e, 0xc,  0x00},   // 6 -- 54
          { 0x00, 0x00, 0x0,  0x0,  0x80, 0x9e, 0xb0, 0xe0, 0xc0, 0x0 },   // 7 -- 55
          { 0x00, 0x00, 0x6c, 0xfe, 0x92, 0x92, 0x92, 0xfe, 0x6c, 0x0 },   // 8 -- 56
          { 0x00, 0x00, 0x60, 0xf2, 0x92, 0x92, 0x96, 0xfc, 0x78, 0x0 },   // 9 -- 57//

          { 0x00, 0x00, 0x0,  0x0,  0x0,  0x66, 0x66, 0x0,  0x0,  0x0 },   // : -- 58
          { 0x00, 0x00, 0x0,  0x0,  0x0,  0x6c, 0x6e, 0x0,  0x0,  0x0 },   // ; -- 59
          { 0x00, 0x00, 0x0,  0x0,  0x10, 0x38, 0x6c, 0xc6, 0x82, 0x0 },   // < -- 60
          { 0x00, 0x00, 0x0,  0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x0 },   // = -- 61
          { 0x00, 0x00, 0x0,  0x82, 0xc6, 0x6c, 0x38, 0x10, 0x0,  0x0 },   // > -- 62
          { 0x00, 0x00, 0x40, 0xc0, 0x80, 0x9a, 0xba, 0xe0, 0x40, 0x0 },   // ? -- 63
          { 0x00, 0x00, 0x7c, 0xfe, 0x82, 0xba, 0xaa, 0xf8, 0x78, 0x0 },   // @ -- 64

          { 0x00, 0x00, 0x3e, 0x7e, 0xd0, 0x90, 0xd0, 0x7e, 0x3e, 0x0 },   // A -- 65
          { 0x00, 0x00, 0x82, 0xfe, 0xfe, 0x92, 0x92, 0xfe, 0x6c, 0x0 },   // B -- 66
          { 0x00, 0x00, 0x38, 0x7c, 0xc6, 0x82, 0x82, 0xc6, 0x44, 0x0 },   // C -- 67
          { 0x00, 0x00, 0x82, 0xfe, 0xfe, 0x82, 0xc6, 0x7c, 0x38, 0x0 },   // D -- 68
          { 0x00, 0x00, 0x82, 0xfe, 0xfe, 0x92, 0xba, 0x82, 0xc6, 0x0 },   // E -- 69
          { 0x00, 0x00, 0x82, 0xfe, 0xfe, 0x92, 0xb8, 0x80, 0xc0, 0x0 },   // F -- 70
          { 0x00, 0x00, 0x38, 0x7c, 0xc6, 0x82, 0x8a, 0xce, 0x4e, 0x0 },   // G -- 71
          { 0x00, 0x00, 0xfe, 0xfe, 0x10, 0x10, 0x10, 0xfe, 0xfe, 0x0 },   // H -- 72
          { 0x00, 0x00, 0x0,  0x0,  0x82, 0xfe, 0xfe, 0x82, 0x0,  0x0 },   // I -- 73
          { 0x00, 0x00, 0x0,  0xe,  0x2,  0x82, 0xfe, 0xfc, 0x80, 0x0 },   // J -- 74
          { 0x00, 0x00, 0x82, 0xfe, 0xfe, 0x10, 0x38, 0xee, 0xc6, 0x0 },   // K -- 75
          { 0x00, 0x00, 0x82, 0xfe, 0xfe, 0x82, 0x2,  0x6,  0xe,  0x0 },   // L -- 76
          { 0x00, 0x00, 0xfe, 0xfe, 0x70, 0x38, 0x70, 0xfe, 0xfe, 0x0 },   // M -- 77
          { 0x00, 0x00, 0xfe, 0xfe, 0x60, 0x30, 0x18, 0xfe, 0xfe, 0x0 },   // N -- 78
          { 0x00, 0x00, 0x7c, 0xfe, 0x82, 0x82, 0x82, 0xfe, 0x7c, 0x0 },   // O -- 79
          { 0x00, 0x00, 0x82, 0xfe, 0xfe, 0x92, 0x90, 0xf0, 0x60, 0x0 },   // P -- 80
          { 0x00, 0x00, 0x7c, 0xfe, 0x82, 0x82, 0x87, 0xff, 0x7d, 0x0 },   // Q -- 81
          { 0x00, 0x00, 0x82, 0xfe, 0xfe, 0x90, 0x98, 0xfe, 0x66, 0x0 },   // R -- 82
          { 0x00, 0x00, 0x44, 0xe6, 0xb2, 0x92, 0x9a, 0xce, 0x44, 0x0 },   // S -- 83
          { 0x00, 0x00, 0x0,  0xe0, 0xc2, 0xfe, 0xfe, 0xc2, 0xe0, 0x0 },   // T -- 84
          { 0x00, 0x00, 0xfc, 0xfe, 0x2,  0x2,  0x2,  0xfe, 0xfc, 0x0 },   // U -- 85
          { 0x00, 0x00, 0xf8, 0xfc, 0x6,  0x2,  0x6,  0xfc, 0xf8, 0x0 },   // V -- 86
          { 0x00, 0x00, 0xfc, 0xfe, 0x6,  0x1c, 0x6,  0xfe, 0xfc, 0x0 },   // W -- 87
          { 0x00, 0x00, 0xc6, 0xee, 0x38, 0x10, 0x38, 0xee, 0xc6, 0x0 },   // X -- 88
          { 0x00, 0x00, 0x0,  0xe0, 0xf2, 0x1e, 0x1e, 0xf2, 0xe0, 0x0 },   // Y -- 89
          { 0x00, 0x00, 0xe2, 0xc6, 0x8e, 0x92, 0xb2, 0xe6, 0xce, 0x0 },   // Z -- 90

          { 0x00, 0x00, 0x0,  0x0,  0xfe, 0xfe, 0x82, 0x82, 0x0,  0x0 },   // [ -- 91
          { 0x00, 0x00, 0x80, 0xc0, 0x60, 0x30, 0x18, 0xc,  0x6,  0x0 },   // \ -- 92
          { 0x00, 0x00, 0x0,  0x0,  0x82, 0x82, 0xfe, 0xfe, 0x0,  0x0 },   // ] -- 93
          { 0x00, 0x00, 0x10, 0x30, 0x60, 0xc0, 0x60, 0x30, 0x10, 0x0 },   // ^ -- 94
          { 0x00, 0x00, 0x1,  0x1,  0x1,  0x1,  0x1,  0x1,  0x1,  0x1 },   // _ -- 95
          { 0x00, 0x00, 0x0,  0x0,  0x80, 0xc0, 0x60, 0x20, 0x0,  0x0 },   // ` -- 96{}

          { 0x00, 0x00, 0x4,  0x2e, 0x2a, 0x2a, 0x3c, 0x1e, 0x2,  0x0 },   // a -- 97
          { 0x00, 0x00, 0x82, 0xfe, 0xfc, 0x22, 0x22, 0x3e, 0x1c, 0x0 },   // b -- 98
          { 0x00, 0x00, 0x1c, 0x3e, 0x22, 0x22, 0x22, 0x36, 0x14, 0x0 },   // c -- 99
          { 0x00, 0x00, 0x1c, 0x3e, 0x22, 0xa2, 0xfc, 0xfe, 0x2,  0x0 },   // d -- 100
          { 0x00, 0x00, 0x1c, 0x3e, 0x2a, 0x2a, 0x2a, 0x3a, 0x18, 0x0 },   // e -- 101
          { 0x00, 0x00, 0x12, 0x7e, 0xfe, 0x92, 0x90, 0xc0, 0x40, 0x0 },   // f -- 102
          { 0x00, 0x00, 0x19, 0x3d, 0x25, 0x25, 0x3f, 0x3e, 0x20, 0x0 },   // g -- 103
          { 0x00, 0x00, 0x82, 0xfe, 0xfe, 0x30, 0x20, 0x3e, 0x1e, 0x0 },   // h -- 104
          { 0x00, 0x00, 0x0,  0x0,  0x22, 0xbe, 0xbe, 0x2,  0x0,  0x0 },   // i -- 105
          { 0x00, 0x00, 0x0,  0x6,  0x7,  0x1,  0x1,  0xbf, 0xbe, 0x0 },   // j -- 106
          { 0x00, 0x00, 0x82, 0xfe, 0xfe, 0x8,  0x1c, 0x36, 0x22, 0x0 },   // k -- 107
          { 0x00, 0x00, 0x0,  0x0,  0x82, 0xfe, 0xfe, 0x2,  0x0,  0x0 },   // l -- 108
          { 0x00, 0x00, 0x3e, 0x3e, 0x30, 0x1e, 0x30, 0x3e, 0x1e, 0x0 },   // m -- 109
          { 0x00, 0x00, 0x20, 0x3e, 0x1e, 0x20, 0x20, 0x3e, 0x1e, 0x0 },   // n -- 110
          { 0x00, 0x00, 0x1c, 0x3e, 0x22, 0x22, 0x22, 0x3e, 0x1c, 0x0 },   // o -- 111
          { 0x00, 0x00, 0x21, 0x3f, 0x1f, 0x25, 0x24, 0x3c, 0x18, 0x0 },   // p -- 112
          { 0x00, 0x00, 0x18, 0x3c, 0x24, 0x25, 0x1f, 0x3f, 0x21, 0x0 },   // q -- 113
          { 0x00, 0x00, 0x22, 0x3e, 0x1e, 0x32, 0x20, 0x30, 0x10, 0x0 },   // r -- 114
          { 0x00, 0x00, 0x12, 0x3a, 0x2a, 0x2a, 0x2a, 0x2e, 0x24, 0x0 },   // s -- 115
          { 0x00, 0x00, 0x20, 0x20, 0xfc, 0xfe, 0x22, 0x26, 0x4,  0x0 },   // t -- 116
          { 0x00, 0x00, 0x3c, 0x3e, 0x2,  0x2,  0x3c, 0x3e, 0x2,  0x0 },   // u -- 117
          { 0x00, 0x00, 0x38, 0x3c, 0x6,  0x3,  0x6,  0x3c, 0x38, 0x0 },   // v -- 118
          { 0x00, 0x00, 0x3c, 0x3e, 0x6,  0x1c, 0x6,  0x3e, 0x3c, 0x0 },   // w -- 119
          { 0x00, 0x00, 0x22, 0x36, 0x1c, 0x8,  0x1c, 0x36, 0x22, 0x0 },   // x -- 120
          { 0x00, 0x00, 0x39, 0x3e, 0x5,  0x5,  0x5,  0x3f, 0x3e, 0x0 },   // y -- 121
          { 0x00, 0x00, 0x0,  0x32, 0x26, 0x2e, 0x3a, 0x32, 0x26, 0x0 }
};

// ------------------------------------------------------- ADDITIONAL FUNCTIONS

void c8x8_display_string ( spiisolator_t *ctx, char *p_array )
{
    uint8_t str_word[512];
    char wr_chr;
    uint8_t cnt;
    uint8_t i;
    uint8_t global_cnt = 0;
    uint8_t char_ascii;
    uint8_t position = 0;
    uint8_t col = 8;

    for ( i = 0; i < strlen( p_array ); i++ )
    {
        char_ascii = p_array[ i ] - 32;
        for ( cnt = 0; cnt < 10; cnt++ )
        {
            str_word[ global_cnt++ ] = ascii_matrix[ char_ascii ][ cnt ];
        }
    }

    while ( position < ( global_cnt - 8 ) )
    {
         for ( cnt = position; cnt < position + 8; cnt++ )
         {
             wr_chr = str_word[ cnt ];
             spiisolator_write_cmd( ctx, col, wr_chr );
             col--;
         }
         col = 8;
         position++;
         Delay_100ms( );
     }
}


void c8x8_display_byte ( spiisolator_t *ctx, char tx_byte )
{
    uint8_t cnt;
    uint8_t char_ascii;
    uint8_t position = 8;
    char wr_chr;

    char_ascii = tx_byte - 32;
    for ( cnt = 2; cnt < 10; cnt++ )
    {
        wr_chr = ascii_matrix[ char_ascii ][ cnt ];
        spiisolator_write_cmd( ctx, position, wr_chr );
        position--;
    }
}

void c8x8_display_image ( spiisolator_t *ctx, uint8_t *p_image )
{
    uint8_t cnt;
    uint8_t line;
    uint8_t position = 8;

    for ( cnt = 0; cnt < 8; cnt++ )
    {
        line = p_image[ cnt ];
        spiisolator_write_cmd( ctx, position, line );
        position--;
    }
}

void c8x8_display_refresh ( spiisolator_t *ctx )
{
   uint8_t cnt;

   for ( cnt = 1; cnt < 9; cnt++ )
   {
        spiisolator_write_cmd( ctx, cnt, 0x00 );
   }
}

void c8x8_default_cfg ( spiisolator_t *ctx )
{
    // Click default configuration

    spiisolator_write_cmd( ctx, 0x09, 0x00 ); // decode mode
    spiisolator_write_cmd( ctx, 0x0A, 0x07 ); // intensity
    spiisolator_write_cmd( ctx, 0x0B, 0x07 ); // scan limit
    spiisolator_write_cmd( ctx, 0x0C, 0x01 ); // normal operation mode

    c8x8_display_refresh( ctx );
}

// ------------------------------------------------------ APPLICATION FUNCTIONS

void application_init ( void )
{
    log_cfg_t log_cfg;
    spiisolator_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.

    spiisolator_cfg_setup( &cfg );
    SPIISOLATOR_MAP_MIKROBUS( cfg, MIKROBUS_1 );
    spiisolator_init( &spiisolator, &cfg );
    
    c8x8_default_cfg( &spiisolator );

    Delay_100ms( );
}

void application_task ( void )
{    
    log_info( &logger, "> Display Character ..." );
    c8x8_display_byte( &spiisolator, demo_char );
    Delay_ms ( 1000 );

    log_info( &logger, "> Display String ..." );
    c8x8_display_string( &spiisolator, &demo_string[ 0 ] );
    Delay_ms ( 1000 );

    log_info( &logger, "> Display Image ON ..." );
    c8x8_display_image( &spiisolator, &demo_img_on[ 0 ] );
    Delay_ms ( 500 );

    log_info( &logger, "> Display Image OFF ..." );
    c8x8_display_image( &spiisolator, &demo_img_off[ 0 ] );
    Delay_ms ( 1000 );
}

int main ( void ) 
{
    /* Do not remove this line or clock might not be set correctly. */
    #ifdef PREINIT_SUPPORTED
    preinit();
    #endif
    
    application_init( );
    
    for ( ; ; ) 
    {
        application_task( );
    }

    return 0;
}

// ------------------------------------------------------------------------ END

Additional Support

Resources

Love this project?

'Buy This Kit' button takes you directly to the shopping cart where you can easily add or remove products.