G32R430 Device Driver Layer v1.0.4
G32R4xx Device Driver Layer API Reference
Exported_Macros_Helper

Macros

#define __DDL_I2C_FREQ_HZ_TO_MHZ(__PCLK__)
 Convert Peripheral Clock Frequency in Mhz.
#define __DDL_I2C_FREQ_MHZ_TO_HZ(__PCLK__)
 Convert Peripheral Clock Frequency in Hz.
#define __DDL_I2C_RISE_TIME(__FREQRANGE__, __SPEED__)
 Compute I2C Clock rising time.
#define __DDL_I2C_SPEED_TO_CCR(__PCLK__, __SPEED__, __DUTYCYCLE__)
 Compute Speed clock range to a Clock Control Register (I2C_CLKCTRL_CLKS) value.
#define __DDL_I2C_SPEED_STANDARD_TO_CCR(__PCLK__, __SPEED__)
 Compute Speed Standard clock range to a Clock Control Register (I2C_CLKCTRL_CLKS) value.
#define __DDL_I2C_SPEED_FAST_TO_CCR(__PCLK__, __SPEED__, __DUTYCYCLE__)
 Compute Speed Fast clock range to a Clock Control Register (I2C_CLKCTRL_CLKS) value.
#define __DDL_I2C_10BIT_ADDRESS(__ADDRESS__)
 Get the Least significant bits of a 10-Bits address.
#define __DDL_I2C_10BIT_HEADER_WRITE(__ADDRESS__)
 Convert a 10-Bits address to a 10-Bits header with Write direction.
#define __DDL_I2C_10BIT_HEADER_READ(__ADDRESS__)
 Convert a 10-Bits address to a 10-Bits header with Read direction.

Detailed Description

Macro Definition Documentation

◆ __DDL_I2C_10BIT_ADDRESS

#define __DDL_I2C_10BIT_ADDRESS ( __ADDRESS__)
Value:
((uint8_t)((uint16_t)((__ADDRESS__) & (uint16_t)(0x00FF))))

Get the Least significant bits of a 10-Bits address.

Parameters
__ADDRESS__This parameter must be a value of a 10-Bits slave address.
Return values
Valuebetween Min_Data=0x00 and Max_Data=0xFF

Definition at line 395 of file g32r4xx_ddl_i2c.h.

◆ __DDL_I2C_10BIT_HEADER_READ

#define __DDL_I2C_10BIT_HEADER_READ ( __ADDRESS__)
Value:
((uint8_t)((uint16_t)((uint16_t)(((uint16_t)((__ADDRESS__) & (uint16_t)(0x0300))) >> 7) | (uint16_t)(0xF1))))

Convert a 10-Bits address to a 10-Bits header with Read direction.

Parameters
__ADDRESS__This parameter must be a value of a 10-Bits slave address.
Return values
Valuebetween Min_Data=0xF1 and Max_Data=0xF7

Definition at line 409 of file g32r4xx_ddl_i2c.h.

◆ __DDL_I2C_10BIT_HEADER_WRITE

#define __DDL_I2C_10BIT_HEADER_WRITE ( __ADDRESS__)
Value:
((uint8_t)((uint16_t)((uint16_t)(((uint16_t)((__ADDRESS__) & (uint16_t)(0x0300))) >> 7) | (uint16_t)(0xF0))))

Convert a 10-Bits address to a 10-Bits header with Write direction.

Parameters
__ADDRESS__This parameter must be a value of a 10-Bits slave address.
Return values
Valuebetween Min_Data=0xF0 and Max_Data=0xF6

Definition at line 402 of file g32r4xx_ddl_i2c.h.

◆ __DDL_I2C_FREQ_HZ_TO_MHZ

#define __DDL_I2C_FREQ_HZ_TO_MHZ ( __PCLK__)
Value:
(uint32_t)((__PCLK__)/1000000U)

Convert Peripheral Clock Frequency in Mhz.

Parameters
__PCLK__This parameter must be a value of peripheral clock (in Hz).
Return values
Valueof peripheral clock (in Mhz)

Definition at line 339 of file g32r4xx_ddl_i2c.h.

◆ __DDL_I2C_FREQ_MHZ_TO_HZ

#define __DDL_I2C_FREQ_MHZ_TO_HZ ( __PCLK__)
Value:
(uint32_t)((__PCLK__)*1000000U)

Convert Peripheral Clock Frequency in Hz.

Parameters
__PCLK__This parameter must be a value of peripheral clock (in Mhz).
Return values
Valueof peripheral clock (in Hz)

