i2ctospi 2.0.0.0
i2ctospi.h File Reference

This file contains API for I2C to SPI Click driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_i2c_master.h"

Go to the source code of this file.

Data Structures

struct  i2ctospi_t
 Click ctx object definition. More...
 
struct  i2ctospi_cfg_t
 Click configuration structure definition. More...
 
struct  i2ctospi_spi_t
 Click spi object definition. More...
 
struct  i2ctospi_gpio_t
 Click gpio object definition. More...
 

Macros

#define I2CTOSPI_MAP_MIKROBUS(cfg, mikrobus)
 
#define I2CTOSPI_RETVAL   uint8_t
 
#define I2CTOSPI_OK   0x00
 
#define I2CTOSPI_INIT_ERROR   0xFF
 
#define I2CTOSPI_I2C_SLAVE_ADDRESS_0   0x28
 
#define I2CTOSPI_I2C_SLAVE_ADDRESS_1   0x29
 
#define I2CTOSPI_I2C_SLAVE_ADDRESS_2   0x2A
 
#define I2CTOSPI_I2C_SLAVE_ADDRESS_3   0x2B
 
#define I2CTOSPI_I2C_SLAVE_ADDRESS_4   0x2C
 
#define I2CTOSPI_I2C_SLAVE_ADDRESS_5   0x2D
 
#define I2CTOSPI_I2C_SLAVE_ADDRESS_6   0x2E
 
#define I2CTOSPI_I2C_SLAVE_ADDRESS_7   0x2F
 
#define I2CTOSPI_CONFIGURE_SPI   0xF0
 
#define I2CTOSPI_CLEAR_INTERRUPT   0xF1
 
#define I2CTOSPI_IDLE_MODE   0xF2
 
#define I2CTOSPI_GPIO_WRITE   0xF4
 
#define I2CTOSPI_GPIO_READ   0xF5
 
#define I2CTOSPI_GPIO_ENABLE   0xF6
 
#define I2CTOSPI_GPIO_CONFIGURATION   0xF7
 
#define I2CTOSPI_CONFIGURE_SPI_ORDER_MSB_FIRST   0x00
 
#define I2CTOSPI_CONFIGURE_SPI_ORDER_LSB_FIRST   0x20
 
#define I2CTOSPI_CONFIGURE_SPI_MODE_SPICLK_LOW_LEADING_EDGE   0x00
 
#define I2CTOSPI_CONFIGURE_SPI_MODE_SPICLK_LOW_TRAILING_EDGE   0x04
 
#define I2CTOSPI_CONFIGURE_SPI_MODE_SPICLK_HIGH_LEADING_EDGE   0x08
 
#define I2CTOSPI_CONFIGURE_SPI_MODE_SPICLK_HIGH_TRAILING_EDGE   0x0C
 
#define I2CTOSPI_CONFIGURE_SPI_CLOCK_RATE_1843kHz   0x00
 
#define I2CTOSPI_CONFIGURE_SPI_CLOCK_RATE_461kHz   0x01
 
#define I2CTOSPI_CONFIGURE_SPI_CLOCK_RATE_115kHz   0x02
 
#define I2CTOSPI_CONFIGURE_SPI_CLOCK_RATE_58kHz   0x03
 
#define I2CTOSPI_CONFIGURE_GPIO_WRITE_PORT_ENABLE_SS0   0x01
 
#define I2CTOSPI_CONFIGURE_GPIO_WRITE_PORT_ENABLE_SS1   0x02
 
#define I2CTOSPI_CONFIGURE_GPIO_WRITE_PORT_ENABLE_SS2   0x04
 
#define I2CTOSPI_CONFIGURE_GPIO_WRITE_PORT_ENABLE_SS3   0x08
 
#define I2CTOSPI_CONFIGURE_GPIO_READ_PORT_ENABLE_SS0   0x01
 
#define I2CTOSPI_CONFIGURE_GPIO_READ_PORT_ENABLE_SS1   0x02
 
#define I2CTOSPI_CONFIGURE_GPIO_READ_PORT_ENABLE_SS2   0x04
 
#define I2CTOSPI_CONFIGURE_GPIO_READ_PORT_ENABLE_SS3   0x08
 
#define I2CTOSPI_CONFIGURE_GPIO_BIDIRECTIONAL_PORT_ENABLE_SS0   0x01
 
#define I2CTOSPI_CONFIGURE_GPIO_BIDIRECTIONAL_PORT_ENABLE_SS1   0x02
 
#define I2CTOSPI_CONFIGURE_GPIO_BIDIRECTIONAL_PORT_ENABLE_SS2   0x04
 
#define I2CTOSPI_CONFIGURE_GPIO_BIDIRECTIONAL_PORT_ENABLE_SS3   0x08
 
#define I2CTOSPI_CONFIGURE_GPIO_QUASI_BIDIRECTIONAL_SS0   0x00
 
#define I2CTOSPI_CONFIGURE_GPIO_PUSH_PULL_SS0   0x01
 
#define I2CTOSPI_CONFIGURE_GPIO_INPUT_ONLY_SS0   0x02
 
#define I2CTOSPI_CONFIGURE_GPIO_OPEN_DRAIN_SS0   0x03
 
#define I2CTOSPI_CONFIGURE_GPIO_QUASI_BIDIRECTIONAL_SS1   0x00
 
#define I2CTOSPI_CONFIGURE_GPIO_PUSH_PULL_SS1   0x04
 
#define I2CTOSPI_CONFIGURE_GPIO_INPUT_ONLY_SS1   0x08
 
#define I2CTOSPI_CONFIGURE_GPIO_OPEN_DRAIN_SS1   0x0C
 
#define I2CTOSPI_CONFIGURE_GPIO_QUASI_BIDIRECTIONAL_SS2   0x00
 
#define I2CTOSPI_CONFIGURE_GPIO_PUSH_PULL_SS2   0x10
 
#define I2CTOSPI_CONFIGURE_GPIO_INPUT_ONLY_SS2   0x20
 
#define I2CTOSPI_CONFIGURE_GPIO_OPEN_DRAIN_SS2   0x30
 
#define I2CTOSPI_CONFIGURE_GPIO_QUASI_BIDIRECTIONAL_SS3   0x00
 
#define I2CTOSPI_CONFIGURE_GPIO_PUSH_PULL_SS3   0x40
 
#define I2CTOSPI_CONFIGURE_GPIO_INPUT_ONLY_SS3   0x80
 
#define I2CTOSPI_CONFIGURE_GPIO_OPEN_DRAIN_SS3   0xC0
 
#define I2CTOSPI_SLAVEDEVICE_SS0   0x01
 
#define I2CTOSPI_SLAVEDEVICE_SS1   0x02
 
#define I2CTOSPI_SLAVEDEVICE_SS2   0x04
 
#define I2CTOSPI_SLAVEDEVICE_SS3   0x08
 
#define I2CTOSPI_RTC5_COMMAND_WRITE   0x12
 
#define I2CTOSPI_RTC5_COMMAND_READ   0x13
 
#define I2CTOSPI_RTC5_REG_TIME_HUN_OF_SEC   0x00
 
#define I2CTOSPI_RTC5_REG_TIME_SEC   0x01
 
#define I2CTOSPI_RTC5_REG_TIME_MIN   0x02
 
#define I2CTOSPI_RTC5_REG_TIME_HOUR   0x03
 
#define I2CTOSPI_RTC5_REG_TIME_DAY_OF_THE_WEEK   0x04
 
#define I2CTOSPI_RTC5_REG_TIME_DATE_DAY   0x05
 
#define I2CTOSPI_RTC5_REG_TIME_DATE_MONTH   0x06
 
#define I2CTOSPI_RTC5_REG_TIME_DATE_YEAR   0x07
 
#define I2CTOSPI_RTC5_REG_CONFIG   0x08
 
#define I2CTOSPI_RTC5_REG_CALIBRATION   0x09
 
#define I2CTOSPI_RTC5_COMMAND_CLEAR   0x54
 
#define I2CTOSPI_RTC5_COMMAND_ENABLE_COUNTING   0x80
 

Functions

void i2ctospi_cfg_setup (i2ctospi_cfg_t *cfg)
 Config Object Initialization function.
 
I2CTOSPI_RETVAL i2ctospi_init (i2ctospi_t *ctx, i2ctospi_cfg_t *cfg)
 Initialization function.
 
void i2ctospi_default_cfg (i2ctospi_t *ctx)
 Click Default Configuration function.
 
void i2ctospi_generic_write (i2ctospi_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic write function.
 
void i2ctospi_generic_read (i2ctospi_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic read function.
 
void i2ctospi_hw_reset (i2ctospi_t *ctx)
 Hardware reset function.
 
uint8_t i2ctospi_get_interrupt (i2ctospi_t *ctx)
 Gets state of the interrupt function.
 
void i2ctospi_spi_write_byte (i2ctospi_t *ctx, i2ctospi_spi_t *spi, uint8_t write_data)
 Generic SPI write the byte of data to data buffer function.
 
uint8_t i2ctospi_spi_read_byte (i2ctospi_t *ctx, i2ctospi_spi_t *spi)
 Generic SPI read the byte of data from data buffer function.
 
void i2ctospi_spi_burst_write (i2ctospi_t *ctx, i2ctospi_spi_t *spi, uint8_t *write_data)
 Generic SPI write - single address burst write function.
 
void i2ctospi_spi_burst_read (i2ctospi_t *ctx, i2ctospi_spi_t *spi, uint8_t *read_data)
 Generic SPI read - single address burst read function.
 
void i2ctospi_read_buffer_bytes (i2ctospi_t *ctx, i2ctospi_spi_t *spi, uint8_t *read_data)
 Generic sequential read from the data buffer function.
 
void i2ctospi_write_command (i2ctospi_t *ctx, i2ctospi_spi_t *spi, uint8_t command_data)
 Generic write command byte of data function.
 
void i2ctospi_write_enable (i2ctospi_t *ctx, uint8_t ss_pin_data)
 SPI EEPROM wite enable function.
 
void i2ctospi_config_spi (i2ctospi_t *ctx, uint8_t config_data)
 Configure SPI Interface function.
 
void i2ctospi_clear_interrupt (i2ctospi_t *ctx)
 Clear interrupt function.
 
void i2ctospi_set_idle_mode (i2ctospi_t *ctx)
 Set Idle mode function.
 
void i2ctospi_set_write_state_of_gpio (i2ctospi_t *ctx, uint8_t gpio_state)
 Set state of the pins defined as GPIO write function.
 
void i2ctospi_set_read_state_of_gpio (i2ctospi_t *ctx, uint8_t gpio_state)
 Set state of the pins defined as GPIO read function.
 
void i2ctospi_enable_gpio (i2ctospi_t *ctx, uint8_t ss_pin_number)
 Enable the pins defined as GPIO function.
 
void i2ctospi_types_gpio (i2ctospi_t *ctx, i2ctospi_gpio_t *gpio)
 Enable the pins defined as GPIO function.
 

Detailed Description

This file contains API for I2C to SPI Click driver.