Go to the documentation of this file.
28 #ifndef SOLIDSWITCH6_H
29 #define SOLIDSWITCH6_H
39 #ifdef PREINIT_SUPPORTED
43 #ifdef MikroCCoreVersion
44 #if MikroCCoreVersion >= 1
49 #include "drv_digital_out.h"
50 #include "drv_digital_in.h"
51 #include "drv_spi_master.h"
74 #define SOLIDSWITCH6_REG_CTRL_1 0x01
75 #define SOLIDSWITCH6_REG_CTRL_2 0x02
76 #define SOLIDSWITCH6_REG_CTRL_3 0x03
77 #define SOLIDSWITCH6_REG_STATUS_1 0x11
78 #define SOLIDSWITCH6_REG_STATUS_2 0x12
79 #define SOLIDSWITCH6_REG_STATUS_3 0x13
80 #define SOLIDSWITCH6_REG_STATUS_4 0x14
81 #define SOLIDSWITCH6_REG_STATUS_5 0x15
82 #define SOLIDSWITCH6_REG_STATUS_6 0x16
83 #define SOLIDSWITCH6_REG_STATUS_7 0x17
84 #define SOLIDSWITCH6_REG_STATUS_8 0x18
85 #define SOLIDSWITCH6_REG_ADV_OPC 0x3F
91 #define SOLIDSWITCH6_REG_ROM_CCODE 0x00
92 #define SOLIDSWITCH6_REG_ROM_DEVF 0x01
93 #define SOLIDSWITCH6_REG_ROM_PR_CODE_1 0x02
94 #define SOLIDSWITCH6_REG_ROM_PR_CODE_2 0x03
95 #define SOLIDSWITCH6_REG_ROM_PR_CODE_3 0x04
96 #define SOLIDSWITCH6_REG_ROM_PR_CODE_4 0x05
97 #define SOLIDSWITCH6_REG_ROM_SIL_VER 0x0A
98 #define SOLIDSWITCH6_REG_ROM_SPI_MODE 0x10
99 #define SOLIDSWITCH6_REG_ROM_WD_TYPE 0x11
100 #define SOLIDSWITCH6_REG_ROM_WD_P1 0x13
101 #define SOLIDSWITCH6_REG_ROM_WD_P2 0x14
102 #define SOLIDSWITCH6_REG_ROM_ADV_OPC 0x3F
120 #define SOLIDSWITCH6_ROM_COMPANY_CODE 0x00
121 #define SOLIDSWITCH6_ROM_DEVICE_FAMILY 0x01
122 #define SOLIDSWITCH6_ROM_PRODUCT_CODE_1 0x55
123 #define SOLIDSWITCH6_ROM_PRODUCT_CODE_2 0x52
124 #define SOLIDSWITCH6_ROM_PRODUCT_CODE_3 0x05
125 #define SOLIDSWITCH6_ROM_PRODUCT_CODE_4 0x4A
126 #define SOLIDSWITCH6_ROM_SILICON_VERSION 0x02
132 #define SOLIDSWITCH6_CTRL_1_GOSTBY_DIS 0x00
133 #define SOLIDSWITCH6_CTRL_1_GOSTBY_EN 0x01
134 #define SOLIDSWITCH6_CTRL_1_EN_DIS 0x00
135 #define SOLIDSWITCH6_CTRL_1_EN 0x01
136 #define SOLIDSWITCH6_CTRL_1_S_T_START_DIS 0x00
137 #define SOLIDSWITCH6_CTRL_1_S_T_START_EN 0x01
138 #define SOLIDSWITCH6_CTRL_1_S_T_STOP_DIS 0x00
139 #define SOLIDSWITCH6_CTRL_1_S_T_STOP_EN 0x01
140 #define SOLIDSWITCH6_CTRL_1_S_T_CFG_NO 0x00
141 #define SOLIDSWITCH6_CTRL_1_S_T_CFG_CS 0x01
142 #define SOLIDSWITCH6_CTRL_1_S_T_CFG_VDS 0x02
143 #define SOLIDSWITCH6_CTRL_1_S_T_CFG_CS_VDS 0x03
144 #define SOLIDSWITCH6_CTRL_1_S_T_CFG_PWRS 0x04
145 #define SOLIDSWITCH6_CTRL_1_S_T_CFG_CS_PWRS 0x05
146 #define SOLIDSWITCH6_CTRL_1_S_T_CFG_VDS_PWRS 0x06
147 #define SOLIDSWITCH6_CTRL_1_S_T_CFG_ALL 0x07
148 #define SOLIDSWITCH6_CTRL_1_OUTCTL_OFF 0x00
149 #define SOLIDSWITCH6_CTRL_1_OUTCTL_ON 0x01
150 #define SOLIDSWITCH6_CTRL_1_BYPASSCTL_OFF 0x00
151 #define SOLIDSWITCH6_CTRL_1_BYPASSCTL_ON 0x01
152 #define SOLIDSWITCH6_CTRL_1_WD_TRI_DIS 0x00
153 #define SOLIDSWITCH6_CTRL_1_WD_TRI_EN 0x01
154 #define SOLIDSWITCH6_CTRL_1_PARITY_BIT 0x01
160 #define SOLIDSWITCH6_CTRL_2_T_NOM_1SEC 0x00
161 #define SOLIDSWITCH6_CTRL_2_T_NOM_511SEC 0xFF
162 #define SOLIDSWITCH6_CTRL_2_OVC_THR_6_MV 0x00
163 #define SOLIDSWITCH6_CTRL_2_OVC_THR_90_MV 0x1F
164 #define SOLIDSWITCH6_CTRL_2_HSHT_THR_20_MV 0x00
165 #define SOLIDSWITCH6_CTRL_2_HSHT_THR_160_MV 0x0F
166 #define SOLIDSWITCH6_CTRL_2_VDS_THR_0_3_V 0x00
167 #define SOLIDSWITCH6_CTRL_2_VDS_THR_1_8_V 0x1F
168 #define SOLIDSWITCH6_CTRL_2_WD_TRI_EN 0x01
169 #define SOLIDSWITCH6_CTRL_2_PARITY_BIT 0x01
175 #define SOLIDSWITCH6_CTRL_3_UNLOCK_DIS 0x00
176 #define SOLIDSWITCH6_CTRL_3_UNLOCK_EN 0x01
177 #define SOLIDSWITCH6_CTRL_3_NTC_THR_37_5 0x00
178 #define SOLIDSWITCH6_CTRL_3_NTC_THR_110_92 0x0F
179 #define SOLIDSWITCH6_CTRL_3_WD_TIME_50_MS 0x00
180 #define SOLIDSWITCH6_CTRL_3_WD_TIME_100_MS 0x01
181 #define SOLIDSWITCH6_CTRL_3_WD_TIME_150_MS 0x02
182 #define SOLIDSWITCH6_CTRL_3_WD_TIME_200_MS 0x03
183 #define SOLIDSWITCH6_CTRL_3_DIS_OUT_MODE_DIS 0x00
184 #define SOLIDSWITCH6_CTRL_3_DIS_OUT_MODE_EN 0x01
185 #define SOLIDSWITCH6_CTRL_3_WD_TRI_EN 0x01
186 #define SOLIDSWITCH6_CTRL_3_PARITY_BITMASK 0x00000001ul
187 #define SOLIDSWITCH6_CTRL_3_WD_TRIG 0x00000002ul
188 #define SOLIDSWITCH6_CTRL_3_GOTO_UNLOCK 0x00000200ul
194 #define SOLIDSWITCH6_CURR_SENSE_RANGE_MV 160.0f
195 #define SOLIDSWITCH6_CURR_SENSE_RES 0x1FFFu
201 #define SOLIDSWITCH6_TJ_TEMP_MIN -40.0f
202 #define SOLIDSWITCH6_TJ_TEMP_MAX 150.0f
203 #define SOLIDSWITCH6_TJ_RANGE 190.0f
204 #define SOLIDSWITCH6_TJ_RES 0x03FFu
211 #define SOLIDSWITCH6_S_T_VDS_MIN_START 300.0f
212 #define SOLIDSWITCH6_S_T_VDS_RANGE_MV 1500.0f
213 #define SOLIDSWITCH6_S_T_VDS_RES 0x03FFu
219 #define SOLIDSWITCH6_VNTC_MIN_3V3 -0.3f
220 #define SOLIDSWITCH6_VNTC_MIN_5V 1.7f
221 #define SOLIDSWITCH6_VNTC_RANGE_3V3 3.9f
222 #define SOLIDSWITCH6_VNTC_RANGE_5V 3.6f
223 #define SOLIDSWITCH6_VNTC_RES 0x03FFu
229 #define SOLIDSWITCH6_VDS_MIN_MV 300.0f
230 #define SOLIDSWITCH6_VDS_MAX_MV 1800.0f
231 #define SOLIDSWITCH6_VDS_RANGE_MV 1500.0f
232 #define SOLIDSWITCH6_VDS_CONVERT_TO_V 1000.0f
233 #define SOLIDSWITCH6_VDS_RES 0x03FFu
239 #define SOLIDSWITCH6_VOUT_RANGE 60.0f
240 #define SOLIDSWITCH6_VOUT_RES 0x03FFu
246 #define SOLIDSWITCH6_S_T_CURR_RANGE_MV 160.0f
247 #define SOLIDSWITCH6_S_T_CURR_RES 0x1FFFu
254 #define SOLIDSWITCH6_S_T_STUCK_MIN_MIN 300.0f
255 #define SOLIDSWITCH6_S_T_STUCK_RANGE_MV 1500.0f
256 #define SOLIDSWITCH6_S_T_STUCK_RES 0x03FFu
262 #define SOLIDSWITCH6_HSHT_SAR_RANGE_MV 160.0f
263 #define SOLIDSWITCH6_HSHT_SAR_RES 0x03FFu
269 #define SOLIDSWITCH6_VCC_SEL_3V3 0
270 #define SOLIDSWITCH6_VCC_SEL_5V 1
276 #define SOLIDSWITCH6_GS_GSBN_BIT 0x80
277 #define SOLIDSWITCH6_GS_RSTB_BIT 0x40
278 #define SOLIDSWITCH6_GS_SPIE_BIT 0x20
279 #define SOLIDSWITCH6_GS_AUTOON_BIT 0x10
280 #define SOLIDSWITCH6_GS_DIAGS_BIT 0x08
281 #define SOLIDSWITCH6_GS_DE_BIT 0x04
282 #define SOLIDSWITCH6_GS_OVC_BIT 0x02
283 #define SOLIDSWITCH6_GS_FS_BIT 0x01
284 #define SOLIDSWITCH6_GS_OK 0x00
294 #define SOLIDSWITCH6_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
295 #define SOLIDSWITCH6_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
313 #define SOLIDSWITCH6_MAP_MIKROBUS( cfg, mikrobus ) \
314 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
315 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
316 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
317 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
318 cfg.hwl = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
319 cfg.dgn = MIKROBUS( mikrobus, MIKROBUS_INT )
772 #endif // SOLIDSWITCH6_H
pin_name_t sck
Definition: solidswitch6.h:355
uint8_t wd_type
Definition: solidswitch6.h:383
uint8_t s_t_stop
Definition: solidswitch6.h:398
uint8_t gostby
Definition: solidswitch6.h:395
uint8_t ovc_thr
Definition: solidswitch6.h:403
spi_master_chip_select_polarity_t cs_polarity
Definition: solidswitch6.h:365
uint8_t wd_trig
Definition: solidswitch6.h:410
pin_name_t chip_select
Definition: solidswitch6.h:339
err_t solidswitch6_get_st_curr(solidswitch6_t *ctx, float *st_curr)
SolidSwitch 6 get self-test current sense amplifier function.
This file contains SPI specific macros, functions, etc.
void solidswitch6_unlock_write(solidswitch6_t *ctx)
SolidSwitch 6 unlock write function.
pin_name_t dgn
Definition: solidswitch6.h:360
err_t solidswitch6_default_cfg(solidswitch6_t *ctx)
SolidSwitch 6 default configuration function.
err_t solidswitch6_get_vds(solidswitch6_t *ctx, float *vds)
SolidSwitch 6 get VDS function.
uint8_t unlock
Definition: solidswitch6.h:406
digital_in_t dgn
Definition: solidswitch6.h:334
pin_name_t mosi
Definition: solidswitch6.h:354
SolidSwitch 6 Click configuration object.
Definition: solidswitch6.h:351
uint8_t en
Definition: solidswitch6.h:396
uint8_t ntc_thr
Definition: solidswitch6.h:407
uint8_t vcc_sel
Definition: solidswitch6.h:342
uint8_t pc3
Definition: solidswitch6.h:379
uint8_t pc2
Definition: solidswitch6.h:378
err_t solidswitch6_frame_read_clear(solidswitch6_t *ctx, uint8_t reg, uint32_t data_in, uint32_t *data_out)
SolidSwitch 6 SPI frame data read and clear function.
spi_master_mode_t spi_mode
Definition: solidswitch6.h:364
uint8_t co_code
Definition: solidswitch6.h:375
uint8_t wd_bp2
Definition: solidswitch6.h:385
err_t solidswitch6_frame_write(solidswitch6_t *ctx, uint8_t reg, uint32_t data_in)
SolidSwitch 6 SPI frame data writing function.
uint8_t s_t_cfg
Definition: solidswitch6.h:399
uint8_t spi_mode
Definition: solidswitch6.h:382
uint8_t pc1
Definition: solidswitch6.h:377
void solidswitch6_lock_write(solidswitch6_t *ctx)
SolidSwitch 6 lock write function.
void solidswitch6_cfg_setup(solidswitch6_cfg_t *cfg)
SolidSwitch 6 configuration object setup function.
pin_name_t miso
Definition: solidswitch6.h:353
uint32_t spi_speed
Definition: solidswitch6.h:363
err_t solidswitch6_generic_read(solidswitch6_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
SolidSwitch 6 data reading function.
solidswitch6_return_value_t
SolidSwitch 6 Click return value data.
Definition: solidswitch6.h:419
err_t solidswitch6_get_st_stuck(solidswitch6_t *ctx, float *st_stuck)
SolidSwitch 6 get VDS STUCK ON self-test function.
@ SOLIDSWITCH6_ERROR
Definition: solidswitch6.h:421
err_t solidswitch6_get_vsense(solidswitch6_t *ctx, float *vsense)
SolidSwitch 6 get Vsense function.
uint8_t hsht_thr
Definition: solidswitch6.h:404
uint8_t wd_time
Definition: solidswitch6.h:408
err_t solidswitch6_get_device_temp(solidswitch6_t *ctx, float *tj)
SolidSwitch 6 get device temperature function.
pin_name_t hwl
Definition: solidswitch6.h:359
uint8_t t_nom
Definition: solidswitch6.h:402
err_t solidswitch6_get_vsense_hshd(solidswitch6_t *ctx, float *vsense_hshd)
SolidSwitch 6 get Vsense HSHD function.
err_t solidswitch6_get_device_info(solidswitch6_t *ctx, solidswitch6_device_info_t *device_info)
SolidSwitch 6 get device information function.
uint8_t vds_thr
Definition: solidswitch6.h:405
err_t solidswitch6_generic_write(solidswitch6_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
SolidSwitch 6 data writing function.
SolidSwitch 6 Click device information object.
Definition: solidswitch6.h:374
uint8_t outctl
Definition: solidswitch6.h:400
@ SOLIDSWITCH6_OK
Definition: solidswitch6.h:420
uint8_t s_t_start
Definition: solidswitch6.h:397
digital_out_t hwl
Definition: solidswitch6.h:331
spi_master_t spi
Definition: solidswitch6.h:337
uint8_t sil_ver
Definition: solidswitch6.h:381
uint8_t dis_out_mode
Definition: solidswitch6.h:409
uint8_t wd_bp1
Definition: solidswitch6.h:384
uint8_t d_family
Definition: solidswitch6.h:376
pin_name_t cs
Definition: solidswitch6.h:356
err_t solidswitch6_read_rom(solidswitch6_t *ctx, uint8_t reg, uint8_t *data_out)
SolidSwitch 6 SPI ROM frame data reading function.
uint8_t global_status
Definition: solidswitch6.h:341
err_t solidswitch6_get_vntc(solidswitch6_t *ctx, float *vntc)
SolidSwitch 6 get Vntc function.
err_t solidswitch6_frame_read(solidswitch6_t *ctx, uint8_t reg, uint32_t *data_out)
SolidSwitch 6 SPI frame data reading function.
uint8_t pc4
Definition: solidswitch6.h:380
SolidSwitch 6 Click context object.
Definition: solidswitch6.h:329
uint8_t bypassctl
Definition: solidswitch6.h:401
err_t solidswitch6_get_global_status(solidswitch6_t *ctx)
SolidSwitch 6 get global status function.
err_t solidswitch6_get_st_vds(solidswitch6_t *ctx, float *st_vds)
SolidSwitch 6 get VDS self-test function.
err_t solidswitch6_init(solidswitch6_t *ctx, solidswitch6_cfg_t *cfg)
SolidSwitch 6 initialization function.
SolidSwitch 6 Click control object.
Definition: solidswitch6.h:394
err_t solidswitch6_get_vout(solidswitch6_t *ctx, float *vout)
SolidSwitch 6 get Vout function.
err_t solidswitch6_set_control(solidswitch6_t *ctx, solidswitch6_ctrl_t ctrl)
SolidSwitch 6 set control function.