c1x4rgb  2.1.0.0
Modules | Functions
1x4 RGB Click Driver

API for configuring and manipulating 1x4 RGB Click driver. More...

Modules

 1x4 RGB Registers List
 List of registers of 1x4 RGB Click driver.
 
 1x4 RGB Registers Settings
 Settings for registers of 1x4 RGB Click driver.
 
 1x4 RGB MikroBUS Map
 MikroBUS pin mapping of 1x4 RGB Click driver.
 

Functions

void c1x4rgb_cfg_setup (c1x4rgb_cfg_t *cfg)
 1x4 RGB configuration object setup function. More...
 
err_t c1x4rgb_init (c1x4rgb_t *ctx, c1x4rgb_cfg_t *cfg)
 1x4 RGB initialization function. More...
 
err_t c1x4rgb_default_cfg (c1x4rgb_t *ctx)
 1x4 RGB default configuration function. More...
 
err_t c1x4rgb_generic_write (c1x4rgb_t *ctx, uint16_t reg, uint8_t *data_in, uint8_t len)
 1x4 RGB I2C writing function. More...
 
err_t c1x4rgb_generic_read (c1x4rgb_t *ctx, uint16_t reg, uint8_t *data_out, uint8_t len)
 1x4 RGB I2C reading function. More...
 
err_t c1x4rgb_reg_write (c1x4rgb_t *ctx, uint16_t reg, uint8_t data_in)
 1x4 RGB register writing function. More...
 
err_t c1x4rgb_reg_read (c1x4rgb_t *ctx, uint16_t reg, uint8_t *data_out)
 1x4 RGB register reading function. More...
 
err_t c1x4rgb_chip_enable (c1x4rgb_t *ctx)
 1x4 RGB chip enable function. More...
 
err_t c1x4rgb_set_tmc_mode (c1x4rgb_t *ctx, uint8_t dev_cfg, uint8_t mode)
 1x4 RGB set TCM mode function. More...
 
err_t c1x4rgb_set_lsd_thold (c1x4rgb_t *ctx, uint8_t lsd_thold)
 1x4 RGB set LSD threshold function. More...
 
err_t c1x4rgb_set_command (c1x4rgb_t *ctx, uint8_t command)
 1x4 RGB set command function. More...
 
err_t c1x4rgb_get_tsd_cfg_status (c1x4rgb_t *ctx, uint8_t *status)
 1x4 RGB get TSD status function. More...
 
err_t c1x4rgb_enable_leds (c1x4rgb_t *ctx, uint16_t led_bitmask)
 1x4 RGB enable LEDs function. More...
 
err_t c1x4rgb_set_leds_illuminate (c1x4rgb_t *ctx, float duty_cycle)
 1x4 RGB set LEDs illuminate function. More...
 
err_t c1x4rgb_set_led_illuminate (c1x4rgb_t *ctx, uint8_t n_led, float duty_cycle)
 1x4 RGB set illuminate function. More...
 
err_t c1x4rgb_set_rgb_color (c1x4rgb_t *ctx, uint8_t led_pos, uint8_t red, uint8_t green, uint8_t blue)
 1x4 RGB set colors function. More...
 
err_t c1x4rgb_cfg_rgb_color (c1x4rgb_t *ctx, c1x4rgb_led_t led_cfg)
 1x4 RGB configure RGB colors function. More...
 
void c1x4rgb_set_sync (c1x4rgb_t *ctx, uint8_t sync)
 1x4 RGB set SYNC function. More...
 

Detailed Description

API for configuring and manipulating 1x4 RGB 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

◆ c1x4rgb_cfg_rgb_color()

err_t c1x4rgb_cfg_rgb_color ( c1x4rgb_t ctx,
c1x4rgb_led_t  led_cfg 
)

1x4 RGB configure RGB colors function.

This function configure the desired values of RGB colors for all LEDs by using the I2C serial interface.

Parameters
[in]ctx: Click context object. See c1x4rgb_t object definition for detailed explanation.
[in]led_cfg: LEDs configuration. See c1x4rgb_led_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ c1x4rgb_cfg_setup()

void c1x4rgb_cfg_setup ( c1x4rgb_cfg_t cfg)

1x4 RGB configuration object setup function.

This function initializes Click configuration structure to initial values.

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

◆ c1x4rgb_chip_enable()

err_t c1x4rgb_chip_enable ( c1x4rgb_t ctx)

1x4 RGB chip enable function.

This function enabled chip by using the I2C serial interface.

Parameters
[in]ctx: Click context object. See c1x4rgb_t object definition for detailed explanation.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ c1x4rgb_default_cfg()

err_t c1x4rgb_default_cfg ( c1x4rgb_t ctx)

1x4 RGB default configuration function.

This function executes a default configuration of 1x4 RGB Click board.

Parameters
[in]ctx: Click context object. See c1x4rgb_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.

◆ c1x4rgb_enable_leds()

err_t c1x4rgb_enable_leds ( c1x4rgb_t ctx,
uint16_t  led_bitmask 
)

1x4 RGB enable LEDs function.

This function turns on the desired LEDs by using the I2C serial interface.

Parameters
[in]ctx: Click context object. See c1x4rgb_t object definition for detailed explanation.
[in]led_bitmask: LEDs bitmasks (12 LEDs) [0x0000-0x0FFF].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ c1x4rgb_generic_read()

