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

PCA9532 Driver extensions. More...

#include "sarmfsw.h"
#include "PCA9532.h"
Include dependency graph for PCA9532_ex.h:
This graph shows which files directly or indirectly include this file:

Data Structures

union  uPCA9532_REG_MAP
 PCA9532 Register map union. More...
 

Functions

FctERR PCA9532_Set_Auto_Increment (PCA9532_t *const pCpnt, const PCA95xx_reg_inc inc)
 Set auto increment option for PCA9532 registers.
 
FctERR PCA9532_Freq_To_Byte (uint8_t *const byte, const float freq)
 Convert Frequency to PSCx byte register.
 
FctERR PCA9532_DutyCycle_To_Byte (uint8_t *const byte, const float duty)
 Convert Frequency to PWMx byte register.
 
float PCA9532_Byte_To_Freq (const uint8_t freq)
 Convert PSCx byte register to Frequency (in Hz)
 
float PCA9532_Byte_To_Duty (const uint8_t duty)
 Convert PWMx byte register to Duty Cycle (in %)
 
FctERR PCA9532_ReadRegister (PCA9532_t *const pCpnt, const PCA9532_reg reg, uint8_t *const val)
 Read register from PCA9532.
 
FctERR PCA9532_Read_INPUT0 (PCA9532_t *const pCpnt, uPCA9532_REG__INPUT0 *const pINPUT0)
 Read LED0 to LED7 input register.
 
FctERR PCA9532_Read_INPUT1 (PCA9532_t *const pCpnt, uPCA9532_REG__INPUT1 *const pINPUT1)
 Read LED8 to LED15 input register.
 
FctERR PCA9532_Set_Mode_LED (PCA9532_t *const pCpnt, const PCA9xxx_chan chan, const PCA95xx_ledsel mode)
 Set PCA9532 peripheral LED mode.
 
FctERR PCA9532_Set_Mode_LEDs (PCA9532_t *const pCpnt, const uint16_t chans, const PCA95xx_ledsel mode)
 Set PCA9532 peripheral multiple LEDs mode.
 
FctERR PCA9532_SetFrequency (PCA9532_t *const pCpnt, const float freq, const bool index)
 Set PSCx frequency of PCA9532.
 
FctERR PCA9532_SetDuty (PCA9532_t *const pCpnt, const float duty, const bool index)
 Set PWMx duty cycle of PCA9532.
 
void PCA9532_RST_GPIO_Init (PCA9532_t *const pCpnt, GPIO_TypeDef *const GPIOx, const uint16_t GPIO_Pin, const GPIO_PinState GPIO_Active)
 Reset GPIO pin init for PCA9532.
 
void PCA9532_RST_GPIO_Set (PCA9532_t *const pCpnt, const bool state)
 Reset GPIO pin setter for PCA9532.
 

Detailed Description

PCA9532 Driver extensions.

Author
SMFSW

PCA9532: 16-bit I2C-bus LED dimmer

Function Documentation

◆ PCA9532_Byte_To_Duty()

float PCA9532_Byte_To_Duty ( const uint8_t duty)
inline

Convert PWMx byte register to Duty Cycle (in %)

Parameters
[in]duty- 8b PWMx register value
Returns
Frequency
Here is the caller graph for this function:

◆ PCA9532_Byte_To_Freq()

float PCA9532_Byte_To_Freq ( const uint8_t freq)
inline

Convert PSCx byte register to Frequency (in Hz)

Parameters
[in]freq- 8b PSCx register value
Returns
Frequency
Here is the caller graph for this function:

◆ PCA9532_DutyCycle_To_Byte()

FctERR PCA9532_DutyCycle_To_Byte ( uint8_t *const byte,
const float duty )

Convert Frequency to PWMx byte register.

Warning
Duty cycle can be set from 0% to 99.6%
Note
BLINKx(%) = (PWMx(8b) / 256) * 100
Parameters
[in,out]byte- Pointer to output value
[in]duty- Duty Cycle in %
Returns
FctERR - error code
Here is the caller graph for this function:

◆ PCA9532_Freq_To_Byte()

FctERR PCA9532_Freq_To_Byte ( uint8_t *const byte,
const float freq )

Convert Frequency to PSCx byte register.

Warning
beware for higher frequencies, 152Hz max (0 in reg) drops to 76Hz (1 in reg), 50Hz (3 in reg)....
Note
BLINKx(Hz) = (PSCx(8b) + 1) / 152
Parameters
[in,out]byte- Pointer to output value
[in]freq- Frequency in Hz (0.592Hz to 152Hz)
Returns
FctERR - error code
Here is the caller graph for this function:

◆ PCA9532_Read_INPUT0()

