pwm 2.0.0.0
Public function

Functions

void pwm_cfg_setup (pwm_cfg_t *cfg)
 Config Object Initialization function.
 
PWM_RETVAL pwm_init (pwm_t *ctx, pwm_cfg_t *cfg)
 Initialization function.
 
void pwm_generic_write (pwm_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic write function.
 
void pwm_generic_read (pwm_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic read function.
 
void pwm_set_output (pwm_t *ctx, uint8_t en_ou)
 Output state set function.
 
void pwm_dev_config (pwm_t *ctx, uint8_t *config)
 Device configuration function.
 
void pwm_output_config (pwm_t *ctx, uint8_t *config1)
 Output configuration function.
 
void pwm_channel_state (pwm_t *ctx, uint8_t chann_id, uint8_t state)
 Channel state function.
 
void pwm_set_channel_raw (pwm_t *ctx, uint8_t chann_id, uint16_t raw_off_set, uint16_t raw_dc)
 Set channel raw function.
 
void pwm_all_chann_state (pwm_t *ctx, uint8_t state)
 All channels state function.
 
void pwm_set_pre_scale (pwm_t *ctx, uint8_t pre_scale)
 Set pre scale function.
 
void pwm_set_all_raw (pwm_t *ctx, uint16_t raw_dc)
 Set all channels raw function.
 

Detailed Description

Function Documentation

◆ pwm_all_chann_state()

void pwm_all_chann_state ( pwm_t * ctx,
uint8_t state )

All channels state function.

Parameters
ctxClick object.
stateif set to :
  • '0' : output is disabled
  • '1' : output is enabled

@description This function is used to set the state of all channels.

◆ pwm_cfg_setup()

void pwm_cfg_setup ( pwm_cfg_t * cfg)

Config Object Initialization function.

Parameters
cfgClick configuration structure.

@description This function initializes click configuration structure to init state.

Note
All used pins will be set to unconnected state.

◆ pwm_channel_state()

void pwm_channel_state ( pwm_t * ctx,
uint8_t chann_id,
uint8_t state )

Channel state function.

Parameters
ctxClick object.
chann_id4-bit value that defines what channel is used
stateif set to :
  • '0' : output is disabled
  • '1' : output is enabled

@description This function is used to set the state of a specific channel.

◆ pwm_dev_config()

void pwm_dev_config ( pwm_t * ctx,
uint8_t * config )

Device configuration function.

Parameters
ctxClick object.
config[0]if set to :
  • '0' : does not respond to All Call I2C-bus address
  • '1' : responds to All Call I2C-bus address
config[1]if set to :
  • '0' : does not respond to I2C-bus subaddress 3
  • '1' : responds to I2C-bus subaddress 3
config[2]if set to :
  • '0' : does not respond to I2C-bus subaddress 2
  • '1' : responds to I2C-bus subaddress 2
config[3]if set to :
  • '0' : does not respond to I2C-bus subaddress 1
  • '1' : responds to I2C-bus subaddress 1
config[4]if set to :
  • '0' : Normal mode
  • '1' : Low power mode, oscillator off
config[5]if set to :
  • '0' : Restart disabled
  • '1' : Restart enabled

@description This function configuration the device.

◆ pwm_generic_read()

void pwm_generic_read ( pwm_t * ctx,
uint8_t reg,
uint8_t * data_buf,
uint8_t len )

Generic read function.

Parameters
ctxClick object.
regRegister address.
data_bufOutput data buf
lenNumber of the bytes to be read

@description This function reads data from the desired register.

◆ pwm_generic_write()

void pwm_generic_write ( pwm_t * ctx,
uint8_t reg,
uint8_t * data_buf,
uint8_t len )

Generic write function.

Parameters
ctxClick object.
regRegister address.
data_bufData buf to be written.
lenNumber of the bytes in data buf.

@description This function writes data to the desired register.

◆ pwm_init()

PWM_RETVAL pwm_init ( pwm_t * ctx,
pwm_cfg_t * cfg )

Initialization function.

Parameters
ctxClick object.
cfgClick configuration structure.

@description This function initializes all necessary pins and peripherals used for this click.

◆ pwm_output_config()

void pwm_output_config ( pwm_t * ctx,
uint8_t * config1 )

Output configuration function.

Parameters
ctxClick object.
config[0]if set to :
  • '0' : output drivers not enabled
  • '1' : if out = 1 drivers are enabled
  • '2' : output drivers not enabled( high-impedance )
config1[1]if set to :
  • '0' : outputs are configured with an open-drain structure
  • '1' : outputs are configured with a totem pole structure
config1[2]if set to :
  • '0' : outputs change on STOP command
  • '1' : outputs change on ACK
config1[3]if set to :
  • '0' : output logic state not inverted; value to use when external driver used
  • '1' : output logic state inverted; value to use when no external driver used

@description This function configuration output.

◆ pwm_set_all_raw()

void pwm_set_all_raw ( pwm_t * ctx,
uint16_t raw_dc )

Set all channels raw function.

Parameters
ctxClick object.
raw_dc12-bit value that defines raw DC

@description This function is used to set all channels output with raw data.

◆ pwm_set_channel_raw()

void pwm_set_channel_raw ( pwm_t * ctx,
uint8_t chann_id,
uint16_t raw_off_set,
uint16_t raw_dc )

Set channel raw function.

Parameters
ctxClick object.
chann_id4-bit value that defines what channel is used
raw_off_set12-bit value that defines raw offset
raw_dc12-bit value that defines raw DC

@description This function is used to specific set channel output with data.

◆ pwm_set_output()

void pwm_set_output ( pwm_t * ctx,
uint8_t en_ou )

Output state set function.

Parameters
ctxClick object.
en_ouClick object.

@description This function set output state.

◆ pwm_set_pre_scale()

void pwm_set_pre_scale ( pwm_t * ctx,
uint8_t pre_scale )

Set pre scale function.

Parameters
ctxClick object.
pre_scale8-bit value that defines the frequency

@description This function uses prescaler to program the PWM output frequency.