leddriver12 2.0.0.0
LED Driver 12 Click Driver

API for configuring and manipulating LED Driver 12 Click driver. More...

Topics

 LED Driver 12 Registers List
 List of registers of LED Driver 12 Click driver.
 
 LED Driver 12 Registers Settings
 Settings for registers of LED Driver 12 Click driver.
 
 LED Driver 12 MikroBUS Map
 MikroBUS pin mapping of LED Driver 12 Click driver.
 

Functions

void leddriver12_cfg_setup (leddriver12_cfg_t *cfg)
 LED Driver 12 configuration object setup function.
 
err_t leddriver12_init (leddriver12_t *ctx, leddriver12_cfg_t *cfg)
 LED Driver 12 initialization function.
 
err_t leddriver12_default_cfg (leddriver12_t *ctx)
 LED Driver 12 default configuration function.
 
err_t leddriver12_generic_write (leddriver12_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len)
 LED Driver 12 I2C writing function.
 
err_t leddriver12_generic_read (leddriver12_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len)
 LED Driver 12 I2C reading function.
 
err_t leddriver12_write_register (leddriver12_t *ctx, uint8_t reg, uint8_t data_in)
 LED Driver 12 write register function.
 
err_t leddriver12_read_register (leddriver12_t *ctx, uint8_t reg, uint8_t *data_out)
 LED Driver 12 read register function.
 
void leddriver12_set_rst_pin (leddriver12_t *ctx, uint8_t state)
 LED Driver 12 set rst pin function.
 
err_t leddriver12_set_led_config (leddriver12_t *ctx, uint8_t led_number, uint8_t led_cfg)
 LED Driver 12 set led config function.
 
err_t leddriver12_set_led_port_config (leddriver12_t *ctx, uint8_t led_port_number, uint8_t led_cfg)
 LED Driver 12 set led port config function.
 
err_t leddriver12_read_input_0 (leddriver12_t *ctx, uint8_t *data_out)
 LED Driver 12 read input 0 function.
 
err_t leddriver12_read_input_1 (leddriver12_t *ctx, uint8_t *data_out)
 LED Driver 12 read input 1 function.
 
err_t leddriver12_set_blink_period_pwm_0 (leddriver12_t *ctx, float blink_period)
 LED Driver 12 set blink period pwm 0 function.
 
err_t leddriver12_set_blink_period_pwm_1 (leddriver12_t *ctx, float blink_period)
 LED Driver 12 set blink period pwm 1 function.
 
err_t leddriver12_set_duty_cycle_pwm_0 (leddriver12_t *ctx, uint8_t duty_cycle)
 LED Driver 12 set duty cycle pwm 0 function.
 
err_t leddriver12_set_duty_cycle_pwm_1 (leddriver12_t *ctx, uint8_t duty_cycle)
 LED Driver 12 set duty cycle pwm 1 function.
 

Detailed Description

API for configuring and manipulating LED Driver 12 Click driver.

Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.

Function Documentation

◆ leddriver12_cfg_setup()

void leddriver12_cfg_setup ( leddriver12_cfg_t * cfg)

LED Driver 12 configuration object setup function.

This function initializes click configuration structure to initial values.

Parameters
[out]cfg: Click configuration structure. See leddriver12_cfg_t object definition for detailed explanation.
Returns
Nothing.
Note
The all used pins will be set to unconnected state.

◆ leddriver12_default_cfg()

err_t leddriver12_default_cfg ( leddriver12_t * ctx)

LED Driver 12 default configuration function.

This function executes a default configuration of LED Driver 12 click board.

Parameters
[in]ctx: Click context object. See leddriver12_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
This function can consist any necessary configuration or setting to put device into operating mode.

◆ leddriver12_generic_read()

err_t leddriver12_generic_read ( leddriver12_t * ctx,
uint8_t reg,
uint8_t * rx_buf,
uint8_t rx_len )

LED Driver 12 I2C reading function.

This function reads a desired number of data bytes starting from the selected register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See leddriver12_t object definition for detailed explanation.
[in]reg: Start register address.
[out]rx_buf: Output read data.
[in]rx_len: Number of bytes to be read.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ leddriver12_generic_write()

err_t leddriver12_generic_write ( leddriver12_t * ctx,
uint8_t reg,
uint8_t * tx_buf,
uint8_t tx_len )

LED Driver 12 I2C writing function.

This function writes a desired number of data bytes starting from the selected register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See leddriver12_t object definition for detailed explanation.
[in]reg: Start register address.
[in]tx_buf: Data to be written.
[in]tx_len: Number of bytes to be written.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ leddriver12_init()

err_t leddriver12_init ( leddriver12_t * ctx,
leddriver12_cfg_t * cfg )

LED Driver 12 initialization function.

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

Parameters
[out]ctx: Click context object. See leddriver12_t object definition for detailed explanation.
[in]cfg: Click configuration structure. See leddriver12_cfg_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ leddriver12_read_input_0()

