solarenergy2 2.1.0.0
solarenergy2.h File Reference

This file contains API for Solar Energy 2 Click Driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_i2c_master.h"

Go to the source code of this file.

Data Structures

struct  solarenergy2_t
 Solar Energy 2 Click context object. More...
 
struct  solarenergy2_cfg_t
 Solar Energy 2 Click configuration object. More...
 
struct  solarenergy2_status_t
 Solar Energy 2 Click status information object. More...
 
struct  solarenergy2_bat_vtg_status_t
 Solar Energy 2 Click storage element voltage and state object. More...
 
struct  solarenergy2_abs_vtg_v_t
 Solar Energy 2 Click operation battery voltage values object. More...
 

Macros

#define SOLARENERGY2_REG_T_HRV_PERIOD   0x00
 Solar Energy 2 description register.
 
#define SOLARENERGY2_REG_T_HRV_MEAS   0x01
 
#define SOLARENERGY2_REG_T_STS_PERIOD   0x02
 
#define SOLARENERGY2_REG_T_LTS_PERIOD   0x03
 
#define SOLARENERGY2_REG_V_HRV_CFG   0x04
 
#define SOLARENERGY2_REG_HRV_CHECK_LVL   0x05
 
#define SOLARENERGY2_REG_LTS_CFG   0x06
 
#define SOLARENERGY2_REG_V_BAT_MAX_HI   0x07
 
#define SOLARENERGY2_REG_V_BAT_MAX_LO   0x08
 
#define SOLARENERGY2_REG_V_BAT_MIN_HI_DIS   0x09
 
#define SOLARENERGY2_REG_V_BAT_MIN_HI_CON   0x0A
 
#define SOLARENERGY2_REG_V_BAT_MIN_LO   0x0B
 
#define SOLARENERGY2_REG_V_APL_MAX_HI   0x0C
 
#define SOLARENERGY2_REG_V_APL_MAX_LO   0x0D
 
#define SOLARENERGY2_REG_LDO_CFG   0x0E
 
#define SOLARENERGY2_REG_PWR_CFG   0x0F
 
#define SOLARENERGY2_REG_VAUX_CFG   0x10
 
#define SOLARENERGY2_REG_VAUX_GND_CFG   0x11
 
#define SOLARENERGY2_REG_MPPT_RATIO   0x12
 
#define SOLARENERGY2_REG_EXT_CFG   0x13
 
#define SOLARENERGY2_REG_T_SLEEP_VSUP_LO   0x14
 
#define SOLARENERGY2_REG_T_SLEEP_VSUP_MID   0x15
 
#define SOLARENERGY2_REG_T_SLEEP_VSUP_HI   0x16
 
#define SOLARENERGY2_REG_T_HRV_LOW_CFG   0x17
 
#define SOLARENERGY2_REG_SPI_I2C_CFG   0x18
 
#define SOLARENERGY2_REG_PWR_MGT   0x19
 
#define SOLARENERGY2_REG_SOFT_RES_WORD   0x1A
 
#define SOLARENERGY2_REG_PROTECT_KEY   0x1B
 
#define SOLARENERGY2_REG_LUX_METER_CFG   0x1C
 
#define SOLARENERGY2_REG_LUX_METER_RESULT   0x1D
 
#define SOLARENERGY2_REG_STATUS   0x22
 
#define SOLARENERGY2_REG_VLD_STATUS   0x23
 
#define SOLARENERGY2_REG_EEPROM_0   0x40
 
#define SOLARENERGY2_SET_T_HRV_PERIOD_256ms   0x00
 Solar Energy 2 description setting.
 
#define SOLARENERGY2_SET_T_HRV_PERIOD_512ms   0x01
 
#define SOLARENERGY2_SET_T_HRV_PERIOD_1sec   0x02
 
#define SOLARENERGY2_SET_T_HRV_PERIOD_2sec   0x03
 
#define SOLARENERGY2_SET_T_HRV_PERIOD_4sec   0x04
 
#define SOLARENERGY2_SET_T_HRV_PERIOD_8sec   0x05
 
#define SOLARENERGY2_SET_T_HRV_PERIOD_16sec   0x06
 
#define SOLARENERGY2_SET_T_HRV_PERIOD_32sec   0x07
 
#define SOLARENERGY2_SET_T_HRV_MEAS_16ms   0x00
 
#define SOLARENERGY2_SET_T_HRV_MEAS_32ms   0x01
 
#define SOLARENERGY2_SET_T_HRV_MEAS_64ms   0x02
 
#define SOLARENERGY2_SET_T_HRV_MEAS_128ms   0x03
 
#define SOLARENERGY2_SET_T_HRV_MEAS_256ms   0x04
 
#define SOLARENERGY2_SET_T_HRV_MEAS_512ms   0x05
 
#define SOLARENERGY2_SET_T_HRV_MEAS_1sec   0x06
 
#define SOLARENERGY2_SET_T_HRV_MEAS_2sec   0x07
 
