ups3 2.0.0.0
UPS 3 Click Driver

API for configuring and manipulating UPS 3 Click driver. More...

Topics

 UPS 3 MikroBUS Map
 MikroBUS pin mapping of UPS 3 Click driver.
 
 Dir_mode
 
 Enable
 
 Get_error
 
 Get_cap_ok
 
 Get_chrg
 
 Status
 

Functions

void ups3_cfg_setup (ups3_cfg_t *cfg)
 UPS 3 configuration object setup function.
 
err_t ups3_init (ups3_t *ctx, ups3_cfg_t *cfg)
 UPS 3 initialization function.
 
err_t ups3_default_cfg (ups3_t *ctx)
 UPS 3 default configuration function.
 
uint8_t ups3_get_error (ups3_t *ctx)
 UPS 3 get error function.
 
uint8_t ups3_get_cap_ok (ups3_t *ctx)
 UPS 3 pin get capacitor ok function.
 
uint8_t ups3_get_chrg (ups3_t *ctx)
 UPS 3 get charge/backup mode function.
 
err_t ups3_select_dir_mode (ups3_t *ctx, uint8_t dir_mode)
 UPS 3 pin select direction of the operation modes function.
 
err_t ups3_set_enable (ups3_t *ctx, uint8_t enable)
 UPS 3 enable device function.
 
err_t ups3_hw_reset (ups3_t *ctx)
 UPS 3 reset the device function.
 

Detailed Description

API for configuring and manipulating UPS 3 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

◆ ups3_cfg_setup()

void ups3_cfg_setup ( ups3_cfg_t * cfg)

UPS 3 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ ups3_default_cfg()

err_t ups3_default_cfg ( ups3_t * ctx)

UPS 3 default configuration function.

This function executes a default configuration of UPS 3 click board.

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

◆ ups3_get_cap_ok()

uint8_t ups3_get_cap_ok ( ups3_t * ctx)

UPS 3 pin get capacitor ok function.

This function reads the state of the COK ( RST ) pin of UPS 3 click board.

Parameters
[in]ctx: Click context object. See ups3_t object definition for detailed explanation.
Returns
  • 0 - FBVcap voltage is lower than falling threshold,
  • 1 - FBVcap is higher than the rising threshold.
Note
None.

◆ ups3_get_chrg()

uint8_t ups3_get_chrg ( ups3_t * ctx)

UPS 3 get charge/backup mode function.

This function reads the state of the INT pin of UPS 3 click board.

Parameters
[in]ctx: Click context object. See ups3_t object definition for detailed explanation.
Returns
  • 0 - Regulator is in charge mode,
  • 1 - Regulator is in backup mode.
Note
None.

◆ ups3_get_error()

uint8_t ups3_get_error ( ups3_t * ctx)

UPS 3 get error function.

This function reads the state of the ERR ( AN ) pin of UPS 3 click board.

Parameters
[in]ctx: Click context object. See ups3_t object definition for detailed explanation.
Returns
  • 0 - CMPIN pin voltage is above the comparator rising threshold,
  • 1 - CMPIN is below the falling threshold.
Note
None.

◆ ups3_hw_reset()

err_t ups3_hw_reset ( ups3_t * ctx)

UPS 3 reset the device function.

This function executes a hardware reset of UPS 3 click board.

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

◆ ups3_init()

err_t ups3_init ( ups3_t * ctx,
ups3_cfg_t * cfg )

UPS 3 initialization function.

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

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

◆ ups3_select_dir_mode()

err_t ups3_select_dir_mode ( ups3_t * ctx,
uint8_t dir_mode )

UPS 3 pin select direction of the operation modes function.

This function sets the DIR ( CS ) pin on the low or high level of UPS 3 click board.

Parameters
[in]ctx: Click context object. See ups3_t object definition for detailed explanation.
[in]dir_mode: Direction of the operation modes.
  • 0x00 ( UPS3_DIR_MODE_BACKUP ) - Backup mode,
  • 0x01 ( UPS3_DIR_MODE_CHARGE ) - Charger mode.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.

◆ ups3_set_enable()

err_t ups3_set_enable ( ups3_t * ctx,
uint8_t enable )

UPS 3 enable device function.

This function sets the EN ( PWM ) pin on the low or high level of UPS 3 click board.

Parameters
[in]ctx: Click context object. See ups3_t object definition for detailed explanation.
[in]enable: Logic-Controlled Shutdown.
  • 0x00 ( UPS3_ENABLE_SHUTDOWN ) - Shutdown,
  • 0x01 ( UPS3_ENABLE_NORMAL_OPERATION ) - Normal operation.
Returns
  • 0 - Success,
  • -1 - Error.
See #err_t definition for detailed explanation.
Note
None.