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"
80#define LOADCELL5_MODE_POWER_DOWN 0x00
81#define LOADCELL5_MODE_POWER_UP 0x01
95#define LOADCELL5_UPDATE_RATE_16_7_Hz 0x00
96#define LOADCELL5_UPDATE_RATE_10_Hz 0x01
110#define LOADCELL5_GAIN_1 1
111#define LOADCELL5_GAIN_128 128
138#define LOADCELL5_NEW_DATA_IS_AVAILABLE 0
139#define LOADCELL5_NO_DATA 1
153#define LOADCELL5_STATUS_PAT_ADC_PERFORMED_NOT_CORRECTLY 0x00
154#define LOADCELL5_STATUS_PAT_ADC_PERFORMED_CORRECTLY 0x01
155#define LOADCELL5_STATUS_GAIN_128 0x00
156#define LOADCELL5_STATUS_GAIN_1 0x04
157#define LOADCELL5_STATUS_BITS_ID_0 0x08
158#define LOADCELL5_STATUS_BITS_ID_1 0x10
159#define LOADCELL5_STATUS_ERROR 0x20
160#define LOADCELL5_STATUS_FILTER_UPDATE_RATE_16_7_HZ 0x00
161#define LOADCELL5_STATUS_FILTER_UPDATE_RATE_10_HZ 0x40
162#define LOADCELL5_STATUS_CONVERSION_NOT_AVAILABLE 0x80
163#define LOADCELL5_STATUS_CONVERSION_IS_AVAILABLE 0x00
164#define LOADCELL5_STATUS_CONVERSION_NOT_AVAILABLE 0x80
171#define LOADCELL5_DATA_NO_DATA 0
172#define LOADCELL5_DATA_OK 1
193#define LOADCELL5_WEIGHT_ZERO 0
194#define LOADCELL5_WEIGHT_100G 100
195#define LOADCELL5_WEIGHT_500G 500
196#define LOADCELL5_WEIGHT_1000G 1000
197#define LOADCELL5_WEIGHT_5000G 5000
198#define LOADCELL5_WEIGHT_10000G 10000
212#define LOADCELL5_STATUS_PAT_ADC_PERFORMED_NOT_CORRECTLY 0x00
213#define LOADCELL5_STATUS_PAT_ADC_PERFORMED_CORRECTLY 0x01
214#define LOADCELL5_STATUS_GAIN_128 0x00
215#define LOADCELL5_STATUS_GAIN_1 0x04
216#define LOADCELL5_STATUS_BITS_ID_0 0x08
217#define LOADCELL5_STATUS_BITS_ID_1 0x10
218#define LOADCELL5_STATUS_ERROR 0x20
219#define LOADCELL5_STATUS_FILTER_UPDATE_RATE_16_7_HZ 0x00
220#define LOADCELL5_STATUS_FILTER_UPDATE_RATE_10_HZ 0x40
221#define LOADCELL5_STATUS_CONVERSION_NOT_AVAILABLE 0x80
222#define LOADCELL5_STATUS_CONVERSION_IS_AVAILABLE 0x00
223#define LOADCELL5_STATUS_CONVERSION_NOT_AVAILABLE 0x80
244#define LOADCELL5_MAP_MIKROBUS( cfg, mikrobus ) \
245 cfg.miso = MIKROBUS( mikrobus, MIKROBUS_MISO ); \
246 cfg.mosi = MIKROBUS( mikrobus, MIKROBUS_MOSI ); \
247 cfg.sck = MIKROBUS( mikrobus, MIKROBUS_SCK ); \
248 cfg.cs = MIKROBUS( mikrobus, MIKROBUS_CS ); \
249 cfg.rst = MIKROBUS( mikrobus, MIKROBUS_RST ); \
250 cfg.gn = MIKROBUS( mikrobus, MIKROBUS_PWM ); \
251 cfg.rdy = MIKROBUS( mikrobus, MIKROBUS_INT );
void loadcell5_hw_reset(loadcell5_t *ctx)
Load Cell 5 set hardware reset function.
err_t loadcell5_calibration(loadcell5_t *ctx, uint16_t cal_val, loadcell5_data_t *cell_data)
Load Cell 5 calibration function.
err_t loadcell5_get_data(loadcell5_t *ctx, uint8_t *status, uint32_t *adc_data)
Load Cell 5 data reading function.
void loadcell5_cfg_setup(loadcell5_cfg_t *cfg)
Load Cell 5 configuration object setup function.
err_t loadcell5_default_cfg(loadcell5_t *ctx)
Load Cell 5 default configuration function.
err_t loadcell5_set_gain(loadcell5_t *ctx, uint8_t gain)
Load Cell 5 set gain function.
err_t loadcell5_set_power_mode(loadcell5_t *ctx, uint8_t pwr_mode)
Load Cell 5 set power mode function.
void loadcell5_tare(loadcell5_t *ctx, loadcell5_data_t *cell_data)
Load Cell 5 tare the scales function.
uint8_t loadcell5_check_data_ready(loadcell5_t *ctx)
Load Cell 5 get error function.
err_t loadcell5_filter_select(loadcell5_t *ctx, uint8_t fil_sel)
Load Cell 5 filter select function.
float loadcell5_get_weight(loadcell5_t *ctx, loadcell5_data_t *cell_data)
Load Cell 5 get weight function.
uint32_t loadcell5_read_adc(loadcell5_t *ctx)
Load Cell 5 reading ADC data function.
err_t loadcell5_init(loadcell5_t *ctx, loadcell5_cfg_t *cfg)
Load Cell 5 initialization function.
loadcell5_return_value_t
Load Cell 5 Click return value data.
Definition loadcell5.h:332
@ LOADCELL5_OK
Definition loadcell5.h:333
@ LOADCELL5_ERROR
Definition loadcell5.h:334
Load Cell 5 Click configuration object.
Definition loadcell5.h:284
spi_master_chip_select_polarity_t cs_polarity
Definition loadcell5.h:302
pin_name_t sck
Definition loadcell5.h:289
spi_master_mode_t spi_mode
Definition loadcell5.h:301
pin_name_t mosi
Definition loadcell5.h:288
uint32_t spi_speed
Definition loadcell5.h:300
pin_name_t rdy
Definition loadcell5.h:296
pin_name_t miso
Definition loadcell5.h:287
pin_name_t gn
Definition loadcell5.h:295
pin_name_t rst
Definition loadcell5.h:294
pin_name_t cs
Definition loadcell5.h:290
Load Cell 5 Click data structure definition.
Definition loadcell5.h:311
float tare
Definition loadcell5.h:312
float weight_coeff_10000g
Definition loadcell5.h:322
uint8_t weight_data_1000g_ok
Definition loadcell5.h:319
uint8_t weight_data_500g_ok
Definition loadcell5.h:317
float weight_coeff_100g
Definition loadcell5.h:314
float weight_coeff_5000g
Definition loadcell5.h:320
uint8_t weight_data_10000g_ok
Definition loadcell5.h:323
float weight_coeff_500g
Definition loadcell5.h:316
uint8_t weight_data_5000g_ok
Definition loadcell5.h:321
uint8_t tare_ok
Definition loadcell5.h:313
uint8_t weight_data_100g_ok
Definition loadcell5.h:315
float weight_coeff_1000g
Definition loadcell5.h:318
Load Cell 5 Click context object.
Definition loadcell5.h:261
spi_master_t spi
Definition loadcell5.h:273
digital_out_t gn
Definition loadcell5.h:265
digital_out_t rst
Definition loadcell5.h:264
pin_name_t chip_select
Definition loadcell5.h:275
digital_in_t rdy
Definition loadcell5.h:269