i2ctospi 2.0.0.0
|
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. | |
void i2ctospi_cfg_setup | ( | i2ctospi_cfg_t * | cfg | ) |
Config Object Initialization function.
cfg | Click configuration structure. |
@description This function initializes click configuration structure to init state.
void i2ctospi_clear_interrupt | ( | i2ctospi_t * | ctx | ) |
Clear interrupt function.
ctx | Click object. |
@description Function clear interrupt is generated by the SC18IS602B after any SPI transmission has been completed.
void i2ctospi_config_spi | ( | i2ctospi_t * | ctx, |
uint8_t | config_data ) |
Configure SPI Interface function.
ctx | Click object. |
config_data | 8-bit configuration data: - bit [ 7 : 6 ] : reserved - bit [ 5 ] : ORDER: - 0 : MSB of the data word is transmitted first - 1 : LSB of the data word is transmitted first - bit [ 4 ] : reserved - bit [ 3 : 2 ] : MODE: - 0 : SPICLK LOW when idle; data clocked in on leading edge ( CPOL = 0, CPHA = 0 ); - 1 : SPICLK LOW when idle; data clocked in on trailing edge ( CPOL = 0, CPHA = 1 ); - 2 : SPICLK HIGH when idle; data clocked in on trailing edge ( CPOL = 1, CPHA = 0 ); - 3 : SPICLK HIGH when idle; data clocked in on leading edge ( CPOL = 1, CPHA = 1 ); - bit [ 1 : 0 ] : SPI clock rate - 0 : 1843 kHz; - 1 : 461 kHz; - 2 : 115 kHz; - 3 : 58 kHz; |
<br>description Function configure SPI Interface by write configuration the byte of data to the targeted [ I2CTOSPI_CONFIGURE_SPI ] register address of the SC18IS602B I2C-bus to SPI bridge on the I2C to SPI click board.
void i2ctospi_default_cfg | ( | i2ctospi_t * | ctx | ) |
Click Default Configuration function.
ctx | Click object. |
@description This function executes default configuration for I2cToSpi click.
void i2ctospi_enable_gpio | ( | i2ctospi_t * | ctx, |
uint8_t | ss_pin_number ) |
Enable the pins defined as GPIO function.
ctx | Click object. |
ss_pin_number | - 0x01 [ I2CTOSPI_CONFIGURE_GPIO_BIDIRECTIONAL_PORT_ENABLE_SS0 ] : SS0; - 0x02 [ I2CTOSPI_CONFIGURE_GPIO_BIDIRECTIONAL_PORT_ENABLE_SS1 ] : SS1; - 0x04 [ I2CTOSPI_CONFIGURE_GPIO_BIDIRECTIONAL_PORT_ENABLE_SS2 ] : SS2; - 0x08 [ I2CTOSPI_CONFIGURE_GPIO_BIDIRECTIONAL_PORT_ENABLE_SS3 ] : SS3; |
@description Function enable the pins defined as GPIO, the Slave Select pins ( SS0, SS1, SS2 and SS3 ) are configured to be used as slave select outputs by write 8-bit ss_pin_number data after write targeted [ I2CTOSPI_GPIO_ENABLE ] functio Id to the SC18IS602B I2C-bus to SPI bridge on the I2C to SPI click board.
void i2ctospi_generic_read | ( | i2ctospi_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | data_buf, | ||
uint8_t | len ) |
Generic read function.
ctx | Click object. |
reg | Register address. |
data_buf | Output data buf |
len | Number of the bytes to be read |
@description This function reads data from the desired register.
void i2ctospi_generic_write | ( | i2ctospi_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | data_buf, | ||
uint8_t | len ) |
Generic write function.
ctx | Click object. |
reg | Register address. |
data_buf | Data buf to be written. |
len | Number of the bytes in data buf. |
@description This function writes data to the desired register.
uint8_t i2ctospi_get_interrupt | ( | i2ctospi_t * | ctx | ) |
Gets state of the interrupt function.
ctx | Click object. |
@description Function gets state of the INT pin on I2C to SPI click board.
void i2ctospi_hw_reset | ( | i2ctospi_t * | ctx | ) |
Hardware reset function.
ctx | Click object. |
@description Function hardware reset I2C to SPI click board by cleared to '0' state of the RST pin, wait the 100 ms, sets to '1' state of the RST pin and wait another the 100 ms.
I2CTOSPI_RETVAL i2ctospi_init | ( | i2ctospi_t * | ctx, |
i2ctospi_cfg_t * | cfg ) |
Initialization function.
ctx | Click object. |
cfg | Click configuration structure. |
@description This function initializes all necessary pins and peripherals used for this click.
void i2ctospi_read_buffer_bytes | ( | i2ctospi_t * | ctx, |
i2ctospi_spi_t * | spi, | ||
uint8_t * | read_data ) |
Generic sequential read from the data buffer function.
ctx | Click object. |
spi | Spi object. Arguments: - reg_addr 8-bit register address. - n_bytes number of bytes to be written. |
read_data | Pointer to the memory location where data be stored |
@description Function sequential read data starts from the targeted 8-bit buffer register address of the SC18IS602B I2C-bus to SPI bridge on the I2C to SPI click board.
void i2ctospi_set_idle_mode | ( | i2ctospi_t * | ctx | ) |
Set Idle mode function.
ctx | Click object. |
@description Function set Idle mode, a low-power mode may be entered by sending the Idle Mode command to the targeted [ I2CTOSPI_IDLE_MODE ] register address SC18IS602B I2C-bus to SPI bridge on the I2C to SPI click board.
void i2ctospi_set_read_state_of_gpio | ( | i2ctospi_t * | ctx, |
uint8_t | gpio_state ) |
Set state of the pins defined as GPIO read function.
ctx | Click object. |
gpio_state | - 0x01 [ I2CTOSPI_CONFIGURE_GPIO_READ_PORT_ENABLE_SS0 ] : SS0; - 0x02 [ I2CTOSPI_CONFIGURE_GPIO_READ_PORT_ENABLE_SS1 ] : SS1; - 0x04 [ I2CTOSPI_CONFIGURE_GPIO_READ_PORT_ENABLE_SS2 ] : SS2; - 0x08 [ I2CTOSPI_CONFIGURE_GPIO_READ_PORT_ENABLE_SS3 ] : SS3; |
@description Function set the state of the pins defined as GPIO may be read into the SC18IS602B data buffer using the GPIO read by write 8-bit gpioState data to the after write targeted [ I2CTOSPI_GPIO_READ ] functio Id to the SC18IS602B I2C-bus to SPI bridge on the I2C to SPI click board.
void i2ctospi_set_write_state_of_gpio | ( | i2ctospi_t * | ctx, |
uint8_t | gpio_state ) |
Set state of the pins defined as GPIO write function.
ctx | Click object. |
gpio_state | - 0x01 [ I2CTOSPI_CONFIGURE_GPIO_WRITE_PORT_ENABLE_SS0 ] : SS0; - 0x02 [ I2CTOSPI_CONFIGURE_GPIO_WRITE_PORT_ENABLE_SS1 ] : SS1; - 0x04 [ I2CTOSPI_CONFIGURE_GPIO_WRITE_PORT_ENABLE_SS2 ] : SS2; - 0x08 [ I2CTOSPI_CONFIGURE_GPIO_WRITE_PORT_ENABLE_SS3 ] : SS3; |
@description Function set state of the pins defined as GPIO write determine the state of SS3, SS2, SS1, and SS0, if they are configured as GPIO.
void i2ctospi_spi_burst_read | ( | i2ctospi_t * | ctx, |
i2ctospi_spi_t * | spi, | ||
uint8_t * | read_data ) |
Generic SPI read - single address burst read function.
ctx | Click object. |
spi | Spi object. Arguments: - slave_device slave device ( SS0, SS1, SS2 or SS3 ). - function_id 8-bit function id data. - reg_addr 8-bit register address. - n_bytes number of bytes to be written. |
read_data | Pointer to the memory location where data be stored |
@description Function SPI burst read data from the targeted 8-bit register address of the SC18IS602B I2C-bus to SPI bridge on the I2C to SPI click board.
void i2ctospi_spi_burst_write | ( | i2ctospi_t * | ctx, |
i2ctospi_spi_t * | spi, | ||
uint8_t * | write_data ) |
Generic SPI write - single address burst write function.
ctx | Click object. |
spi | Spi object. Arguments: - slave_device slave device ( SS0, SS1, SS2 or SS3 ). - function_id 8-bit function id data. - reg_addr 8-bit register address. - n_bytes number of bytes to be written. |
write_data | Pointer to the data to be written |
@description Function SPI burst write data to the targeted 8-bit register address of the SC18IS602B I2C-bus to SPI bridge on the I2C to SPI click board.
uint8_t i2ctospi_spi_read_byte | ( | i2ctospi_t * | ctx, |
i2ctospi_spi_t * | spi ) |
Generic SPI read the byte of data from data buffer function.
ctx | Click object. |
spi | Spi object. Arguments: - slave_device slave device ( SS0, SS1, SS2 or SS3 ). - function_id 8-bit function id data. - reg_addr 8-bit register address. |
@description Function SPI read the byte of data from the targeted 8-bit register address of the SC18IS602B I2C-bus to SPI bridge on the I2C to SPI click board.
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.
ctx | Click object. |
spi | Spi object. Arguments: - slave_device slave device ( SS0, SS1, SS2 or SS3 ) - function_id 8-bit function id data. - reg_addr 8-bit register address. |
write_data | 8-bit data to write |
@description Function SPI write the byte of data to the targeted 8-bit register address of the SC18IS602B I2C-bus to SPI bridge on the I2C to SPI click board.
void i2ctospi_types_gpio | ( | i2ctospi_t * | ctx, |
i2ctospi_gpio_t * | gpio ) |
Enable the pins defined as GPIO function.
ctx | Click object. |
gpio | GPIO object. Arguments: ~ ss3_val - 0x00 : quasi-bidirectional; - 0x01 : push-pull; - 0x02 : input-only (high-impedance); - 0x03 : open-drain; ~ ss2_val - 0x00 : quasi-bidirectional; - 0x01 : push-pull; - 0x02 : input-only (high-impedance); - 0x03 : open-drain; ~ ss1_val - 0x00 : quasi-bidirectional; - 0x01 : push-pull; - 0x02 : input-only (high-impedance); - 0x03 : open-drain; ~ ss0_val - 0x00 : quasi-bidirectional; - 0x01 : push-pull; - 0x02 : input-only (high-impedance); - 0x03 : open-drain; |
@description Function enable the pins defined as GPIO configured by software to one of four types on a pin-by-pin basis by write types on a selected SS pins basis 8-bit data after write targeted [ _I2CTOSPI_GPIO_CONFIGURATION ] functio Id to the SC18IS602B I2C-bus to SPI bridge on the I2C to SPI click board.
void i2ctospi_write_command | ( | i2ctospi_t * | ctx, |
i2ctospi_spi_t * | spi, | ||
uint8_t | command_data ) |
Generic write command byte of data function.
ctx | Click object. |
spi | Spi object. Argument: - function_id 8-bit function id ( from 0xF0 to 0xF7 ) |
command_data | 8-bit command data |
@description Function write the bytes of data command to the 8-bit register address of the SC18IS602B I2C-bus to SPI bridge on the I2C to SPI click board.
void i2ctospi_write_enable | ( | i2ctospi_t * | ctx, |
uint8_t | ss_pin_data ) |
SPI EEPROM wite enable function.
ctx | Click object. |
ss_pin_data | - 0x01 : SS0; - 0x02 : SS1; - 0x04 : SS2; - 0x08 : SS3; |
@description Function SPI EEPROM wite enable by enable selected SPI port ( SS0, SS1, SS2 or SS3 ) SC18IS602B I2C-bus to SPI bridge on the I2C to SPI click board.