Go to the documentation of this file.
28 #ifndef SOLIDSWITCH6_H
29 #define SOLIDSWITCH6_H
35 #include "mikrosdk_version.h"
38 #if mikroSDK_GET_VERSION < 20800ul
39 #include "rcu_delays.h"
45 #include "drv_digital_out.h"
46 #include "drv_digital_in.h"
47 #include "drv_spi_master.h"
70 #define SOLIDSWITCH6_REG_CTRL_1 0x01
71 #define SOLIDSWITCH6_REG_CTRL_2 0x02
72 #define SOLIDSWITCH6_REG_CTRL_3 0x03
73 #define SOLIDSWITCH6_REG_STATUS_1 0x11
74 #define SOLIDSWITCH6_REG_STATUS_2 0x12
75 #define SOLIDSWITCH6_REG_STATUS_3 0x13
76 #define SOLIDSWITCH6_REG_STATUS_4 0x14
77 #define SOLIDSWITCH6_REG_STATUS_5 0x15
78 #define SOLIDSWITCH6_REG_STATUS_6 0x16
79 #define SOLIDSWITCH6_REG_STATUS_7 0x17
80 #define SOLIDSWITCH6_REG_STATUS_8 0x18
81 #define SOLIDSWITCH6_REG_ADV_OPC 0x3F
87 #define SOLIDSWITCH6_REG_ROM_CCODE 0x00
88 #define SOLIDSWITCH6_REG_ROM_DEVF 0x01
89 #define SOLIDSWITCH6_REG_ROM_PR_CODE_1 0x02
90 #define SOLIDSWITCH6_REG_ROM_PR_CODE_2 0x03
91 #define SOLIDSWITCH6_REG_ROM_PR_CODE_3 0x04
92 #define SOLIDSWITCH6_REG_ROM_PR_CODE_4 0x05
93 #define SOLIDSWITCH6_REG_ROM_SIL_VER 0x0A
94 #define SOLIDSWITCH6_REG_ROM_SPI_MODE 0x10
95 #define SOLIDSWITCH6_REG_ROM_WD_TYPE 0x11
96 #define SOLIDSWITCH6_REG_ROM_WD_P1 0x13
97 #define SOLIDSWITCH6_REG_ROM_WD_P2 0x14
98 #define SOLIDSWITCH6_REG_ROM_ADV_OPC 0x3F
116 #define SOLIDSWITCH6_ROM_COMPANY_CODE 0x00
117 #define SOLIDSWITCH6_ROM_DEVICE_FAMILY 0x01
118 #define SOLIDSWITCH6_ROM_PRODUCT_CODE_1 0x55
119 #define SOLIDSWITCH6_ROM_PRODUCT_CODE_2 0x52
120 #define SOLIDSWITCH6_ROM_PRODUCT_CODE_3 0x05
121 #define SOLIDSWITCH6_ROM_PRODUCT_CODE_4 0x4A
122 #define SOLIDSWITCH6_ROM_SILICON_VERSION 0x02
128 #define SOLIDSWITCH6_CTRL_1_GOSTBY_DIS 0x00
129 #define SOLIDSWITCH6_CTRL_1_GOSTBY_EN 0x01
130 #define SOLIDSWITCH6_CTRL_1_EN_DIS 0x00
131 #define SOLIDSWITCH6_CTRL_1_EN 0x01
132 #define SOLIDSWITCH6_CTRL_1_S_T_START_DIS 0x00
133 #define SOLIDSWITCH6_CTRL_1_S_T_START_EN 0x01
134 #define SOLIDSWITCH6_CTRL_1_S_T_STOP_DIS 0x00
135 #define SOLIDSWITCH6_CTRL_1_S_T_STOP_EN 0x01
136 #define SOLIDSWITCH6_CTRL_1_S_T_CFG_NO 0x00
137 #define SOLIDSWITCH6_CTRL_1_S_T_CFG_CS 0x01
138 #define SOLIDSWITCH6_CTRL_1_S_T_CFG_VDS 0x02
139 #define SOLIDSWITCH6_CTRL_1_S_T_CFG_CS_VDS 0x03
140 #define SOLIDSWITCH6_CTRL_1_S_T_CFG_PWRS 0x04
141 #define SOLIDSWITCH6_CTRL_1_S_T_CFG_CS_PWRS 0x05
142 #define SOLIDSWITCH6_CTRL_1_S_T_CFG_VDS_PWRS 0x06
143 #define SOLIDSWITCH6_CTRL_1_S_T_CFG_ALL 0x07
144 #define SOLIDSWITCH6_CTRL_1_OUTCTL_OFF 0x00
145 #define SOLIDSWITCH6_CTRL_1_OUTCTL_ON 0x01
146 #define SOLIDSWITCH6_CTRL_1_BYPASSCTL_OFF 0x00
147 #define SOLIDSWITCH6_CTRL_1_BYPASSCTL_ON 0x01
148 #define SOLIDSWITCH6_CTRL_1_WD_TRI_DIS 0x00
149 #define SOLIDSWITCH6_CTRL_1_WD_TRI_EN 0x01
150 #define SOLIDSWITCH6_CTRL_1_PARITY_BIT 0x01
156 #define SOLIDSWITCH6_CTRL_2_T_NOM_1SEC 0x00
157 #define SOLIDSWITCH6_CTRL_2_T_NOM_511SEC 0xFF
158 #define SOLIDSWITCH6_CTRL_2_OVC_THR_6_MV 0x00
159 #define SOLIDSWITCH6_CTRL_2_OVC_THR_90_MV 0x1F
160 #define SOLIDSWITCH6_CTRL_2_HSHT_THR_20_MV 0x00
161 #define SOLIDSWITCH6_CTRL_2_HSHT_THR_160_MV 0x0F
162 #define SOLIDSWITCH6_CTRL_2_VDS_THR_0_3_V 0x00
163 #define SOLIDSWITCH6_CTRL_2_VDS_THR_1_8_V 0x1F
164 #define SOLIDSWITCH6_CTRL_2_WD_TRI_EN 0x01
165 #define SOLIDSWITCH6_CTRL_2_PARITY_BIT 0x01
171 #define SOLIDSWITCH6_CTRL_3_UNLOCK_DIS 0x00
172 #define SOLIDSWITCH6_CTRL_3_UNLOCK_EN 0x01
173 #define SOLIDSWITCH6_CTRL_3_NTC_THR_37_5 0x00
174 #define SOLIDSWITCH6_CTRL_3_NTC_THR_110_92 0x0F
175 #define SOLIDSWITCH6_CTRL_3_WD_TIME_50_MS 0x00
176 #define SOLIDSWITCH6_CTRL_3_WD_TIME_100_MS 0x01
177 #define SOLIDSWITCH6_CTRL_3_WD_TIME_150_MS 0x02
178 #define SOLIDSWITCH6_CTRL_3_WD_TIME_200_MS 0x03
179 #define SOLIDSWITCH6_CTRL_3_DIS_OUT_MODE_DIS 0x00
180 #define SOLIDSWITCH6_CTRL_3_DIS_OUT_MODE_EN 0x01
181 #define SOLIDSWITCH6_CTRL_3_WD_TRI_EN 0x01
182 #define SOLIDSWITCH6_CTRL_3_PARITY_BITMASK 0x00000001ul
183 #define SOLIDSWITCH6_CTRL_3_WD_TRIG 0x00000002ul
184 #define SOLIDSWITCH6_CTRL_3_GOTO_UNLOCK 0x00000200ul
190 #define SOLIDSWITCH6_CURR_SENSE_RANGE_MV 160.0f
191 #define SOLIDSWITCH6_CURR_SENSE_RES 0x1FFFu
197 #define SOLIDSWITCH6_TJ_TEMP_MIN -40.0f
198 #define SOLIDSWITCH6_TJ_TEMP_MAX 150.0f
199 #define SOLIDSWITCH6_TJ_RANGE 190.0f
200 #define SOLIDSWITCH6_TJ_RES 0x03FFu
207 #define SOLIDSWITCH6_S_T_VDS_MIN_START 300.0f
208 #define SOLIDSWITCH6_S_T_VDS_RANGE_MV 1500.0f
209 #define SOLIDSWITCH6_S_T_VDS_RES 0x03FFu
215 #define SOLIDSWITCH6_VNTC_MIN_3V3 -0.3f
216 #define SOLIDSWITCH6_VNTC_MIN_5V 1.7f
217 #define SOLIDSWITCH6_VNTC_RANGE_3V3 3.9f
218 #define SOLIDSWITCH6_VNTC_RANGE_5V 3.6f
219 #define SOLIDSWITCH6_VNTC_RES 0x03FFu
225 #define SOLIDSWITCH6_VDS_MIN_MV 300.0f
226 #define SOLIDSWITCH6_VDS_MAX_MV 1800.0f
227 #define SOLIDSWITCH6_VDS_RANGE_MV 1500.0f
228 #define SOLIDSWITCH6_VDS_CONVERT_TO_V 1000.0f
229 #define SOLIDSWITCH6_VDS_RES 0x03FFu
235 #define SOLIDSWITCH6_VOUT_RANGE 60.0f
236 #define SOLIDSWITCH6_VOUT_RES 0x03FFu
242 #define SOLIDSWITCH6_S_T_CURR_RANGE_MV 160.0f
243 #define SOLIDSWITCH6_S_T_CURR_RES 0x1FFFu
250 #define SOLIDSWITCH6_S_T_STUCK_MIN_MIN 300.0f
251 #define SOLIDSWITCH6_S_T_STUCK_RANGE_MV 1500.0f
252 #define SOLIDSWITCH6_S_T_STUCK_RES 0x03FFu
258 #define SOLIDSWITCH6_HSHT_SAR_RANGE_MV 160.0f
259 #define SOLIDSWITCH6_HSHT_SAR_RES 0x03FFu
265 #define SOLIDSWITCH6_VCC_SEL_3V3 0
266 #define SOLIDSWITCH6_VCC_SEL_5V 1
272 #define SOLIDSWITCH6_GS_GSBN_BIT 0x80
273 #define SOLIDSWITCH6_GS_RSTB_BIT 0x40
274 #define SOLIDSWITCH6_GS_SPIE_BIT 0x20
275 #define SOLIDSWITCH6_GS_AUTOON_BIT 0x10
276 #define SOLIDSWITCH6_GS_DIAGS_BIT 0x08
277 #define SOLIDSWITCH6_GS_DE_BIT 0x04
278 #define SOLIDSWITCH6_GS_OVC_BIT 0x02
279 #define SOLIDSWITCH6_GS_FS_BIT 0x01
280 #define SOLIDSWITCH6_GS_OK 0x00
290 #define SOLIDSWITCH6_SET_DATA_SAMPLE_EDGE SET_SPI_DATA_SAMPLE_EDGE
291 #define SOLIDSWITCH6_SET_DATA_SAMPLE_MIDDLE SET_SPI_DATA_SAMPLE_MIDDLE
309 #define SOLIDSWITCH6_MAP_MIKROBUS( cfg, mikrobus ) \
310 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
311 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
312 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
313 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
314 cfg.hwl = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
315 cfg.dgn = MIKROBUS( mikrobus, MIKROBUS_INT )
768 #endif // SOLIDSWITCH6_H
pin_name_t sck
Definition: solidswitch6.h:351
uint8_t wd_type
Definition: solidswitch6.h:379
uint8_t s_t_stop
Definition: solidswitch6.h:394
uint8_t gostby
Definition: solidswitch6.h:391
uint8_t ovc_thr
Definition: solidswitch6.h:399
spi_master_chip_select_polarity_t cs_polarity
Definition: solidswitch6.h:361
uint8_t wd_trig
Definition: solidswitch6.h:406
pin_name_t chip_select
Definition: solidswitch6.h:335
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:356
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:402
digital_in_t dgn
Definition: solidswitch6.h:330
pin_name_t mosi
Definition: solidswitch6.h:350
SolidSwitch 6 Click configuration object.
Definition: solidswitch6.h:347
uint8_t en
Definition: solidswitch6.h:392
uint8_t ntc_thr
Definition: solidswitch6.h:403
uint8_t vcc_sel
Definition: solidswitch6.h:338
uint8_t pc3
Definition: solidswitch6.h:375
err_t solidswitch6_get_device_temperature(solidswitch6_t *ctx, float *tj)
SolidSwitch 6 get device temperature function.
uint8_t pc2
Definition: solidswitch6.h:374
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:360
uint8_t co_code
Definition: solidswitch6.h:371
uint8_t wd_bp2
Definition: solidswitch6.h:381
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:395
uint8_t spi_mode
Definition: solidswitch6.h:378
uint8_t pc1
Definition: solidswitch6.h:373
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:349
uint32_t spi_speed
Definition: solidswitch6.h:359
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:415
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:417
err_t solidswitch6_get_vsense(solidswitch6_t *ctx, float *vsense)
SolidSwitch 6 get Vsense function.
uint8_t hsht_thr
Definition: solidswitch6.h:400
uint8_t wd_time
Definition: solidswitch6.h:404
pin_name_t hwl
Definition: solidswitch6.h:355
uint8_t t_nom
Definition: solidswitch6.h:398
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:401
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:370
uint8_t outctl
Definition: solidswitch6.h:396
@ SOLIDSWITCH6_OK
Definition: solidswitch6.h:416
uint8_t s_t_start
Definition: solidswitch6.h:393
digital_out_t hwl
Definition: solidswitch6.h:327
spi_master_t spi
Definition: solidswitch6.h:333
uint8_t sil_ver
Definition: solidswitch6.h:377
uint8_t dis_out_mode
Definition: solidswitch6.h:405
uint8_t wd_bp1
Definition: solidswitch6.h:380
uint8_t d_family
Definition: solidswitch6.h:372
pin_name_t cs
Definition: solidswitch6.h:352
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:337
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:376
SolidSwitch 6 Click context object.
Definition: solidswitch6.h:325
uint8_t bypassctl
Definition: solidswitch6.h:397
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:390
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.