MTB CAT5 Peripheral driver library
 All Data Structures Functions Variables Typedefs Enumerations Enumerator Groups Pages

General Description

Functions

cy_en_scb_i2c_status_t Cy_SCB_I2C_Init (CySCB_Type *base, cy_stc_scb_i2c_config_t const *config, cy_stc_scb_i2c_context_t *context)
 
void Cy_SCB_I2C_DeInit (CySCB_Type *base)
 
__STATIC_INLINE void Cy_SCB_I2C_Enable (CySCB_Type *base)
 Enables the SCB block for the I2C operation. More...
 
void Cy_SCB_I2C_Disable (CySCB_Type *base, cy_stc_scb_i2c_context_t *context)
 
uint32_t Cy_SCB_I2C_SetDataRate (CySCB_Type *base, uint32_t dataRateHz, uint32_t scbClockHz)
 
uint32_t Cy_SCB_I2C_GetDataRate (CySCB_Type const *base, uint32_t scbClockHz)
 
__STATIC_INLINE void Cy_SCB_I2C_SlaveSetAddress (CySCB_Type *base, uint8_t addr)
 Sets the slave address for the I2C slave. More...
 
__STATIC_INLINE uint32_t Cy_SCB_I2C_SlaveGetAddress (CySCB_Type const *base)
 Returns the slave address of the I2C slave. More...
 
__STATIC_INLINE void Cy_SCB_I2C_SlaveSetAddressMask (CySCB_Type *base, uint8_t addrMask)
 Sets the slave address mask for the I2C slave. More...
 
__STATIC_INLINE uint32_t Cy_SCB_I2C_SlaveGetAddressMask (CySCB_Type const *base)
 Returns the slave address mask. More...
 
__STATIC_INLINE BOOL8 Cy_SCB_I2C_IsBusBusy (CySCB_Type const *base)
 Checks whether the I2C bus is busy. More...
 
__STATIC_INLINE void Cy_SCB_I2C_MasterSetLowPhaseDutyCycle (CySCB_Type *base, uint32_t clockCycles)
 This function sets the number of SCB clock cycles in the low phase of SCL. More...
 
__STATIC_INLINE void Cy_SCB_I2C_MasterSetHighPhaseDutyCycle (CySCB_Type *base, uint32_t clockCycles)
 This function sets the number of SCB clock cycles in the high phase of SCL. More...
 

Function Documentation

__STATIC_INLINE void Cy_SCB_I2C_Enable ( CySCB_Type base)

Enables the SCB block for the I2C operation.

Parameters
baseThe pointer to the I2C SCB instance.
Note
Ensure SCB is initialized with Cy_SCB_I2C_Init before calling this function
__STATIC_INLINE void Cy_SCB_I2C_SlaveSetAddress ( CySCB_Type base,
uint8_t  addr 
)

Sets the slave address for the I2C slave.

Parameters
baseThe pointer to the I2C SCB instance.
addrThe 7-bit right justified slave address.
__STATIC_INLINE uint32_t Cy_SCB_I2C_SlaveGetAddress ( CySCB_Type const *  base)

Returns the slave address of the I2C slave.

Parameters
baseThe pointer to the I2C SCB instance.
Returns
The 7-bit right justified slave address.
__STATIC_INLINE void Cy_SCB_I2C_SlaveSetAddressMask ( CySCB_Type base,
uint8_t  addrMask 
)

Sets the slave address mask for the I2C slave.

The LSBit must always be 0. In all other bit positions a 1 indicates that the incoming address must match the corresponding bit in the slave address. A 0 in the mask means that the incoming address does not need to match. Example Slave Address = 0x0C. Slave Address Mask = 0x08. This means that the hardware will accept both 0x08 and 0x0C as valid addresses.

Parameters
baseThe pointer to the I2C SCB instance.
addrMaskThe 8-bit address mask, the upper 7 bits correspond to the slave address. LSBit must always be 0.
__STATIC_INLINE uint32_t Cy_SCB_I2C_SlaveGetAddressMask ( CySCB_Type const *  base)

Returns the slave address mask.

Parameters
baseThe pointer to the I2C SCB instance.
Returns
The 8-bit address mask, the upper 7 bits correspond to the slave address. LSBit must always be 0.
__STATIC_INLINE BOOL8 Cy_SCB_I2C_IsBusBusy ( CySCB_Type const *  base)

Checks whether the I2C bus is busy.

Parameters
baseThe pointer to the I2C SCB instance.
Returns
A bus status: busy or not busy.
Note
After the SCB block is enabled or reset, the valid bus busy-status returns after half of the SCL period.
__STATIC_INLINE void Cy_SCB_I2C_MasterSetLowPhaseDutyCycle ( CySCB_Type base,
uint32_t  clockCycles 
)

This function sets the number of SCB clock cycles in the low phase of SCL.

If Cy_SCB_I2C_SetDataRate is called after this function, the values specified in this function are overwritten.

Parameters
baseThe pointer to the I2C SCB instance.
clockCyclesThe number of SCB clock cycles in the low phase of SCL. The valid range is 7 to 16.
Note
This function should be used at your own risk. Changing the number of clock cycles in a phase of SCL may violate the I2C specification. Make this change only while the block is disabled.
__STATIC_INLINE void Cy_SCB_I2C_MasterSetHighPhaseDutyCycle ( CySCB_Type base,
uint32_t  clockCycles 
)

This function sets the number of SCB clock cycles in the high phase of SCL.

If Cy_SCB_I2C_SetDataRate is called after this function, the values specified in this function get overwritten.

Parameters
baseThe pointer to the I2C SCB instance.
clockCyclesThe number of SCB clock cycles in the high phase of SCL. The valid range is 5 to 16.
Note
This function should be used at your own risk. Changing the number of clock cycles in a phase of SCL may violate the I2C specification. Make this change only while the block is disabled.