#define SOLARENERGY2_SET_T_STS_PERIOD_1ms   0x00
 
#define SOLARENERGY2_SET_T_STS_PERIOD_2ms   0x01
 
#define SOLARENERGY2_SET_T_STS_PERIOD_8ms   0x02
 
#define SOLARENERGY2_SET_T_STS_PERIOD_16ms   0x03
 
#define SOLARENERGY2_SET_T_STS_PERIOD_32ms   0x04
 
#define SOLARENERGY2_SET_T_STS_PERIOD_64ms   0x05
 
#define SOLARENERGY2_SET_T_STS_PERIOD_128ms   0x06
 
#define SOLARENERGY2_SET_T_STS_PERIOD_256ms   0x07
 
#define SOLARENERGY2_SET_T_LTS_PERIOD_1ms   0x00
 
#define SOLARENERGY2_SET_T_LTS_PERIOD_4ms   0x01
 
#define SOLARENERGY2_SET_T_LTS_PERIOD_16ms   0x02
 
#define SOLARENERGY2_SET_T_LTS_PERIOD_64ms   0x03
 
#define SOLARENERGY2_SET_T_LTS_PERIOD_256ms   0x04
 
#define SOLARENERGY2_SET_T_LTS_PERIOD_1sec   0x05
 
#define SOLARENERGY2_SET_T_LTS_PERIOD_4sec   0x06
 
#define SOLARENERGY2_SET_T_LTS_PERIOD_16sec   0x07
 
#define SOLARENERGY2_SET_T_HRV_LOW_PERIOD_256ms   0x00
 
#define SOLARENERGY2_SET_T_HRV_LOW_PERIOD_512ms   0x01
 
#define SOLARENERGY2_SET_T_HRV_LOW_PERIOD_1sec   0x02
 
#define SOLARENERGY2_SET_T_HRV_LOW_PERIOD_2sec   0x03
 
#define SOLARENERGY2_SET_T_HRV_LOW_PERIOD_4sec   0x04
 
#define SOLARENERGY2_SET_T_HRV_LOW_PERIOD_8sec   0x05
 
#define SOLARENERGY2_SET_T_HRV_LOW_PERIOD_16sec   0x06
 
#define SOLARENERGY2_SET_T_HRV_LOW_PERIOD_32sec   0x07
 
#define SOLARENERGY2_SET_T_LTS_LOW_PERIOD_2ms   0x00
 
#define SOLARENERGY2_SET_T_LTS_LOW_PERIOD_8ms   0x01
 
#define SOLARENERGY2_SET_T_LTS_LOW_PERIOD_32ms   0x02
 
#define SOLARENERGY2_SET_T_LTS_LOW_PERIOD_128ms   0x03
 
#define SOLARENERGY2_SET_T_LTS_LOW_PERIOD_512ms   0x04
 
#define SOLARENERGY2_SET_T_LTS_LOW_PERIOD_2sec   0x05
 
#define SOLARENERGY2_SET_T_LTS_LOW_PERIOD_8sec   0x06
 
#define SOLARENERGY2_SET_T_LTS_LOW_PERIOD_32sec   0x07
 
#define SOLARENERGY2_PROTECT_KEY_SOFT_RESET   0xE2
 
#define SOLARENERGY2_PROTECT_KEY_PROTECTED_REG   0x4B
 
#define SOLARENERGY2_PROTECT_KEY_EEPROM   0xA5
 
#define SOLARENERGY2_SET_VAUX_LDO_CFG_1_2V   0x00
 
#define SOLARENERGY2_SET_VAUX_LDO_CFG_1_55V   0x10
 
#define SOLARENERGY2_SET_VAUX_LDO_CFG_1_65V   0x20
 
#define SOLARENERGY2_SET_VAUX_LDO_CFG_1_8V   0x30
 
#define SOLARENERGY2_SET_VAUX_LDO_CFG_2_0V   0x40
 
#define SOLARENERGY2_SET_VAUX_LDO_CFG_2_2V   0x50
 
#define SOLARENERGY2_SET_VAUX_LDO_CFG_2_4V   0x60
 
#define SOLARENERGY2_SET_VAUX_LDO_CFG_2_6V   0x70
 
#define SOLARENERGY2_SET_VAUX_LDO_CFG_BIT_MASK   0x70
 
#define SOLARENERGY2_SET_ULP_LDO_CFG_1_2V   0x00
 
#define SOLARENERGY2_SET_ULP_LDO_CFG_1_55V   0x01
 
#define SOLARENERGY2_SET_ULP_LDO_CFG_1_65V   0x02
 
#define SOLARENERGY2_SET_ULP_LDO_CFG_1_8V   0x03
 
#define SOLARENERGY2_SET_ULP_LDO_CFG_2_0V   0x04
 
#define SOLARENERGY2_SET_ULP_LDO_CFG_2_2V   0x05
 
#define SOLARENERGY2_SET_ULP_LDO_CFG_2_4V   0x06
 
#define SOLARENERGY2_SET_ULP_LDO_CFG_2_6V   0x07
 
