spiextend 2.0.0.0
main.c File Reference

SPIExtend Click example. More...

#include "board.h"
#include "log.h"
#include "spiextend.h"

Functions

void spiextend_accel14_get_axis (uint8_t axis_out_reg)
 SPI Extend reading axis function.
 
void spiextend_display_status (uint8_t check_status)
 SPI Extend check display status function.
 
void application_init (void)
 
void application_task (void)
 
int main (void)
 

Variables

spiextend_status_data_t spiextend_status
 

Detailed Description

SPIExtend Click example.

Description

In this example, if the connection is established, we read Accel axis of the connected Accel 14 Click boards to the SPI Extend Click ( Remote Mode ) which is connected by a LAN cable to SPI Extend Click ( Local Mode ) placed in the mikroBUS 1. Results are being sent to the Usart Terminal where you can track their changes. All data logs write on USB uart changes for every 1 sec.

The demo application is composed of two sections :

Application Init

Initializes SPI, sets INT pin as input and AN, RST, CS nad PWM pins as outputs and begins to write log. Also, initialization driver enables - SPI, set default configuration of the Accel 14 Click connected to the SPI Extend Click ( Remote Mode ).

Application Task

If the click is connected properly then the status becomes active and the X-axis coordinate is printed first on the UART terminal, then Y and finally Z. After 1s the process is repeated. In case an error has occurred, printed "LINK is not established" on UART Terminal.

Additional Functions :

  • void spiextend_accel14_get_axis ( uint8_t axis_out_reg ) - SPI Extend reading axis function.
  • void spiextend_display_status ( uint8_t check_status ) - SPI Extend check display status function.
Author
Jelena Milosavljevic

Function Documentation

◆ application_init()

void application_init ( void )

< Logger config object.

< 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 LOG_MAP_USB_UART macro definition for detailed explanation.

◆ application_task()

void application_task ( void )

◆ main()

int main ( void )

◆ spiextend_accel14_get_axis()

void spiextend_accel14_get_axis ( uint8_t axis_out_reg)

SPI Extend reading axis function.

This function is used for reading axis.

Parameters
[in]axis_out_reg: Data from the register.
Returns
Nothing.

◆ spiextend_display_status()

void spiextend_display_status ( uint8_t check_status)

SPI Extend check display status function.

This function is used for check display status.

Parameters
[in]check_status: Display data.
Returns
Nothing.

Variable Documentation

◆ spiextend_status

spiextend_status_data_t spiextend_status