solarenergy2 2.1.0.0
Solar Energy 2 Click Driver

API for configuring and manipulating Solar Energy 2 Click driver. More...

Topics

 Solar Energy 2 Registers List
 List of registers of Solar Energy 2 Click driver.
 
 Solar Energy 2 Registers Settings
 Settings for registers of Solar Energy 2 Click driver.
 
 Solar Energy 2 MikroBUS Map
 MikroBUS pin mapping of Solar Energy 2 Click driver.
 

Functions

void solarenergy2_cfg_setup (solarenergy2_cfg_t *cfg)
 Solar Energy 2 configuration object setup function.
 
err_t solarenergy2_init (solarenergy2_t *ctx, solarenergy2_cfg_t *cfg)
 Solar Energy 2 initialization function.
 
err_t solarenergy2_default_cfg (solarenergy2_t *ctx)
 Solar Energy 2 default configuration function.
 
err_t solarenergy2_generic_write (solarenergy2_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Solar Energy 2 I2C writing function.
 
err_t solarenergy2_generic_read (solarenergy2_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Solar Energy 2 I2C reading function.
 
err_t solarenergy2_write_reg (solarenergy2_t *ctx, uint8_t reg, uint8_t data_in)
 Solar Energy 2 write register function.
 
err_t solarenergy2_write_eeprom (solarenergy2_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Solar Energy 2 write EEPROM function.
 
err_t solarenergy2_soft_reset (solarenergy2_t *ctx)
 Solar Energy 2 soft reset function.
 
err_t solarenergy2_get_status (solarenergy2_t *ctx, solarenergy2_status_t *status)
 Solar Energy 2 get status function.
 
err_t solarenergy2_get_bat_vtg_status (solarenergy2_t *ctx, solarenergy2_bat_vtg_status_t *bat_vtg_status)
 Solar Energy 2 get storage element status function.
 
err_t solarenergy2_set_sleep_vsup (solarenergy2_t *ctx, float sleep_vsup_sec)
 Solar Energy 2 set sleep VSUP function.
 
err_t solarenergy2_set_mppt_ratio (solarenergy2_t *ctx, uint8_t mppt_ratio)
 Solar Energy 2 set MPPT ratio function.
 
err_t solarenergy2_set_ldo_cfg (solarenergy2_t *ctx, uint8_t vaux_ldo, uint8_t ulp_ldo)
 Solar Energy 2 set LDO config function.
 
err_t solarenergy2_config_abs_voltage (solarenergy2_t *ctx, solarenergy2_abs_vtg_v_t abs_vtg)
 Solar Energy 2 config absolute voltage function.
 
err_t solarenergy2_set_pwr_current_source (solarenergy2_t *ctx, uint8_t crt_src_sel)
 Solar Energy 2 power source selection function.
 
err_t solarenergy2_store_config (solarenergy2_t *ctx)
 Solar Energy 2 store config function.
 
void solarenergy2_set_wup_pin (solarenergy2_t *ctx, uint8_t state)
 Solar Energy 2 set WUP pin function.
 
uint8_t solarenergy2_get_en_hv_cell_low_state (solarenergy2_t *ctx)
 Solar Energy 2 get HLV state function.
 
uint8_t solarenergy2_get_battery_low_state (solarenergy2_t *ctx)
 Solar Energy 2 get BLV state function.
 

Detailed Description

API for configuring and manipulating Solar Energy 2 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

◆ solarenergy2_cfg_setup()

void solarenergy2_cfg_setup ( solarenergy2_cfg_t * cfg)

Solar Energy 2 configuration object setup function.

This function initializes click configuration structure to initial values.

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

◆ solarenergy2_config_abs_voltage()

err_t solarenergy2_config_abs_voltage ( solarenergy2_t * ctx,
solarenergy2_abs_vtg_v_t abs_vtg )

Solar Energy 2 config absolute voltage function.

This function sets the configuration of the absolute voltage values of the EM8500 Power Management Controller with Energy Harvesting Interface on the Solar Energy 2 Click board™.

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

◆ solarenergy2_default_cfg()

err_t solarenergy2_default_cfg ( solarenergy2_t * ctx)

Solar Energy 2 default configuration function.

This function executes a default configuration of Solar Energy 2 click board.

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

◆ solarenergy2_generic_read()

err_t solarenergy2_generic_read ( solarenergy2_t * ctx,
uint8_t reg,
uint8_t * data_out,
uint8_t len )

Solar Energy 2 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 solarenergy2_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.

◆ solarenergy2_generic_write()

err_t solarenergy2_generic_write ( solarenergy2_t * ctx,
uint8_t reg,
uint8_t * data_in,
uint8_t len )

Solar Energy 2 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 solarenergy2_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.

◆ solarenergy2_get_bat_vtg_status()

err_t solarenergy2_get_bat_vtg_status ( solarenergy2_t * ctx,
solarenergy2_bat_vtg_status_t * bat_vtg_status )

Solar Energy 2 get storage element status function.

This function reads the storage element voltage and state data of the EM8500 Power Management Controller with Energy Harvesting Interface on the Solar Energy 2 Click board™.

Parameters
[in]ctx: Click context object. See solarenergy2_t object definition for detailed explanation.
[out]bat_vtg_status: Storage element status data object.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ solarenergy2_get_battery_low_state()

uint8_t solarenergy2_get_battery_low_state ( solarenergy2_t * ctx)

Solar Energy 2 get BLV state function.

This function gets battery low indicator state of the EM8500 Power Management Controller with Energy Harvesting Interface on the Solar Energy 2 Click board™.

Parameters
[in]ctx: Click context object. See solarenergy2_t object definition for detailed explanation.
Returns
  • 0 - Low pin state,
  • 1 - High pin state. See #err_t definition for detailed explanation.
Note
None.

◆ solarenergy2_get_en_hv_cell_low_state()

uint8_t solarenergy2_get_en_hv_cell_low_state ( solarenergy2_t * ctx)

Solar Energy 2 get HLV state function.

This function gets energy harvester cell low indicator state of the EM8500 Power Management Controller with Energy Harvesting Interface on the Solar Energy 2 Click board™.

Parameters
[in]ctx: Click context object. See solarenergy2_t object definition for detailed explanation.
Returns
  • 0 - Low pin state,
  • 1 - High pin state. See #err_t definition for detailed explanation.
Note
None.

◆ solarenergy2_get_status()

err_t solarenergy2_get_status ( solarenergy2_t * ctx,
solarenergy2_status_t * status )

Solar Energy 2 get status function.

This function reads the status data of the EM8500 Power Management Controller with Energy Harvesting Interface on the Solar Energy 2 Click board™.

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

◆ solarenergy2_init()

err_t solarenergy2_init ( solarenergy2_t * ctx,
solarenergy2_cfg_t * cfg )

Solar Energy 2 initialization function.

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

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

◆ solarenergy2_set_ldo_cfg()

err_t solarenergy2_set_ldo_cfg ( solarenergy2_t * ctx,
uint8_t vaux_ldo,
uint8_t ulp_ldo )

Solar Energy 2 set LDO config function.

This function sets configuration of the LDO regulator of the EM8500 Power Management Controller with Energy Harvesting Interface on the Solar Energy 2 Click board™.

Parameters
[in]ctx: Click context object. See solarenergy2_t object definition for detailed explanation.
[in]vaux_ldo: VAUX LDO regulated voltage selection
  • 0x00 (SOLARENERGY2_SET_VAUX_LDO_CFG_1_2V) - 1.2 V,
  • 0x10 (SOLARENERGY2_SET_VAUX_LDO_CFG_1_55V) - 1.55 V,
  • 0x20 (SOLARENERGY2_SET_VAUX_LDO_CFG_1_65V) - 1.65 V,
  • 0x30 (SOLARENERGY2_SET_VAUX_LDO_CFG_1_8V) - 1.8 V,
  • 0x40 (SOLARENERGY2_SET_VAUX_LDO_CFG_2_0V) - 2.0 V,
  • 0x50 (SOLARENERGY2_SET_VAUX_LDO_CFG_2_2V) - 2.2 V,
  • 0x60 (SOLARENERGY2_SET_VAUX_LDO_CFG_2_4V) - 2.4 V,
  • 0x70 (SOLARENERGY2_SET_VAUX_LDO_CFG_2_6V) - 2.6 V.
[in]ulp_ldo: VAUX LDO regulated voltage selection
  • 0x00 (SOLARENERGY2_SET_ULP_LDO_CFG_1_2V) - 1.2 V,
  • 0x10 (SOLARENERGY2_SET_ULP_LDO_CFG_1_55V) - 1.55 V,
  • 0x20 (SOLARENERGY2_SET_ULP_LDO_CFG_1_65V) - 1.65 V,
  • 0x30 (SOLARENERGY2_SET_ULP_LDO_CFG_1_8V) - 1.8 V,
  • 0x40 (SOLARENERGY2_SET_ULP_LDO_CFG_2_0V) - 2.0 V,
  • 0x50 (SOLARENERGY2_SET_ULP_LDO_CFG_2_2V) - 2.2 V,
  • 0x60 (SOLARENERGY2_SET_ULP_LDO_CFG_2_4V) - 2.4 V,
  • 0x70 (SOLARENERGY2_SET_ULP_LDO_CFG_2_6V) - 2.6 V.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
VSUP supply can be interrupted for up to 4 hours.

◆ solarenergy2_set_mppt_ratio()

err_t solarenergy2_set_mppt_ratio ( solarenergy2_t * ctx,
uint8_t mppt_ratio )

Solar Energy 2 set MPPT ratio function.

This function sets the Maximum Power Point Tracking of the EM8500 Power Management Controller with Energy Harvesting Interface on the Solar Energy 2 Click board™.

Parameters
[in]ctx: Click context object. See solarenergy2_t object definition for detailed explanation.
[out]mppt_ratio:
  • 0x00 (SOLARENERGY2_SET_MPPT_RATIO_50) - MPPT ratio 50%,
  • 0x01 (SOLARENERGY2_SET_MPPT_RATIO_60) - MPPT ratio 60%,
  • 0x02 (SOLARENERGY2_SET_MPPT_RATIO_67) - MPPT ratio 67%,
  • 0x03 (SOLARENERGY2_SET_MPPT_RATIO_71) - MPPT ratio 71%,
  • 0x04 (SOLARENERGY2_SET_MPPT_RATIO_75) - MPPT ratio 75%,
  • 0x05 (SOLARENERGY2_SET_MPPT_RATIO_78) - MPPT ratio 78%,
  • 0x06 (SOLARENERGY2_SET_MPPT_RATIO_80) - MPPT ratio 80%,
  • 0x07 (SOLARENERGY2_SET_MPPT_RATIO_82) - MPPT ratio 82%,
  • 0x08 (SOLARENERGY2_SET_MPPT_RATIO_83) - MPPT ratio 83%,
  • 0x09 (SOLARENERGY2_SET_MPPT_RATIO_85) - MPPT ratio 85%,
  • 0x0A (SOLARENERGY2_SET_MPPT_RATIO_86) - MPPT ratio 86%,
  • 0x0B (SOLARENERGY2_SET_MPPT_RATIO_87) - MPPT ratio 87%,
  • 0x0C (SOLARENERGY2_SET_MPPT_RATIO_88) - MPPT ratio 88%.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
VSUP supply can be interrupted for up to 4 hours.

◆ solarenergy2_set_pwr_current_source()

err_t solarenergy2_set_pwr_current_source ( solarenergy2_t * ctx,
uint8_t crt_src_sel )

Solar Energy 2 power source selection function.

This function sets the power current source selection of the EM8500 Power Management Controller with Energy Harvesting Interface on the Solar Energy 2 Click board™.

Parameters
[in]ctx: Click context object. See solarenergy2_t object definition for detailed explanation.
[in]crt_src_sel:
  • 0x00 (SOLARENERGY2_SET_CRT_SRC_SEL_0mA) - Current 0 mA (do not charge),
  • 0x00 (SOLARENERGY2_SET_CRT_SRC_SEL_5mA) - Current 5 mA,
  • 0x00 (SOLARENERGY2_SET_CRT_SRC_SEL_10mA) - Current 10 mA,
  • 0x00 (SOLARENERGY2_SET_CRT_SRC_SEL_15mA) - Current 15 mA.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ solarenergy2_set_sleep_vsup()

err_t solarenergy2_set_sleep_vsup ( solarenergy2_t * ctx,
float sleep_vsup_sec )

Solar Energy 2 set sleep VSUP function.

This function sets the sleep state of the EM8500 Power Management Controller with Energy Harvesting Interface on the Solar Energy 2 Click board™.

Parameters
[in]ctx: Click context object. See solarenergy2_t object definition for detailed explanation.
[out]sleep_vsup_sec: VSUP sleep time in seconds.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
VSUP supply can be interrupted for up to 4 hours.

◆ solarenergy2_set_wup_pin()

void solarenergy2_set_wup_pin ( solarenergy2_t * ctx,
uint8_t state )

Solar Energy 2 set WUP pin function.

This function sets the Wake-up pin logic state of the EM8500 Power Management Controller with Energy Harvesting Interface on the Solar Energy 2 Click board™.

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

◆ solarenergy2_soft_reset()

err_t solarenergy2_soft_reset ( solarenergy2_t * ctx)

Solar Energy 2 soft reset function.

This function perform a software reset of the EM8500 Power Management Controller with Energy Harvesting Interface on the Solar Energy 2 Click board™.

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

◆ solarenergy2_store_config()

err_t solarenergy2_store_config ( solarenergy2_t * ctx)

Solar Energy 2 store config function.

This function stores the configuration of the device in the EEPROM memory of the EM8500 Power Management Controller with Energy Harvesting Interface on the Solar Energy 2 Click board™.

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

◆ solarenergy2_write_eeprom()

err_t solarenergy2_write_eeprom ( solarenergy2_t * ctx,
uint8_t reg,
uint8_t * data_in,
uint8_t len )

Solar Energy 2 write EEPROM function.

This function writes a desired EEPROM register by using I2C serial interface of the EM8500 Power Management Controller with Energy Harvesting Interface on the Solar Energy 2 Click board™.

Parameters
[in]ctx: Click context object. See solarenergy2_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 read.
Returns
  • 0 - Success,
  • -1 - Error. See #err_t definition for detailed explanation.
Note
None.

◆ solarenergy2_write_reg()

err_t solarenergy2_write_reg ( solarenergy2_t * ctx,
uint8_t reg,
uint8_t data_in )

Solar Energy 2 write register function.

This function writes a desired register by using I2C serial interface of the EM8500 Power Management Controller with Energy Harvesting Interface on the Solar Energy 2 Click board™.

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