![]() |
no-OS
|
Header file of LTC3220 Driver. More...
Classes | |
| struct | ltc3220_command_cfg |
| struct | ltc3220_uled_cfg |
| struct | ltc3220_blink_cfg |
| struct | ltc3220_grad_cfg |
| struct | ltc3220_dev |
| struct | ltc3220_init_param |
Macros | |
| #define | __LTC3220_H__ |
| #define | LTC3220_REG_COMMAND 0x00 |
| #define | LTC3220_REG_START_ULED 0x01 /*ULED1 */ |
| #define | LTC3220_REG_END_ULED 0x12 /*ULED18*/ |
| #define | LTC3220_REG_BLINK_GRAD 0x13 |
| #define | LTC3220_COMMAND_QUICK_WRITE_MASK NO_OS_BIT(0) |
| #define | LTC3220_COMMAND_1P5X_MASK NO_OS_BIT(1) |
| #define | LTC3220_COMMAND_2X_MASK NO_OS_BIT(2) |
| #define | LTC3220_COMMAND_SHUTDOWN NO_OS_BIT(3) |
| #define | LTC3220_ULED_MODE_MASK NO_OS_GENMASK(7,6) |
| #define | LTC3220_ULED_CURRENT_MASK NO_OS_GENMASK(5,0) |
| #define | LTC3220_ULED_CURRENT_MAX_STEP 64 |
| #define | LTC3220_BLINK_LONG_MASK NO_OS_BIT(4) |
| #define | LTC3220_BLINK_FAST_MASK NO_OS_BIT(3) |
| #define | LTC3220_GRAD_SPD_MASK NO_OS_GENMASK(2,1) |
| #define | LTC3220_GRAD_DIRECTION_MASK NO_OS_BIT(0) |
| #define | LTC3220_GRAD_MAX_SPD 3 |
| #define | LTC3220_RESET_DELAY_USEC 1 /*20ns min */ |
Enumerations | |
| enum | ltc3220_variant { LTC3220 = 0x1C , LTC3220_1 = 0x1D } |
| enum | ltc3220_uled_mode { LTC3220_MODE_NORMAL = 0 , LTC3220_MODE_BLINK , LTC3220_MODE_GRADATION , LTC3220_MODE_GPO } |
Functions | |
| int | ltc3220_init (struct ltc3220_dev **device, struct ltc3220_init_param init_param) |
| Initializes the LTC3220 device structure. | |
| int | ltc3220_remove (struct ltc3220_dev *device) |
| Deallocates the resources for the device structure. | |
| int | ltc3220_reset (struct ltc3220_dev *device) |
| Resets the device using the RST pin. | |
| int | ltc3220_reg_write (struct ltc3220_dev *device, uint8_t reg_addr, uint8_t reg_data) |
| Writes to the selected register on the device. | |
| int | ltc3220_set_uled_mode (struct ltc3220_dev *device, uint8_t uled_number, enum ltc3220_uled_mode mode) |
| Sets the selected ULED register's operating mode. | |
| int | ltc3220_set_uled_current (struct ltc3220_dev *device, uint8_t uled_number, uint8_t current_level) |
| Sets the selected ULED register's current strength. | |
| int | ltc3220_update_reg_uled (struct ltc3220_dev *device, uint8_t uled_number, enum ltc3220_uled_mode mode, uint8_t current_level) |
| Updates the configuration set on the device's ULED based on the config. | |
| int | ltc3220_set_blink_fast (struct ltc3220_dev *device, bool is_fast_on) |
| Sets the configuration for blinking mode of ULEDs. | |
| int | ltc3220_set_blink_long (struct ltc3220_dev *device, bool is_long_period) |
| Sets the configuration for blinking mode of ULEDs. | |
| int | ltc3220_set_grad_speed (struct ltc3220_dev *device, uint8_t speed) |
| Sets the configuration of the device's speed of gradation. | |
| int | ltc3220_set_grad_increasing (struct ltc3220_dev *device, bool is_increasing) |
| Sets the configuration for the device's direction of gradation. | |
| int | ltc3220_update_reg_blink_grad (struct ltc3220_dev *device, bool is_blink_fast, bool is_blink_long, bool is_grad_inc, uint8_t grad_speed) |
| Updates the configuration set on the device's Blink/Gradation based on the config. | |
| int | ltc3220_set_quick_write (struct ltc3220_dev *device, bool is_quick_write) |
| Sets the configuration to perform a quick write to the device. | |
| int | ltc3220_set_cpo_1x (struct ltc3220_dev *device, bool is_force_cpo_1x) |
| Sets the device's charge pump to output 1x of operating voltage. | |
| int | ltc3220_set_cpo_1p5x (struct ltc3220_dev *device, bool is_force_cpo_1p5x) |
| Sets the device's charge pump to output 1.5x of operating voltage. | |
| int | ltc3220_set_cpo_2x (struct ltc3220_dev *device, bool is_force_cpo_2x) |
| Sets the device's charge pump to output 2x of operating voltage. | |
| int | ltc3220_set_shutdown (struct ltc3220_dev *device, bool is_shutdown) |
| Sets the device to shutdown mode, while retaining the register configurations. | |
| int | ltc3220_update_reg_command (struct ltc3220_dev *device, bool is_shutdown, bool is_force_cpo_2x, bool is_force_cpo_1p5x, bool is_quick_write) |
| Updates the configuration set on the. | |
Header file of LTC3220 Driver.
Copyright 2025(c) Analog Devices, Inc.
SPDX-License-Identifier: BSD-3-Clause
| #define __LTC3220_H__ |
| #define LTC3220_BLINK_FAST_MASK NO_OS_BIT(3) |
| #define LTC3220_BLINK_LONG_MASK NO_OS_BIT(4) |
| #define LTC3220_COMMAND_1P5X_MASK NO_OS_BIT(1) |
| #define LTC3220_COMMAND_2X_MASK NO_OS_BIT(2) |
| #define LTC3220_COMMAND_QUICK_WRITE_MASK NO_OS_BIT(0) |
| #define LTC3220_COMMAND_SHUTDOWN NO_OS_BIT(3) |
| #define LTC3220_GRAD_DIRECTION_MASK NO_OS_BIT(0) |
| #define LTC3220_GRAD_MAX_SPD 3 |
| #define LTC3220_GRAD_SPD_MASK NO_OS_GENMASK(2,1) |
| #define LTC3220_REG_BLINK_GRAD 0x13 |
| #define LTC3220_REG_COMMAND 0x00 |
| #define LTC3220_REG_END_ULED 0x12 /*ULED18*/ |
| #define LTC3220_REG_START_ULED 0x01 /*ULED1 */ |
| #define LTC3220_RESET_DELAY_USEC 1 /*20ns min */ |
| #define LTC3220_ULED_CURRENT_MASK NO_OS_GENMASK(5,0) |
| #define LTC3220_ULED_CURRENT_MAX_STEP 64 |
| #define LTC3220_ULED_MODE_MASK NO_OS_GENMASK(7,6) |
| enum ltc3220_uled_mode |
| enum ltc3220_variant |
| int ltc3220_init | ( | struct ltc3220_dev ** | device, |
| struct ltc3220_init_param | init_param ) |
Initializes the LTC3220 device structure.
| device | - The device structure to initialize. |
| init_param | - The initialization parameters. |
| int ltc3220_reg_write | ( | struct ltc3220_dev * | device, |
| uint8_t | reg_addr, | ||
| uint8_t | reg_data ) |
Writes to the selected register on the device.
| device | - The device structure. |
| reg_addr | - The register sub-address. |
| reg_data | - The data to write into the register (8-bits wide) |
| int ltc3220_remove | ( | struct ltc3220_dev * | device | ) |
Deallocates the resources for the device structure.
| device | - The device structure. |
| int ltc3220_reset | ( | struct ltc3220_dev * | device | ) |
Resets the device using the RST pin.
| device | - the device structure. |
| int ltc3220_set_blink_fast | ( | struct ltc3220_dev * | device, |
| bool | is_fast_on ) |
Sets the configuration for blinking mode of ULEDs.
| device | - The device structure. |
| is_fast_on | - Sets whether blinking should turn on fast (0.156s) or not (0.625s) |
| int ltc3220_set_blink_long | ( | struct ltc3220_dev * | device, |
| bool | is_long_period ) |
Sets the configuration for blinking mode of ULEDs.
| device | - The device structure. |
| is_long_period | - Sets whether blinking should have a shorter (1.25s) or longer (2.5s) period |
| int ltc3220_set_cpo_1p5x | ( | struct ltc3220_dev * | device, |
| bool | is_force_cpo_1p5x ) |
Sets the device's charge pump to output 1.5x of operating voltage.
| device | - The device structure. |
| is_force_cpo_1p5x | - Sets the device's to use 1.5x voltage. |
| int ltc3220_set_cpo_1x | ( | struct ltc3220_dev * | device, |
| bool | is_force_cpo_1x ) |
Sets the device's charge pump to output 1x of operating voltage.
| device | - The device structure. |
| is_force_cpo_1x | - Sets the device's to use 1x voltage. |
| device | - The device structure. |
| is_force_cpo_1x | - Set if the device's is to use 1x voltage. |
| int ltc3220_set_cpo_2x | ( | struct ltc3220_dev * | device, |
| bool | is_force_cpo_2x ) |
Sets the device's charge pump to output 2x of operating voltage.
| device | - The device structure. |
| is_force_cpo_2x | - Sets the device's to use 2x voltage. |
| int ltc3220_set_grad_increasing | ( | struct ltc3220_dev * | device, |
| bool | is_increasing ) |
Sets the configuration for the device's direction of gradation.
| device | - The device structure. |
| is_increasing | - Set for increasing gradation, unset if decreasing gradation. |
| int ltc3220_set_grad_speed | ( | struct ltc3220_dev * | device, |
| uint8_t | speed ) |
Sets the configuration of the device's speed of gradation.
| device | - The device structure. |
| speed | - Sets the speed of gradation, with slowest speed at max setting (3). Set to 0 to disable gradation. |
| int ltc3220_set_quick_write | ( | struct ltc3220_dev * | device, |
| bool | is_quick_write ) |
Sets the configuration to perform a quick write to the device.
| device | - The device structure. |
| is_quick_write | - Set for quick write operation. This copies the configuration set on ULED1 to all other ULED registers. |
| int ltc3220_set_shutdown | ( | struct ltc3220_dev * | device, |
| bool | is_shutdown ) |
Sets the device to shutdown mode, while retaining the register configurations.
| device | - The device structure. |
| is_shutdown | - Signals the device to shutdown. |
| int ltc3220_set_uled_current | ( | struct ltc3220_dev * | device, |
| uint8_t | uled_number, | ||
| uint8_t | current_level ) |
Sets the selected ULED register's current strength.
| device | - The device structure. |
| uled_number | - The ULED to select (1-indexed). |
| current_level | - The current strength from 0 to 20mA to set on the corresponding ULED pin (64 levels) |
| device | - The device structure. |
| uled_number | - The ULED to select (1-indexed). |
| current_level | - The current strength from 0 to 20mA to set on the corresponding ULED pin (64 levels) |
| int ltc3220_set_uled_mode | ( | struct ltc3220_dev * | device, |
| uint8_t | uled_number, | ||
| enum ltc3220_uled_mode | mode ) |
Sets the selected ULED register's operating mode.
| device | - The device structure. |
| uled_number | - The ULED to select (1-indexed). |
| mode | - The mode to set the ULED to. |
| int ltc3220_update_reg_blink_grad | ( | struct ltc3220_dev * | device, |
| bool | is_blink_fast, | ||
| bool | is_blink_long, | ||
| bool | is_grad_inc, | ||
| uint8_t | grad_speed ) |
Updates the configuration set on the device's Blink/Gradation based on the config.
| device | - The device's structure. |
| is_blink_fast | - Sets whether blinking should turn on fast (0.156s) or not (0.625s) |
| is_blink_long | - Sets whether blinking should have a shorter (1.25s) or longer (2.5s) period |
| is_grad_inc | - Set for increasing gradation, unset if decreasing gradation. |
| grad_speed | - Sets the speed of gradation, with slowest speed at max setting (3). Set to 0 to disable gradation. |
| int ltc3220_update_reg_command | ( | struct ltc3220_dev * | device, |
| bool | is_shutdown, | ||
| bool | is_force_cpo_2x, | ||
| bool | is_force_cpo_1p5x, | ||
| bool | is_quick_write ) |
Updates the configuration set on the.
| device | - The device's structure. |
| is_shutdown | - Signals the device to shutdown. |
| is_force_cpo_1p5x | - Sets the device's to use 1.5x voltage. |
| is_force_cpo_2x | - Sets the device's to use 2x voltage. |
| is_quick_write | - Set for quick write operation. This copies the configuration set on ULED1 to all other ULED registers. |
| int ltc3220_update_reg_uled | ( | struct ltc3220_dev * | device, |
| uint8_t | uled_number, | ||
| enum ltc3220_uled_mode | mode, | ||
| uint8_t | current_level ) |
Updates the configuration set on the device's ULED based on the config.
| device | - The device structure. |
| uled_number | - The ULED to select (1-indexed). |
| mode | - The mode to set the ULED to. |
| current_level | - The current strength from 0 to 20mA to set on the corresponding ULED pin (64 levels) |
Updates the configuration set on the device's ULED based on the config.
| device | - The device structure. |
| uled_number | - The ULED to select (1-indexed). |
| mode | - The mode to set the ULED to. |
| current_level | - The current strength from 0 to 20mA to set on the corresponding ULED pin (64 levels) |