I2C driver APIs. More...
Data Structures | |
| struct | i2c_config_t |
| I2C config. More... | |
Typedefs | |
| typedef enum i2c_mode | i2c_mode_t |
| I2C mode. More... | |
| typedef enum i2c_seq_transfer_opt | i2c_seq_transfer_opt_t |
| I2c sequential transfer options. More... | |
Enumerations | |
| enum | { status_i2c_no_ack = ((uint32_t)( status_group_i2c )*1000U + (uint32_t)( 1 )) , status_i2c_invalid_data = ((uint32_t)( status_group_i2c )*1000U + (uint32_t)( 2 )) , status_i2c_no_addr_hit = ((uint32_t)( status_group_i2c )*1000U + (uint32_t)( 3 )) , status_i2c_transmit_not_completed = ((uint32_t)( status_group_i2c )*1000U + (uint32_t)( 4 )) , status_i2c_bus_busy = ((uint32_t)( status_group_i2c )*1000U + (uint32_t)( 5 )) , status_i2c_not_supported = ((uint32_t)( status_group_i2c )*1000U + (uint32_t)( 9 )) } |
| I2C status. More... | |
| enum | i2c_mode { i2c_mode_normal , i2c_mode_fast , i2c_mode_fast_plus } |
| I2C mode. More... | |
| enum | i2c_seq_transfer_opt { i2c_frist_frame = 0 , i2c_next_frame , i2c_last_frame } |
| I2c sequential transfer options. More... | |
Functions | |
| static void | i2c_respond_Nack (I2C_Type *ptr) |
| respond NACK More... | |
| static void | i2c_respond_ack (I2C_Type *ptr) |
| respond ACK More... | |
| static void | i2c_clear_fifo (I2C_Type *ptr) |
| clear I2C fifo More... | |
| static uint16_t | i2c_get_data_count (I2C_Type *ptr) |
| check data count More... | |
| static bool | i2c_fifo_is_full (I2C_Type *ptr) |
| check if I2C FIFO is full More... | |
| static bool | i2c_fifo_is_half (I2C_Type *ptr) |
| check if I2C FIFO is half More... | |
| static bool | i2c_fifo_is_empty (I2C_Type *ptr) |
| check if I2C FIFO is empty More... | |
| static bool | i2c_is_writing (I2C_Type *ptr) |
| check if I2C is writing More... | |
| static bool | i2c_is_reading (I2C_Type *ptr) |
| check if I2C is reading More... | |
| static bool | i2c_get_line_sda_status (I2C_Type *ptr) |
| get i2c sda line status More... | |
| static bool | i2c_get_line_scl_status (I2C_Type *ptr) |
| get i2c scl line status More... | |
| static void | i2c_clear_status (I2C_Type *ptr, uint32_t mask) |
| clear status More... | |
| static uint32_t | i2c_get_status (I2C_Type *ptr) |
| get status More... | |
| static uint32_t | i2c_get_irq_setting (I2C_Type *ptr) |
| i2c get interrupts setting More... | |
| static void | i2c_disable_irq (I2C_Type *ptr, uint32_t mask) |
| disable interrupts More... | |
| static void | i2c_enable_irq (I2C_Type *ptr, uint32_t mask) |
| enable interrupts More... | |
| static void | i2c_disable_auto_ack (I2C_Type *ptr) |
| disable auto ack More... | |
| static void | i2c_enable_auto_ack (I2C_Type *ptr) |
| enable auto ack More... | |
| static void | i2c_enable_10bit_address_mode (I2C_Type *ptr, bool enable) |
| enable 10 bit address mode More... | |
| hpm_stat_t | i2c_init_master (I2C_Type *ptr, uint32_t src_clk_in_hz, i2c_config_t *config) |
| I2C master initialization. More... | |
| hpm_stat_t | i2c_master_address_write (I2C_Type *ptr, const uint16_t device_address, uint8_t *addr, uint32_t addr_size_in_byte, uint8_t *buf, const uint32_t size_in_byte) |
| I2C master write data to specific address of certain slave device. More... | |
| hpm_stat_t | i2c_master_address_read (I2C_Type *ptr, const uint16_t device_address, uint8_t *addr, uint32_t addr_size_in_byte, uint8_t *buf, const uint32_t size_in_byte) |
| I2C master read data from specific address of certain slave device. More... | |
| hpm_stat_t | i2c_master_write (I2C_Type *ptr, const uint16_t device_address, uint8_t *buf, const uint32_t size) |
| I2C master write data to certain slave device. More... | |
| hpm_stat_t | i2c_master_start_dma_write (I2C_Type *i2c_ptr, const uint16_t device_address, uint32_t size) |
| I2C master start write data by DMA. More... | |
| hpm_stat_t | i2c_master_start_dma_read (I2C_Type *i2c_ptr, const uint16_t device_address, uint32_t size) |
| I2C master start read data by DMA. More... | |
| hpm_stat_t | i2c_master_read (I2C_Type *ptr, const uint16_t device_address, uint8_t *buf, const uint32_t size) |
| I2C master read data from certain slave device. More... | |
| hpm_stat_t | i2c_init_slave (I2C_Type *ptr, uint32_t src_clk_in_hz, i2c_config_t *config, const uint16_t slave_address) |
| I2C slave initialization. More... | |
| hpm_stat_t | i2c_slave_read (I2C_Type *ptr, uint8_t *buf, const uint32_t size) |
| I2C slave read data. More... | |
| hpm_stat_t | i2c_slave_write (I2C_Type *ptr, uint8_t *buf, const uint32_t size) |
| I2C slave write data. More... | |
| void | i2c_reset (I2C_Type *ptr) |
| reset I2C More... | |
| static void | i2c_dma_enable (I2C_Type *ptr) |
| Enable i2c DMA. More... | |
| static void | i2c_dma_disable (I2C_Type *ptr) |
| Disable i2c DMA. More... | |
| hpm_stat_t | i2c_slave_dma_transfer (I2C_Type *ptr, const uint32_t size) |
| I2C slave dma transfer data. More... | |
| static void | i2c_write_byte (I2C_Type *ptr, uint8_t data) |
| I2C write byte into FIFO. More... | |
| static uint8_t | i2c_read_byte (I2C_Type *ptr) |
| I2C read byte into FIFO. More... | |
| static uint8_t | i2c_get_direction (I2C_Type *ptr) |
| I2C get direction. More... | |
| hpm_stat_t | i2c_master_configure_transfer (I2C_Type *i2c_ptr, const uint16_t device_address, uint32_t size, bool read) |
| I2C master configure transfer setting. More... | |
| hpm_stat_t | i2c_master_seq_transmit_check_ack (I2C_Type *ptr, const uint16_t device_address, uint8_t *buf, const uint32_t size, i2c_seq_transfer_opt_t opt, bool ack_check) |
| sequential transmit in master I2C mode an amount of data and checks ACK in blocking More... | |
| hpm_stat_t | i2c_master_seq_receive (I2C_Type *ptr, const uint16_t device_address, uint8_t *buf, const uint32_t size, i2c_seq_transfer_opt_t opt) |
| sequential receive in master I2C mode an amount of data in blocking More... | |
| static void | i2c_gen_reset_signal (I2C_Type *ptr, uint8_t clk_len) |
| generate SCL clock as reset signal More... | |
| hpm_stat_t | i2c_master_transfer (I2C_Type *ptr, const uint16_t device_address, uint8_t *buf, const uint32_t size, uint16_t flags) |
| data transfer on master I2C mode in blocking More... | |
| static hpm_stat_t | i2c_set_data_count (I2C_Type *ptr, uint32_t size) |
| Set the I2C data transfer count. More... | |
| static void | i2c_master_issue_data_transmission (I2C_Type *ptr) |
| Trigger the I2C controller to issue a data transmission command. More... | |
| static void | i2c_master_set_slave_address (I2C_Type *ptr, uint16_t address) |
| Set the slave address for I2C master mode. More... | |
| static void | i2c_master_enable_start_phase (I2C_Type *ptr) |
| Enable start phase at the transaction. More... | |
| static void | i2c_master_disable_start_phase (I2C_Type *ptr) |
| Disable start phase at the transaction. More... | |
| static void | i2c_master_enable_addr_phase (I2C_Type *ptr) |
| Enable address phase at the transaction. More... | |
| static void | i2c_master_disable_addr_phase (I2C_Type *ptr) |
| Disable address phase at the transaction. More... | |
| static void | i2c_master_enable_data_phase (I2C_Type *ptr) |
| Enable data phase at the transaction. More... | |
| static void | i2c_master_disable_data_phase (I2C_Type *ptr) |
| Disable data phase at the transaction. More... | |
| static void | i2c_master_enable_stop_phase (I2C_Type *ptr) |
| Enable stop phase at the transaction. More... | |
| static void | i2c_master_disable_stop_phase (I2C_Type *ptr) |
| Disable stop phase at the transaction. More... | |
| static void | i2c_set_direction (I2C_Type *ptr, bool direction) |
| set i2c transaction direction More... | |
I2C driver APIs.
| #define I2C_ADDR_10BIT (1u << 2) /* this is a ten bit chip address */ |
#include <drivers/inc/hpm_i2c_drv.h>
| #define I2C_CMD_ACK (I2C_CMD_CMD_SET(2)) |
#include <drivers/inc/hpm_i2c_drv.h>
| #define I2C_CMD_CLEAR_FIFO (I2C_CMD_CMD_SET(4)) |
#include <drivers/inc/hpm_i2c_drv.h>
| #define I2C_CMD_ISSUE_DATA_TRANSMISSION (I2C_CMD_CMD_SET(1)) |
#include <drivers/inc/hpm_i2c_drv.h>
| #define I2C_CMD_NACK (I2C_CMD_CMD_SET(3)) |
#include <drivers/inc/hpm_i2c_drv.h>
| #define I2C_CMD_NO_ACTION (I2C_CMD_CMD_SET(0)) |
#include <drivers/inc/hpm_i2c_drv.h>
I2C CMD.
| #define I2C_CMD_RESET (I2C_CMD_CMD_SET(5)) |
#include <drivers/inc/hpm_i2c_drv.h>
| #define I2C_DATACNT_MAP | ( | x | ) | (((x) == I2C_SOC_TRANSFER_COUNT_MAX) ? 0 : x) |
#include <drivers/inc/hpm_i2c_drv.h>
| #define I2C_DIR_MASTER_READ (1U) |
#include <drivers/inc/hpm_i2c_drv.h>
| #define I2C_DIR_MASTER_WRITE (0U) |
#include <drivers/inc/hpm_i2c_drv.h>
I2C data direction.
| #define I2C_DIR_SLAVE_READ (0U) |
#include <drivers/inc/hpm_i2c_drv.h>
| #define I2C_DIR_SLAVE_WRITE (1U) |
#include <drivers/inc/hpm_i2c_drv.h>
| #define I2C_EVENT_ADDRESS_HIT I2C_INTEN_ADDRHIT_MASK |
#include <drivers/inc/hpm_i2c_drv.h>
| #define I2C_EVENT_ALL_MASK |
#include <drivers/inc/hpm_i2c_drv.h>
| #define I2C_EVENT_BYTE_RECEIVED I2C_INTEN_BYTERECV_MASK |
#include <drivers/inc/hpm_i2c_drv.h>
| #define I2C_EVENT_BYTE_TRANSMIT I2C_INTEN_BYTETRANS_MASK |
#include <drivers/inc/hpm_i2c_drv.h>
| #define I2C_EVENT_FIFO_EMPTY I2C_INTEN_FIFOEMPTY_MASK |
#include <drivers/inc/hpm_i2c_drv.h>
| #define I2C_EVENT_FIFO_FULL I2C_INTEN_FIFOFULL_MASK |
#include <drivers/inc/hpm_i2c_drv.h>
| #define I2C_EVENT_FIFO_HALF I2C_INTEN_FIFOHALF_MASK |
#include <drivers/inc/hpm_i2c_drv.h>
| #define I2C_EVENT_LOSS_ARBITRATION I2C_INTEN_ARBLOSE_MASK |
#include <drivers/inc/hpm_i2c_drv.h>
| #define I2C_EVENT_START_CONDITION I2C_INTEN_START_MASK |
#include <drivers/inc/hpm_i2c_drv.h>
| #define I2C_EVENT_STOP_CONDITION I2C_INTEN_STOP_MASK |
#include <drivers/inc/hpm_i2c_drv.h>
| #define I2C_EVENT_TRANSACTION_COMPLETE I2C_INTEN_CMPL_MASK |
#include <drivers/inc/hpm_i2c_drv.h>
I2C events for interrupt enable and status check.
| #define i2c_master_seq_transmit | ( | ptr, | |
| device_address, | |||
| buf, | |||
| size, | |||
| opt | |||
| ) | i2c_master_seq_transmit_check_ack(ptr, device_address, buf, size, opt, false) |
#include <drivers/inc/hpm_i2c_drv.h>
sequential transmit in master I2C mode an amount of data and checks ACK in blocking, but does not check for ACK signals.
| [in] | ptr | ptr I2C base address |
| [in] | device_address | I2C slave address |
| [in] | buf | pointer of the buffer to store data sent from device |
| [in] | size | size of data to be sent in bytes |
| [in] | opt | I2c sequential transfer options |
| hpm_stat_t | status_success if transmit is completed without any error |
| #define I2C_NO_ADDRESS (1u << 5) /* no address phase */ |
#include <drivers/inc/hpm_i2c_drv.h>
| #define I2C_NO_READ_ACK (1u << 6) /* when I2C reading, we do not ACK */ |
#include <drivers/inc/hpm_i2c_drv.h>
| #define I2C_NO_START (1u << 4) /* no start phase */ |
#include <drivers/inc/hpm_i2c_drv.h>
| #define I2C_NO_STOP (1u << 7) /* no stop phase */ |
#include <drivers/inc/hpm_i2c_drv.h>
| #define I2C_RD (1u << 0) /* not operable with write flags*/ |
#include <drivers/inc/hpm_i2c_drv.h>
| #define I2C_STATUS_ACK I2C_STATUS_ACK_MASK |
#include <drivers/inc/hpm_i2c_drv.h>
| #define I2C_STATUS_BUS_BUSY I2C_STATUS_BUSBUSY_MASK |
#include <drivers/inc/hpm_i2c_drv.h>
| #define I2C_STATUS_GENERAL_CALL I2C_STATUS_GENCALL_MASK |
#include <drivers/inc/hpm_i2c_drv.h>
| #define I2C_STATUS_LINE_SCL I2C_STATUS_LINESCL_MASK |
#include <drivers/inc/hpm_i2c_drv.h>
| #define I2C_STATUS_LINE_SDA I2C_STATUS_LINESDA_MASK |
#include <drivers/inc/hpm_i2c_drv.h>
I2C status for status check only.
| #define I2C_WR 0x0000 /* not operable with read flags*/ |
#include <drivers/inc/hpm_i2c_drv.h>
| #define I2C_WRITE_CHECK_ACK (1u << 8) /* when I2C writing, need check the slave returns ack */ |
#include <drivers/inc/hpm_i2c_drv.h>
| typedef enum i2c_mode i2c_mode_t |
#include <drivers/inc/hpm_i2c_drv.h>
I2C mode.
| typedef enum i2c_seq_transfer_opt i2c_seq_transfer_opt_t |
#include <drivers/inc/hpm_i2c_drv.h>
I2c sequential transfer options.
| anonymous enum |
#include <drivers/inc/hpm_i2c_drv.h>
I2C status.
| Enumerator | |
|---|---|
| status_i2c_no_ack | |
| status_i2c_invalid_data | |
| status_i2c_no_addr_hit | |
| status_i2c_transmit_not_completed | |
| status_i2c_bus_busy | |
| status_i2c_not_supported | |
| enum i2c_mode |
#include <drivers/inc/hpm_i2c_drv.h>
I2C mode.
| Enumerator | |
|---|---|
| i2c_mode_normal | |
| i2c_mode_fast | |
| i2c_mode_fast_plus | |
| enum i2c_seq_transfer_opt |
#include <drivers/inc/hpm_i2c_drv.h>
I2c sequential transfer options.
| Enumerator | |
|---|---|
| i2c_frist_frame | |
| i2c_next_frame | |
| i2c_last_frame | |
|
inlinestatic |
|
inlinestatic |
#include <drivers/inc/hpm_i2c_drv.h>
clear status
Clear status based on mask
| [in] | ptr | I2C base address |
| [in] | mask | mask to clear status |
|
inlinestatic |
#include <drivers/inc/hpm_i2c_drv.h>
disable auto ack
Disable I2C auto generates proper acknowledgements for each byte received
| [in] | ptr | I2C base address |
|
inlinestatic |
#include <drivers/inc/hpm_i2c_drv.h>
disable interrupts
Disable interrupts based on given mask
| [in] | ptr | I2C base address |
| [in] | mask | interrupt mask to be disabled |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
#include <drivers/inc/hpm_i2c_drv.h>
enable 10 bit address mode
enable 10 bit address mode, if not, address is 7 bit mode
| [in] | ptr | I2C base address |
| [in] | enable |
|
|
inlinestatic |
#include <drivers/inc/hpm_i2c_drv.h>
enable auto ack
Enable I2C auto generates proper acknowledgements for each byte received
| [in] | ptr | I2C base address |
|
inlinestatic |
#include <drivers/inc/hpm_i2c_drv.h>
enable interrupts
Enable interrupts based on given mask
| [in] | ptr | I2C base address |
| [in] | mask | interrupt mask to be enabled |
|
inlinestatic |
#include <drivers/inc/hpm_i2c_drv.h>
check if I2C FIFO is empty
| [in] | ptr | I2C base address |
| true | if FIFO is empty |
|
inlinestatic |
#include <drivers/inc/hpm_i2c_drv.h>
check if I2C FIFO is full
| [in] | ptr | I2C base address |
| true | if FIFO is full |
|
inlinestatic |
#include <drivers/inc/hpm_i2c_drv.h>
check if I2C FIFO is half
| [in] | ptr | I2C base address |
| true | if FIFO is half empty or full |
|
inlinestatic |
#include <drivers/inc/hpm_i2c_drv.h>
generate SCL clock as reset signal
| ptr | [in] ptr I2C base address | |
| [in] | clk_len | SCL clock length |
|
inlinestatic |
#include <drivers/inc/hpm_i2c_drv.h>
check data count
It indicates number of bytes to transfer
| [in] | ptr | I2C base address |
| data | count value in byte |
|
inlinestatic |
#include <drivers/inc/hpm_i2c_drv.h>
I2C get direction.
| ptr | [in] ptr I2C base address |
|
inlinestatic |
#include <drivers/inc/hpm_i2c_drv.h>
i2c get interrupts setting
Get interrupt setting register value
| [in] | ptr | I2C base address |
| [out] | uint32_t interrupt setting register value |
|
inlinestatic |
#include <drivers/inc/hpm_i2c_drv.h>
get i2c scl line status
| [in] | ptr | I2C base address |
| bool | value
|
|
inlinestatic |
#include <drivers/inc/hpm_i2c_drv.h>
get i2c sda line status
| [in] | ptr | I2C base address |
| bool | value
|
|
inlinestatic |
#include <drivers/inc/hpm_i2c_drv.h>
get status
Get current I2C status bits
| [in] | ptr | I2C base address |
| current | I2C status |
| hpm_stat_t i2c_init_master | ( | I2C_Type * | ptr, |
| uint32_t | src_clk_in_hz, | ||
| i2c_config_t * | config | ||
| ) |
#include <drivers/inc/hpm_i2c_drv.h>
I2C master initialization.
Initialized I2C controller working at master mode
| [in] | ptr | I2C base address |
| [in] | src_clk_in_hz | I2C controller source clock source frequency in Hz |
| [in] | config | i2c_config_t |
| hpm_stat_t | status_success if initialization is completed without any error |
| hpm_stat_t i2c_init_slave | ( | I2C_Type * | ptr, |
| uint32_t | src_clk_in_hz, | ||
| i2c_config_t * | config, | ||
| const uint16_t | slave_address | ||
| ) |
#include <drivers/inc/hpm_i2c_drv.h>
I2C slave initialization.
Initialize I2C controller working at slave mode
| [in] | ptr | I2C base address |
| [in] | src_clk_in_hz | I2C controller source clock source frequency in Hz |
| [in] | config | I2C configuration structure |
| [in] | slave_address | I2C address to be used at slave mode |
| hpm_stat_t | status_success if initialization is completed without any error |
|
inlinestatic |
#include <drivers/inc/hpm_i2c_drv.h>
check if I2C is reading
| [in] | ptr | I2C base address |
| bool | value
|
|
inlinestatic |
#include <drivers/inc/hpm_i2c_drv.h>
check if I2C is writing
| [in] | ptr | I2C base address |
| bool | value
|
| hpm_stat_t i2c_master_address_read | ( | I2C_Type * | ptr, |
| const uint16_t | device_address, | ||
| uint8_t * | addr, | ||
| uint32_t | addr_size_in_byte, | ||
| uint8_t * | buf, | ||
| const uint32_t | size_in_byte | ||
| ) |
#include <drivers/inc/hpm_i2c_drv.h>
I2C master read data from specific address of certain slave device.
Read fram certain I2C device at specific address within that device
| [in] | ptr | I2C base address |
| [in] | device_address | I2C slave address |
| [in] | addr | address in that I2C device |
| [in] | addr_size_in_byte | I2C address in byte |
| [out] | buf | pointer of the buffer to receive data read from the device |
| [in] | size_in_byte | size of data to be read in bytes |
| hpm_stat_t | status_success if reading is completed without any error |
| hpm_stat_t i2c_master_address_write | ( | I2C_Type * | ptr, |
| const uint16_t | device_address, | ||
| uint8_t * | addr, | ||
| uint32_t | addr_size_in_byte, | ||
| uint8_t * | buf, | ||
| const uint32_t | size_in_byte | ||
| ) |
#include <drivers/inc/hpm_i2c_drv.h>
I2C master write data to specific address of certain slave device.
Write to certain I2C device at specific address within that device
| [in] | ptr | I2C base address |
| [in] | device_address | I2C slave address |
| [in] | addr | address in that I2C device |
| [in] | addr_size_in_byte | I2C address in byte |
| [in] | buf | pointer of the data to be sent |
| [in] | size_in_byte | size of data to be sent in bytes |
| hpm_stat_t | status_success if writing is completed without any error |
| hpm_stat_t i2c_master_configure_transfer | ( | I2C_Type * | i2c_ptr, |
| const uint16_t | device_address, | ||
| uint32_t | size, | ||
| bool | read | ||
| ) |
#include <drivers/inc/hpm_i2c_drv.h>
I2C master configure transfer setting.
| i2c_ptr | [in] ptr I2C base address |
| device_address | [in] I2C slave address |
| size | [in] size of data to be transferred in bytes |
| read | [in] true for receive, false for transmit |
| hpm_stat_t | status_success if configuring transmission without any error |
|
inlinestatic |
#include <drivers/inc/hpm_i2c_drv.h>
Disable address phase at the transaction.
| [in] | ptr | ptr I2C base address |
|
inlinestatic |
#include <drivers/inc/hpm_i2c_drv.h>
Disable data phase at the transaction.
| [in] | ptr | ptr I2C base address |
|
inlinestatic |
#include <drivers/inc/hpm_i2c_drv.h>
Disable start phase at the transaction.
| [in] | ptr | ptr I2C base address |
|
inlinestatic |
#include <drivers/inc/hpm_i2c_drv.h>
Disable stop phase at the transaction.
| [in] | ptr | ptr I2C base address |
|
inlinestatic |
#include <drivers/inc/hpm_i2c_drv.h>
Enable address phase at the transaction.
| [in] | ptr | ptr I2C base address |
|
inlinestatic |
#include <drivers/inc/hpm_i2c_drv.h>
Enable data phase at the transaction.
| [in] | ptr | ptr I2C base address |
|
inlinestatic |
#include <drivers/inc/hpm_i2c_drv.h>
Enable start phase at the transaction.
| [in] | ptr | ptr I2C base address |
|
inlinestatic |
#include <drivers/inc/hpm_i2c_drv.h>
Enable stop phase at the transaction.
| [in] | ptr | ptr I2C base address |
|
inlinestatic |
#include <drivers/inc/hpm_i2c_drv.h>
Trigger the I2C controller to issue a data transmission command.
Its purpose is to send a command to the I2C controller, instructing it to initiate a data transmission transaction as the master device.
| [in] | ptr | I2C base address |
| hpm_stat_t i2c_master_read | ( | I2C_Type * | ptr, |
| const uint16_t | device_address, | ||
| uint8_t * | buf, | ||
| const uint32_t | size | ||
| ) |
#include <drivers/inc/hpm_i2c_drv.h>
I2C master read data from certain slave device.
Read data from I2C device
| [in] | ptr | I2C base address |
| [in] | device_address | I2C slave address |
| [out] | buf | pointer of the buffer to store data read from device |
| [in] | size | size of data to be read in bytes |
| hpm_stat_t | status_success if reading is completed without any error |
| hpm_stat_t i2c_master_seq_receive | ( | I2C_Type * | ptr, |
| const uint16_t | device_address, | ||
| uint8_t * | buf, | ||
| const uint32_t | size, | ||
| i2c_seq_transfer_opt_t | opt | ||
| ) |
#include <drivers/inc/hpm_i2c_drv.h>
sequential receive in master I2C mode an amount of data in blocking
| [in] | ptr | ptr I2C base address |
| [in] | device_address | I2C slave address |
| [in] | buf | pointer of the buffer to store data sent from device |
| [in] | size | size of data to be sent in bytes |
| [in] | opt | I2c sequential transfer options |
| hpm_stat_t | status_success if receive is completed without any error |
| hpm_stat_t i2c_master_seq_transmit_check_ack | ( | I2C_Type * | ptr, |
| const uint16_t | device_address, | ||
| uint8_t * | buf, | ||
| const uint32_t | size, | ||
| i2c_seq_transfer_opt_t | opt, | ||
| bool | ack_check | ||
| ) |
#include <drivers/inc/hpm_i2c_drv.h>
sequential transmit in master I2C mode an amount of data and checks ACK in blocking
| [in] | ptr | ptr I2C base address |
| [in] | device_address | I2C slave address |
| [in] | buf | pointer of the buffer to store data sent from device |
| [in] | size | size of data to be sent in bytes |
| [in] | opt | I2c sequential transfer options |
| [in] | ack_check | true to check ack, false to not check ack |
| hpm_stat_t | status_success if transmit is completed without any error |
|
inlinestatic |
#include <drivers/inc/hpm_i2c_drv.h>
Set the slave address for I2C master mode.
This function configures the slave address in I2C master mode by writing the processed slave address to the ADDR register of the I2C module.
| [in] | ptr | I2C base address |
| [in] | address | The slave address to be set, which is a 7-bit or 10-bit address depending on the I2C protocol |
| hpm_stat_t i2c_master_start_dma_read | ( | I2C_Type * | i2c_ptr, |
| const uint16_t | device_address, | ||
| uint32_t | size | ||
| ) |
#include <drivers/inc/hpm_i2c_drv.h>
I2C master start read data by DMA.
Read data to I2C device by DMA
| [in] | i2c_ptr | I2C base address |
| [in] | device_address | I2C slave address |
| [in] | size | size of data to be read in bytes |
| hpm_stat_t | status_success if starting transmission without any error |
| hpm_stat_t i2c_master_start_dma_write | ( | I2C_Type * | i2c_ptr, |
| const uint16_t | device_address, | ||
| uint32_t | size | ||
| ) |
#include <drivers/inc/hpm_i2c_drv.h>
I2C master start write data by DMA.
Write data to I2C device by DMA
| [in] | i2c_ptr | I2C base address |
| [in] | device_address | I2C slave address |
| [in] | size | size of data to be sent in bytes |
| hpm_stat_t | status_success if starting transmission without any error |
| hpm_stat_t i2c_master_transfer | ( | I2C_Type * | ptr, |
| const uint16_t | device_address, | ||
| uint8_t * | buf, | ||
| const uint32_t | size, | ||
| uint16_t | flags | ||
| ) |
#include <drivers/inc/hpm_i2c_drv.h>
data transfer on master I2C mode in blocking
| [in] | ptr | ptr I2C base address |
| [in] | device_address | I2C slave address |
| [in] | buf | pointer of the buffer to store data sent from device |
| [in] | size | size of data to be sent in bytes |
| [in] | flags | flag bit, which can be other flag bits except I2C_WR I2C_RD, and can perform "|" operation |
| hpm_stat_t | status_success if receive is completed without any error |
| hpm_stat_t i2c_master_write | ( | I2C_Type * | ptr, |
| const uint16_t | device_address, | ||
| uint8_t * | buf, | ||
| const uint32_t | size | ||
| ) |
#include <drivers/inc/hpm_i2c_drv.h>
I2C master write data to certain slave device.
Write data to I2C device
| [in] | ptr | I2C base address |
| [in] | device_address | I2C slave address |
| [in] | buf | pointer of the data to be sent |
| [in] | size | size of data to be sent in bytes |
| hpm_stat_t | status_success if writing is completed without any error |
|
inlinestatic |
#include <drivers/inc/hpm_i2c_drv.h>
I2C read byte into FIFO.
| ptr | [in] ptr I2C base address |
| void i2c_reset | ( | I2C_Type * | ptr | ) |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
#include <drivers/inc/hpm_i2c_drv.h>
Set the I2C data transfer count.
This function configures the I2C controller to specify the amount of data to be transferred. It ensures that the data size does not exceed the system's maximum transfer limit.
| [in] | ptr | I2C base address |
| [in] | size | The amount of data to be transferred, in bytes |
| hpm_stat_t | status_success if set without any error |
|
inlinestatic |
#include <drivers/inc/hpm_i2c_drv.h>
set i2c transaction direction
| [in] | ptr | ptr I2C base address |
| [in] | direction | Data transfer direction. for master mode, True for receiving data, False for transmitting data; for slave mode, it's the opposite. |
| hpm_stat_t i2c_slave_dma_transfer | ( | I2C_Type * | ptr, |
| const uint32_t | size | ||
| ) |
#include <drivers/inc/hpm_i2c_drv.h>
I2C slave dma transfer data.
| [in] | ptr | I2C base address |
| [in] | size | size of data in bytes |
| hpm_stat_t | status_success if configuring transmission without any error |
| hpm_stat_t i2c_slave_read | ( | I2C_Type * | ptr, |
| uint8_t * | buf, | ||
| const uint32_t | size | ||
| ) |
#include <drivers/inc/hpm_i2c_drv.h>
I2C slave read data.
Read data at slave mode
| [in] | ptr | I2C base address |
| [in] | buf | pointer of the buffer to store data read from device |
| [in] | size | size of data to be read in bytes |
| hpm_stat_t | status_success if reading is completed without any error |
| hpm_stat_t i2c_slave_write | ( | I2C_Type * | ptr, |
| uint8_t * | buf, | ||
| const uint32_t | size | ||
| ) |
#include <drivers/inc/hpm_i2c_drv.h>
I2C slave write data.
Write data at slave mode.
| [in] | ptr | I2C base address |
| [in] | buf | pointer of the buffer to store data sent from device |
| [in] | size | size of data to be sent in bytes |
| hpm_stat_t | status_success if writing is completed without any error |
|
inlinestatic |
#include <drivers/inc/hpm_i2c_drv.h>
I2C write byte into FIFO.
| ptr | [in] ptr I2C base address |
| data | [in] byte to ne sent |