FctERR PCA9532_Read_INPUT0 ( PCA9532_t *const pCpnt,
uPCA9532_REG__INPUT0 *const pINPUT0 )

Read LED0 to LED7 input register.

Warning
TODO: test if working in auto-increment mode
Parameters
[in]pCpnt- Pointer to PCA9532 component
[in,out]pINPUT0- Pointer to INPUT0 output variable
Returns
FctERR - ErrorCode
Here is the call graph for this function:

◆ PCA9532_Read_INPUT1()

FctERR PCA9532_Read_INPUT1 ( PCA9532_t *const pCpnt,
uPCA9532_REG__INPUT1 *const pINPUT1 )

Read LED8 to LED15 input register.

Parameters
[in]pCpnt- Pointer to PCA9532 component
[in,out]pINPUT1- Pointer to INPUT1 output variable
Returns
FctERR - ErrorCode
Here is the call graph for this function:

◆ PCA9532_ReadRegister()

FctERR PCA9532_ReadRegister ( PCA9532_t *const pCpnt,
const PCA9532_reg reg,
uint8_t *const val )

Read register from PCA9532.

Parameters
[in]pCpnt- Pointer to PCA9532 component
[in]reg- Register address to read from
[in,out]val- Pointer to the data for receive
Returns
FctERR - ErrorCode
Here is the call graph for this function:

◆ PCA9532_RST_GPIO_Init()

void PCA9532_RST_GPIO_Init ( PCA9532_t *const pCpnt,
GPIO_TypeDef *const GPIOx,
const uint16_t GPIO_Pin,
const GPIO_PinState GPIO_Active )

Reset GPIO pin init for PCA9532.

Weak Functions
PCA9532 Reset GPIO pin init may be user implemented if needed
Parameters
[in]pCpnt- Pointer to PCA9532 component
[in]GPIOx- RST port
[in]GPIO_Pin- RST pin
[in]GPIO_ActiveRST pin active state
Here is the call graph for this function:

◆ PCA9532_RST_GPIO_Set()

void PCA9532_RST_GPIO_Set ( PCA9532_t *const pCpnt,
const bool state )

Reset GPIO pin setter for PCA9532.

Weak Functions
PCA9532 Reset GPIO pin setter may be user implemented if needed
Parameters
[in]pCpnt- Pointer to PCA9532 component
[in]state- state to write on RST pin (0: inactive, 1: active)
Here is the call graph for this function:

◆ PCA9532_Set_Auto_Increment()

FctERR PCA9532_Set_Auto_Increment ( PCA9532_t *const pCpnt,
const PCA95xx_reg_inc inc )

Set auto increment option for PCA9532 registers.

Parameters
[in,out]pCpnt- Pointer to PCA9532 component
[in]inc- auto increment option
Returns
FctERR - error code
Here is the caller graph for this function:

◆ PCA9532_Set_Mode_LED()

FctERR PCA9532_Set_Mode_LED ( PCA9532_t *const pCpnt,
const PCA9xxx_chan chan,
const PCA95xx_ledsel mode )

Set PCA9532 peripheral LED mode.

Parameters
[in,out]pCpnt- Pointer to PCA9532 component
[in]chan- PCA9532 channel
[in]mode- channel mode (on/off/PWM0/PWM1)
Returns
FctERR - error code
Here is the call graph for this function:

◆ PCA9532_Set_Mode_LEDs()

FctERR PCA9532_Set_Mode_LEDs ( PCA9532_t *const pCpnt,
const uint16_t chans,
const PCA95xx_ledsel mode )

Set PCA9532 peripheral multiple LEDs mode.

Parameters
[in,out]pCpnt- Pointer to PCA9532 component
[in]chans- PCA9532 channels mask (masked channels will be affected to new mode, other ones remaining unchanged)
[in]mode- channel mode (on/off/PWM0/PWM1)
Returns
FctERR - error code
Here is the call graph for this function:
Here is the caller graph for this function:

◆ PCA9532_SetDuty()

FctERR PCA9532_SetDuty ( PCA9532_t *const pCpnt,
const float duty,
const bool index )

Set PWMx duty cycle of PCA9532.

Parameters
[in,out]pCpnt- Pointer to PCA9532 component
[in]duty- Duty Cycle (in %)
[in]index- false: PWM0 / true: PWM1
Returns
FctERR - ErrorCode
Here is the call graph for this function:

◆ PCA9532_SetFrequency()

FctERR PCA9532_SetFrequency ( PCA9532_t *const pCpnt,
const float freq,
const bool index )

Set PSCx frequency of PCA9532.

Parameters
[in,out]pCpnt- Pointer to PCA9532 component
[in]freq- Frequency (in Hz)
[in]index- false: PSC0 / true: PSC1
Returns
FctERR - ErrorCode
Here is the call graph for this function: