I2C_Drivers (ARM) 1.1
SMFSW collection of HAL I2C Drivers for ARM
Loading...
Searching...
No Matches
I2C_peripheral.h File Reference

I2C peripheral common. More...

#include <string.h>
#include "sarmfsw.h"
Include dependency graph for I2C_peripheral.h:
This graph shows which files directly or indirectly include this file:

Data Structures

struct  PeripheralGPIO_t
 i2c peripheral GPIO pin parameters More...
 

Macros

#define IS_I2C_PERIPHERAL(name, idx)
 Macro for use with assert_param to check I2C idx is existing for name peripheral.
 
#define IS_I2C_PERIPHERAL_ADDR(name, addr)
 Macro for use with assert_param to check I2C peripheral addr is valid for name peripheral.
 
#define I2C_PERIPHERAL_IDX(name, addr)
 Macro to get I2C peripheral index given addr for name peripheral.
 
#define I2C_PERIPHERAL_SET_DEFAULTS(name, idx)
 Macro to set working defaults for peripheral name on index idx.
 
#define I2C_PERIPHERAL_SET_DEFAULTS_SINGLETON(name)
 Macro to set working defaults for singleton peripheral name.
 

Functions

void I2C_peripheral_GPIO_init (PeripheralGPIO_t *const pGPIO, GPIO_TypeDef *const GPIOx, const uint16_t GPIO_Pin, const GPIO_PinState GPIO_Active)
 I2C peripheral GPIO pin init.
 
bool I2C_peripheral_GPIO_get (const PeripheralGPIO_t *const pGPIO)
 I2C peripheral GPIO pin getter.
 
void I2C_peripheral_GPIO_set (const PeripheralGPIO_t *const pGPIO, const bool state)
 I2C peripheral GPIO pin setter.
 

Detailed Description

I2C peripheral common.

Author
SMFSW

Macro Definition Documentation

◆ I2C_PERIPHERAL_IDX

#define I2C_PERIPHERAL_IDX ( name,
addr )
Value:
((uintCPU_t) (((name##_t *) addr) - name))

Macro to get I2C peripheral index given addr for name peripheral.

◆ I2C_PERIPHERAL_SET_DEFAULTS

#define I2C_PERIPHERAL_SET_DEFAULTS ( name,
idx )
Value:
UNUSED_RET memcpy(&name##_hal[idx], &name##_defaults, sizeof(I2C_slave_t)); \
name[idx].cfg.slave_inst = &name##_hal[idx];
i2c slave config and control parameters
Definition I2C_component.h:66

Macro to set working defaults for peripheral name on index idx.

◆ I2C_PERIPHERAL_SET_DEFAULTS_SINGLETON

#define I2C_PERIPHERAL_SET_DEFAULTS_SINGLETON ( name)
Value:
UNUSED_RET memcpy(&name##_hal, &name##_defaults, sizeof(I2C_slave_t)); \
name.cfg.slave_inst = &name##_hal;

Macro to set working defaults for singleton peripheral name.

◆ IS_I2C_PERIPHERAL

#define IS_I2C_PERIPHERAL ( name,
idx )
Value:
((idx) < I2C_##name##_NB)

Macro for use with assert_param to check I2C idx is existing for name peripheral.

◆ IS_I2C_PERIPHERAL_ADDR

#define IS_I2C_PERIPHERAL_ADDR ( name,
addr )
Value:
((I2C_PERIPHERAL_IDX(addr, name) >= 0) && \
(I2C_PERIPHERAL_IDX(addr, name) < I2C_##name##_NB))
#define I2C_PERIPHERAL_IDX(name, addr)
Macro to get I2C peripheral index given addr for name peripheral.
Definition I2C_peripheral.h:27

Macro for use with assert_param to check I2C peripheral addr is valid for name peripheral.

Function Documentation

◆ I2C_peripheral_GPIO_get()

bool I2C_peripheral_GPIO_get ( const PeripheralGPIO_t *const pGPIO)

I2C peripheral GPIO pin getter.

Parameters
[in]pGPIO- Pointer to GPIO structure instance
Returns
GPIO state value (0: inactive, 1: active)
Here is the caller graph for this function:

◆ I2C_peripheral_GPIO_init()

void I2C_peripheral_GPIO_init ( PeripheralGPIO_t *const pGPIO,
GPIO_TypeDef *const GPIOx,
const uint16_t GPIO_Pin,
const GPIO_PinState GPIO_Active )

I2C peripheral GPIO pin init.

Parameters
[in,out]pGPIO- Pointer to GPIO structure instance
[in]GPIOx- GPIO port
[in]GPIO_Pin- GPIO pin
[in]GPIO_ActiveGPIO pin active state
Here is the caller graph for this function:

◆ I2C_peripheral_GPIO_set()

void I2C_peripheral_GPIO_set ( const PeripheralGPIO_t *const pGPIO,
const bool state )

I2C peripheral GPIO pin setter.

Parameters
[in]pGPIO- Pointer to GPIO structure instance
[in]state- state to write on GPIO (0: inactive, 1: active)
Here is the caller graph for this function: