adapter 2.0.0.0
main.c File Reference

Adapter Click example. More...

#include "board.h"
#include "log.h"
#include "adapter.h"

Macros

#define THERMO5_INTER_DIO_DATA_HI_BYTE   0x00
 
#define THERMO5_INTER_DIO_DATA_LO_BYTE   0x29
 
#define SRAM_24BIT_DATA   0x00FFFFFF
 
#define SRAM_CMD_WRITE   0x02
 
#define SRAM_CMD_READ   0x03
 

Functions

float thermo5_read_inter_temp (adapter_t *ctx)
 
void sram_write_byte (adapter_t *ctx, uint32_t reg_address, uint8_t write_data)
 
uint8_t sram_read_byte (adapter_t *ctx, uint32_t reg_address)
 
void application_init (void)
 
void application_task (void)
 
int main (void)
 

Variables

char send_buffer [17] = { 'm', 'i', 'k', 'r', 'o', 'E', 'l', 'e', 'k', 't', 'r', 'o', 'n', 'i', 'k', 'a', ' ' }
 
char mem_data [17]
 
uint8_t n_cnt
 

Detailed Description

Adapter Click example.

Description

Adapter click is a breakout board which simplifies connection of add-on boards. There are two ways of establishing connection: using male or female IDC10 connectors. Male header must be soldered on the top side of Adapter Click to connect the add-on board directly or via flat cable. Female header can be soldered either on the top, or the bottom side, depending on which one is more convenient in given circumstances.
There are two jumpers for SPI/I2C selection and one for selection of power supply range.

The demo application is composed of two sections :

Application Init

Initalizes I2C or SPI driver and makes an initial log.

Application Task

This is an example that shows the use of the Adapter click board (SPI mode - set as default). In I2C mode we are reading internal temperature from another device (THERMO 5 click board). In SPI mode example we are writing "mikroElektronika" to SRAM click board, and then reading from the same memory location.

Additional Functions

  • float thermo5_read_inter_temp ( adapter_t *ctx ) - @description Function reads measurements made by internal diode.
  • void sram_write_byte ( adapter_t *ctx, uint32_t reg_address, uint8_t write_data ) - @description Function writes the 8-bit data to the target 24-bit register address of 23LC1024 chip.
  • uint8_t sram_read_byte ( adapter_t *ctx, uint32_t reg_address ) - @description Function reads the 8-bit data to the target 24-bit register address of 23LC1024 chip.
Author
MikroE Team

Macro Definition Documentation

◆ SRAM_24BIT_DATA

#define SRAM_24BIT_DATA   0x00FFFFFF

◆ SRAM_CMD_READ

#define SRAM_CMD_READ   0x03

◆ SRAM_CMD_WRITE

#define SRAM_CMD_WRITE   0x02

◆ THERMO5_INTER_DIO_DATA_HI_BYTE

#define THERMO5_INTER_DIO_DATA_HI_BYTE   0x00

◆ THERMO5_INTER_DIO_DATA_LO_BYTE

#define THERMO5_INTER_DIO_DATA_LO_BYTE   0x29

Function Documentation

◆ application_init()

void application_init ( void )

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 )

◆ sram_read_byte()

uint8_t sram_read_byte ( adapter_t * ctx,
uint32_t reg_address )

◆ sram_write_byte()

void sram_write_byte ( adapter_t * ctx,
uint32_t reg_address,
uint8_t write_data )

◆ thermo5_read_inter_temp()

float thermo5_read_inter_temp ( adapter_t * ctx)

Variable Documentation

◆ mem_data

char mem_data[17]

◆ n_cnt

uint8_t n_cnt

◆ send_buffer

char send_buffer[17] = { 'm', 'i', 'k', 'r', 'o', 'E', 'l', 'e', 'k', 't', 'r', 'o', 'n', 'i', 'k', 'a', ' ' }