err_t c1x4rgb_generic_read ( c1x4rgb_t ctx,
uint16_t  reg,
uint8_t *  data_out,
uint8_t  len 
)

1x4 RGB I2C reading function.

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

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

◆ c1x4rgb_generic_write()

err_t c1x4rgb_generic_write ( c1x4rgb_t ctx,
uint16_t  reg,
uint8_t *  data_in,
uint8_t  len 
)

1x4 RGB I2C writing function.

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

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

◆ c1x4rgb_get_tsd_cfg_status()

err_t c1x4rgb_get_tsd_cfg_status ( c1x4rgb_t ctx,
uint8_t *  status 
)

1x4 RGB get TSD status function.

This function reads TSD configuration error status by using the I2C serial interface.

Parameters
[in]ctx: Click context object. See c1x4rgb_t object definition for detailed explanation.
[out]status: TSD configuration error status.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ c1x4rgb_init()

err_t c1x4rgb_init ( c1x4rgb_t ctx,
c1x4rgb_cfg_t cfg 
)

1x4 RGB initialization function.

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

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

◆ c1x4rgb_reg_read()

err_t c1x4rgb_reg_read ( c1x4rgb_t ctx,
uint16_t  reg,
uint8_t *  data_out 
)

1x4 RGB register reading function.

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

Parameters
[in]ctx: Click context object. See c1x4rgb_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.

◆ c1x4rgb_reg_write()

err_t c1x4rgb_reg_write ( c1x4rgb_t ctx,
uint16_t  reg,
uint8_t  data_in 
)

1x4 RGB register writing function.

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

Parameters
[in]ctx: Click context object. See c1x4rgb_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.

◆ c1x4rgb_set_command()

err_t c1x4rgb_set_command ( c1x4rgb_t ctx,
uint8_t  command 
)

1x4 RGB set command function.

This function sets the desired command by using the I2C serial interface.

Parameters
[in]ctx: Click context object. See c1x4rgb_t object definition for detailed explanation.
[in]command: Configuration command [C1X4RGB_REG_CMD_UPDATE-C1X4RGB_REG_CMD_CONTINUE].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ c1x4rgb_set_led_illuminate()

err_t c1x4rgb_set_led_illuminate ( c1x4rgb_t ctx,
uint8_t  n_led,
float  duty_cycle 
)

1x4 RGB set illuminate function.

This function sets the desired duty cycle of illumination for the selected LED by using the I2C serial interface.

Parameters
[in]ctx: Click context object. See c1x4rgb_t object definition for detailed explanation.
[in]n_led: LEDs number [0-12].
[in]duty_cycle: Duty cycle [0-100%].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ c1x4rgb_set_leds_illuminate()

err_t c1x4rgb_set_leds_illuminate ( c1x4rgb_t ctx,
float  duty_cycle 
)

1x4 RGB set LEDs illuminate function.

This function sets the desired duty cycle of illumination for all LEDs by using the I2C serial interface.

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

◆ c1x4rgb_set_lsd_thold()

err_t c1x4rgb_set_lsd_thold ( c1x4rgb_t ctx,
uint8_t  lsd_thold 
)

1x4 RGB set LSD threshold function.

This function sets the desired LSD detection threshold by using the I2C serial interface.

Parameters
[in]ctx: Click context object. See c1x4rgb_t object definition for detailed explanation.
[in]lsd_thold: LSD threshold.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ c1x4rgb_set_rgb_color()

err_t c1x4rgb_set_rgb_color ( c1x4rgb_t ctx,
uint8_t  led_pos,
uint8_t  red,
uint8_t  green,
uint8_t  blue 
)

1x4 RGB set colors function.

This function sets the desired values of RGB colors for the selected LED by using the I2C serial interface.

Parameters
[in]ctx: Click context object. See c1x4rgb_t object definition for detailed explanation.
[in]led_pos: LED position LD1-LD4 [0-3].
[in]red: Red color [0-255].
[in]green: Green color [0-255].
[in]blue: Blue color [0-255].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ c1x4rgb_set_sync()

void c1x4rgb_set_sync ( c1x4rgb_t ctx,
uint8_t  sync 
)

1x4 RGB set SYNC function.

This function sets the desired logic state of the SYC (PWM) pin.

Parameters
[in]ctx: Click context object. See c1x4rgb_t object definition for detailed explanation.
[in]sync: Logic state of the SYC (PWM) pin.
Returns
Nothing.
Note
None.

◆ c1x4rgb_set_tmc_mode()

err_t c1x4rgb_set_tmc_mode ( c1x4rgb_t ctx,
uint8_t  dev_cfg,
uint8_t  mode 
)

1x4 RGB set TCM mode function.

This function configure the desired LED drive mode as TCM 1/2/3/4 scans by using the I2C serial interface.

Parameters
[in]ctx: Click context object. See c1x4rgb_t object definition for detailed explanation.
[in]dev_cfg: Dev_config register address [C1X4RGB_REG_DEV_CFG_0-C1X4RGB_REG_DEV_CFG_12].
[in]mode: TCM mode [C1X4RGB_TCM_MODE_SCAN_1-C1X4RGB_TCM_MODE_SCAN_4].
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.