Definition at line 346 of file g32r4xx_ddl_i2c.h.

◆ __DDL_I2C_RISE_TIME

#define __DDL_I2C_RISE_TIME ( __FREQRANGE__,
__SPEED__ )
Value:
(uint32_t)(((__SPEED__) <= DDL_I2C_MAX_SPEED_STANDARD) ? ((__FREQRANGE__) + 1U) : ((((__FREQRANGE__) * 300U) / 1000U) + 1U))
#define DDL_I2C_MAX_SPEED_STANDARD

Compute I2C Clock rising time.

Parameters
__FREQRANGE__This parameter must be a value of peripheral clock (in Mhz).
__SPEED__This parameter must be a value lower than 400kHz (in Hz).
Return values
Valuebetween Min_Data=0x02 and Max_Data=0xFF

Definition at line 354 of file g32r4xx_ddl_i2c.h.

◆ __DDL_I2C_SPEED_FAST_TO_CCR

#define __DDL_I2C_SPEED_FAST_TO_CCR ( __PCLK__,
__SPEED__,
__DUTYCYCLE__ )
Value:
(uint32_t)(((__DUTYCYCLE__) == DDL_I2C_DUTYCYCLE_2)? \
(((((__PCLK__) / ((__SPEED__) * 3U)) & I2C_CLKCTRL_CLKS) == 0U)? 1U:((__PCLK__) / ((__SPEED__) * 3U))) : \
(((((__PCLK__) / ((__SPEED__) * 25U)) & I2C_CLKCTRL_CLKS) == 0U)? 1U:((__PCLK__) / ((__SPEED__) * 25U))))
#define DDL_I2C_DUTYCYCLE_2

Compute Speed Fast clock range to a Clock Control Register (I2C_CLKCTRL_CLKS) value.

Parameters
__PCLK__This parameter must be a value of peripheral clock (in Hz).
__SPEED__This parameter must be a value between Min_Data=100Khz and Max_Data=400Khz (in Hz).
__DUTYCYCLE__This parameter can be one of the following values:
Return values
Valuebetween Min_Data=0x001 and Max_Data=0xFFF

Definition at line 386 of file g32r4xx_ddl_i2c.h.

◆ __DDL_I2C_SPEED_STANDARD_TO_CCR

#define __DDL_I2C_SPEED_STANDARD_TO_CCR ( __PCLK__,
__SPEED__ )
Value:
(uint32_t)(((((__PCLK__)/((__SPEED__) << 1U)) & I2C_CLKCTRL_CLKS) < 4U)? 4U:((__PCLK__) / ((__SPEED__) << 1U)))

Compute Speed Standard clock range to a Clock Control Register (I2C_CLKCTRL_CLKS) value.

Parameters
__PCLK__This parameter must be a value of peripheral clock (in Hz).
__SPEED__This parameter must be a value lower than 100kHz (in Hz).
Return values
Valuebetween Min_Data=0x004 and Max_Data=0xFFF.

Definition at line 375 of file g32r4xx_ddl_i2c.h.

◆ __DDL_I2C_SPEED_TO_CCR

#define __DDL_I2C_SPEED_TO_CCR ( __PCLK__,
__SPEED__,
__DUTYCYCLE__ )
Value:
(uint32_t)(((__SPEED__) <= DDL_I2C_MAX_SPEED_STANDARD)? \
(__DDL_I2C_SPEED_STANDARD_TO_CCR((__PCLK__), (__SPEED__))) : \
(__DDL_I2C_SPEED_FAST_TO_CCR((__PCLK__), (__SPEED__), (__DUTYCYCLE__))))
#define __DDL_I2C_SPEED_STANDARD_TO_CCR(__PCLK__, __SPEED__)
Compute Speed Standard clock range to a Clock Control Register (I2C_CLKCTRL_CLKS) value.
#define __DDL_I2C_SPEED_FAST_TO_CCR(__PCLK__, __SPEED__, __DUTYCYCLE__)
Compute Speed Fast clock range to a Clock Control Register (I2C_CLKCTRL_CLKS) value.

Compute Speed clock range to a Clock Control Register (I2C_CLKCTRL_CLKS) value.

Parameters
__PCLK__This parameter must be a value of peripheral clock (in Hz).
__SPEED__This parameter must be a value lower than 400kHz (in Hz).
__DUTYCYCLE__This parameter can be one of the following values:
Return values
Valuebetween Min_Data=0x004 and Max_Data=0xFFF, except in FAST DUTY mode where Min_Data=0x001.

Definition at line 365 of file g32r4xx_ddl_i2c.h.