err_t leddriver12_read_input_0 ( leddriver12_t * ctx,
uint8_t * data_out )

LED Driver 12 read input 0 function.

This function reads the input 0 register which contains the status of LEDs 0 to 7.

Parameters
[in]ctx: Click context object. See leddriver12_t object definition for detailed explanation.
[out]data_out: Input 0 register status.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ leddriver12_read_input_1()

err_t leddriver12_read_input_1 ( leddriver12_t * ctx,
uint8_t * data_out )

LED Driver 12 read input 1 function.

This function reads the input 1 register which contains the status of LEDs 8 to 15.

Parameters
[in]ctx: Click context object. See leddriver12_t object definition for detailed explanation.
[out]data_out: Input 1 register status.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ leddriver12_read_register()

err_t leddriver12_read_register ( leddriver12_t * ctx,
uint8_t reg,
uint8_t * data_out )

LED Driver 12 read register function.

This function reads a data byte from the selected register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See leddriver12_t object definition for detailed explanation.
[in]reg: Register address.
[out]data_out: Output read data.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ leddriver12_set_blink_period_pwm_0()

err_t leddriver12_set_blink_period_pwm_0 ( leddriver12_t * ctx,
float blink_period )

LED Driver 12 set blink period pwm 0 function.

This function sets the blink period of PWM 0 function.

Parameters
[in]ctx: Click context object. See leddriver12_t object definition for detailed explanation.
[in]blink_period: Blink period in seconds (MAX: 1.68421, MIN: 0.00657).
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ leddriver12_set_blink_period_pwm_1()

err_t leddriver12_set_blink_period_pwm_1 ( leddriver12_t * ctx,
float blink_period )

LED Driver 12 set blink period pwm 1 function.

This function sets the blink period of PWM 1 function.

Parameters
[in]ctx: Click context object. See leddriver12_t object definition for detailed explanation.
[in]blink_period: Blink period in seconds (MAX: 1.68421, MIN: 0.00657).
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ leddriver12_set_duty_cycle_pwm_0()

err_t leddriver12_set_duty_cycle_pwm_0 ( leddriver12_t * ctx,
uint8_t duty_cycle )

LED Driver 12 set duty cycle pwm 0 function.

This function sets the duty cycle of PWM 0.

Parameters
[in]ctx: Click context object. See leddriver12_t object definition for detailed explanation.
[in]duty_cycle: Duty cycle value [0x00-0xFF].
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ leddriver12_set_duty_cycle_pwm_1()

err_t leddriver12_set_duty_cycle_pwm_1 ( leddriver12_t * ctx,
uint8_t duty_cycle )

LED Driver 12 set duty cycle pwm 1 function.

This function sets the duty cycle of PWM 1.

Parameters
[in]ctx: Click context object. See leddriver12_t object definition for detailed explanation.
[in]duty_cycle: Duty cycle value [0x00-0xFF].
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ leddriver12_set_led_config()

err_t leddriver12_set_led_config ( leddriver12_t * ctx,
uint8_t led_number,
uint8_t led_cfg )

LED Driver 12 set led config function.

This function sets the specified LED config.

Parameters
[in]ctx: Click context object. See leddriver12_t object definition for detailed explanation.
[in]led_number: LED number [0-15 or 0xFF for all LEDs].
[in]led_cfg: LED config:
  • 0 - LED OFF,
  • 1 - LED ON,
  • 2 - LED to PWM 0,
  • 3 - LED to PWM 1.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ leddriver12_set_led_port_config()

err_t leddriver12_set_led_port_config ( leddriver12_t * ctx,
uint8_t led_port_number,
uint8_t led_cfg )

LED Driver 12 set led port config function.

This function sets the specified LED port config.

Parameters
[in]ctx: Click context object. See leddriver12_t object definition for detailed explanation.
[in]led_port_number: LED port number:
  • 0 - LEDs 0 to 3,
  • 1 - LEDs 4 to 7,
  • 2 - LEDs 8 to 11,
  • 3 - LEDs 12 to 15.
[in]led_cfg: LED config:
  • 0 - LED OFF,
  • 1 - LED ON,
  • 2 - LED to PWM 0,
  • 3 - LED to PWM 1.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ leddriver12_set_rst_pin()

void leddriver12_set_rst_pin ( leddriver12_t * ctx,
uint8_t state )

LED Driver 12 set rst pin function.

This function sets the RST pin logic state.

Parameters
[in]ctx: Click context object. See leddriver12_t object definition for detailed explanation.
[in]state: Pin logic state.
Returns
None.
Note
None.

◆ leddriver12_write_register()

err_t leddriver12_write_register ( leddriver12_t * ctx,
uint8_t reg,
uint8_t data_in )

LED Driver 12 write register function.

This function writes a data byte to the selected register by using I2C serial interface.

Parameters
[in]ctx: Click context object. See leddriver12_t object definition for detailed explanation.
[in]reg: Register address.
[in]data_in: Data to be written.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.