i2ctospi  2.0.0.0
Functions
main.c File Reference

I2cToSpi Click example. More...

#include "board.h"
#include "log.h"
#include "i2ctospi.h"

Functions

void display_log_uart (uint8_t value)
 
void rtc5_clear (i2ctospi_t *ctx, i2ctospi_spi_t *spi)
 
void rtc5_set_time_seconds (i2ctospi_t *ctx, i2ctospi_spi_t *spi, uint8_t seconds)
 
uint8_t rtc5_get_time_seconds (i2ctospi_t *ctx, i2ctospi_spi_t *spi)
 
void rtc5_set_time_minutes (i2ctospi_t *ctx, i2ctospi_spi_t *spi, uint8_t minutes)
 
uint8_t rtc5_get_time_minutes (i2ctospi_t *ctx, i2ctospi_spi_t *spi)
 
void rtc5_set_time_hours (i2ctospi_t *ctx, i2ctospi_spi_t *spi, uint8_t hours)
 
uint8_t rtc5_get_time_hours (i2ctospi_t *ctx, i2ctospi_spi_t *spi)
 
void application_init (void)
 
void application_task (void)
 
void main (void)
 

Detailed Description

I2cToSpi Click example.

Description

I2C to SPi Click allows serving as an interface between a standard I2C-bus of a microcontroller and an SPi bus, which allows the microcontroller to communicate directly with SPi devices through its I2C-bus. By offering an I2C-bus slave-transmitter or slave-receiver and SPI master, this Click controls all the SPi bus-specific sequences, protocol, and timing. It also has its own internal oscillator, and it supports the SPi chip select output that may be configured as GPIO when not used.

The demo application is composed of two sections :

Application Init

Initialization driver enable's - I2C, hardware reset, SS0 ( CS ) configured to be used as slave select outputs, set the configuration of SPI: order MSB first, clock Idle low, leading-edge transition, SPI clock rate to 115kHz, set SPI EEPROM write enable SS0, clear interrupt, clear RT5 register, sets starting time: hours, minutes and seconds ( enable counting ), also write log.

Application Task

This is an example which demonstrates the use of RTC 5 click is wired to I2C to SPI click board. I2C to SPI click communicates with register via the I2C interface, serve as an interface between a standard I2C-bus of a microcontroller and an SPI bus. RTC 5 click communicates with register via SPI interface. In this examples, we display RTC time which we received reading from the target register address of MCP79510 chip on RTC 5 click board via I2C interface of I2C to SPI click board. 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.

note:

Additional Functions :
Author
MikroE Team

Function Documentation

◆ application_init()

void application_init ( void  )

◆ application_task()

void application_task ( void  )

◆ display_log_uart()

void display_log_uart ( uint8_t  value)

◆ main()

void main ( void  )

◆ rtc5_clear()

void rtc5_clear ( i2ctospi_t ctx,
i2ctospi_spi_t spi 
)

◆ rtc5_get_time_hours()

uint8_t rtc5_get_time_hours ( i2ctospi_t ctx,
i2ctospi_spi_t spi 
)

◆ rtc5_get_time_minutes()

uint8_t rtc5_get_time_minutes ( i2ctospi_t ctx,
i2ctospi_spi_t spi 
)

◆ rtc5_get_time_seconds()

uint8_t rtc5_get_time_seconds ( i2ctospi_t ctx,
i2ctospi_spi_t spi 
)

◆ rtc5_set_time_hours()

void rtc5_set_time_hours ( i2ctospi_t ctx,
i2ctospi_spi_t spi,
uint8_t  hours 
)

◆ rtc5_set_time_minutes()

void rtc5_set_time_minutes ( i2ctospi_t ctx,
i2ctospi_spi_t spi,
uint8_t  minutes 
)

◆ rtc5_set_time_seconds()

void rtc5_set_time_seconds ( i2ctospi_t ctx,
i2ctospi_spi_t spi,
uint8_t  seconds 
)