2021-03-02 11:45:47 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <api-hal-resources.h>
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
void api_hal_i2c_init();
|
|
|
|
|
2021-03-10 13:23:54 +00:00
|
|
|
bool api_hal_i2c_tx(
|
2021-03-02 11:45:47 +00:00
|
|
|
I2C_TypeDef* instance,
|
|
|
|
const uint8_t address,
|
|
|
|
const uint8_t* data,
|
2021-03-10 13:23:54 +00:00
|
|
|
const uint8_t size,
|
|
|
|
uint32_t timeout);
|
2021-03-02 11:45:47 +00:00
|
|
|
|
2021-03-10 13:23:54 +00:00
|
|
|
bool api_hal_i2c_rx(
|
2021-03-02 11:45:47 +00:00
|
|
|
I2C_TypeDef* instance,
|
|
|
|
const uint8_t address,
|
|
|
|
uint8_t* data,
|
2021-03-10 13:23:54 +00:00
|
|
|
const uint8_t size,
|
|
|
|
uint32_t timeout);
|
2021-03-02 11:45:47 +00:00
|
|
|
|
2021-03-10 13:23:54 +00:00
|
|
|
bool api_hal_i2c_trx(
|
2021-03-02 11:45:47 +00:00
|
|
|
I2C_TypeDef* instance,
|
|
|
|
const uint8_t address,
|
|
|
|
const uint8_t* tx_data,
|
|
|
|
const uint8_t tx_size,
|
|
|
|
uint8_t* rx_data,
|
2021-03-10 13:23:54 +00:00
|
|
|
const uint8_t rx_size,
|
|
|
|
uint32_t timeout);
|
2021-03-02 11:45:47 +00:00
|
|
|
|
|
|
|
#define with_api_hal_i2c(type, pointer, function_body) \
|
|
|
|
{ \
|
|
|
|
*pointer = ({ type __fn__ function_body __fn__; })(); \
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|