#define SOLARENERGY2_SET_ULP_LDO_CFG_BIT_MASK   0x07
 
#define SOLARENERGY2_SET_MPPT_RATIO_50   0x00
 
#define SOLARENERGY2_SET_MPPT_RATIO_60   0x01
 
#define SOLARENERGY2_SET_MPPT_RATIO_67   0x02
 
#define SOLARENERGY2_SET_MPPT_RATIO_71   0x03
 
#define SOLARENERGY2_SET_MPPT_RATIO_75   0x04
 
#define SOLARENERGY2_SET_MPPT_RATIO_78   0x05
 
#define SOLARENERGY2_SET_MPPT_RATIO_80   0x06
 
#define SOLARENERGY2_SET_MPPT_RATIO_82   0x07
 
#define SOLARENERGY2_SET_MPPT_RATIO_83   0x08
 
#define SOLARENERGY2_SET_MPPT_RATIO_85   0x09
 
#define SOLARENERGY2_SET_MPPT_RATIO_86   0x0A
 
#define SOLARENERGY2_SET_MPPT_RATIO_87   0x0B
 
#define SOLARENERGY2_SET_MPPT_RATIO_88   0x0C
 
#define SOLARENERGY2_SET_MPPT_BIT_MASK   0x0F
 
#define SOLARENERGY2_SET_HRV_CHECK_VLD_VTG   0x00
 
#define SOLARENERGY2_SET_HRV_CHECK_VLD_CUR   0x40
 
#define SOLARENERGY2_SET_HRV_MIN_VTG_GEN   0x01
 
#define SOLARENERGY2_SET_CRT_SRC_SEL_0mA   0x00
 
#define SOLARENERGY2_SET_CRT_SRC_SEL_5mA   0x01
 
#define SOLARENERGY2_SET_CRT_SRC_SEL_10mA   0x02
 
#define SOLARENERGY2_SET_CRT_SRC_SEL_15mA   0x03
 
#define SOLARENERGY2_CRT_SRC_SEL_BIT_MASK   0x03
 
#define SOLARENERGY2_V_BATT_APP_VTG_BIT_MASK   0x3F
 
#define SOLARENERGY2_SET_LTS_CFG_CONN_LTS_STS   0x04
 
#define SOLARENERGY2_SET_LTS_CFG_NORMAL_MODE   0x00
 
#define SOLARENERGY2_SET_LTS_CFG_NEVER_CHARGE   0x02
 
#define SOLARENERGY2_SET_LTS_CFG_RECHARGEABLE   0x00
 
#define SOLARENERGY2_SET_LTS_CFG_BATT_PROT_DIS   0x01
 
#define SOLARENERGY2_SET_LTS_CFG_BATT_PROT_EN   0x00
 
#define SOLARENERGY2_SET_VAUX0_CFG_STS   0x00
 
#define SOLARENERGY2_SET_VAUX0_CFG_LDO   0x01
 
#define SOLARENERGY2_SET_VAUX0_CFG_AUTO_FLT   0x02
 
#define SOLARENERGY2_SET_VAUX0_CFG_AUTO_GND   0x03
 
#define SOLARENERGY2_SET_VAUX1_CFG_STS   0x00
 
#define SOLARENERGY2_SET_VAUX1_CFG_LDO   0x04
 
#define SOLARENERGY2_SET_VAUX1_CFG_AUTO_FLT   0x08
 
#define SOLARENERGY2_SET_VAUX1_CFG_AUTO_GND   0x0C
 
#define SOLARENERGY2_SET_VAUX2_CFG_STS   0x00
 
#define SOLARENERGY2_SET_VAUX2_CFG_LDO   0x10
 
#define SOLARENERGY2_SET_VAUX2_CFG_AUTO_FLT   0x20
 
#define SOLARENERGY2_SET_VAUX2_CFG_AUTO_GND   0x30
 
#define SOLARENERGY2_SET_LDO_CFG_ULP_BIT_MASK   0x08
 
#define SOLARENERGY2_SET_LDO_CFG_VSUP_BIT_MASK   0x80
 
#define SOLARENERGY2_LUX_METER_BUSY_BIT_MASK   0x10
 
#define SOLARENERGY2_LUX_METER_BIT_MASK   0x0F
 
#define SOLARENERGY2_SET_HRV_CURRENT_LVL_15uA   0x0E
 
#define SOLARENERGY2_DEVICE_ADDRESS   0x77
 Solar Energy 2 device address setting.
 
#define SOLARENERGY2_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  solarenergy2_return_value_t { SOLARENERGY2_OK = 0 , SOLARENERGY2_ERROR = -1 }
 Solar Energy 2 Click return value data. More...
 

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

This file contains API for Solar Energy 2 Click Driver.

Enumeration Type Documentation

◆ solarenergy2_return_value_t

Solar Energy 2 Click return value data.

Predefined enum values for driver return values.

Enumerator
SOLARENERGY2_OK 
SOLARENERGY2_ERROR