42#ifdef PREINIT_SUPPORTED
46#ifdef MikroCCoreVersion
47 #if MikroCCoreVersion >= 1
52#include "drv_digital_out.h"
53#include "drv_digital_in.h"
65#define LOADCELL_MAP_MIKROBUS( cfg, mikrobus ) \
66 cfg.rte= MIKROBUS( mikrobus, MIKROBUS_CS ); \
67 cfg.clk= MIKROBUS( mikrobus, MIKROBUS_PWM ); \
68 cfg.int_pin= MIKROBUS( mikrobus, MIKROBUS_INT );
75#define LOADCELL_RETVAL uint8_t
77#define LOADCELL_OK 0x00
78#define LOADCELL_INIT_ERROR 0xFF
85#define LOADCELL_CHANN_A_GATE_128_NEXT 0
86#define LOADCELL_CHANN_B_GATE_32_NEXT 1
87#define LOADCELL_CHANN_A_GATE_64_NEXT 2
94#define LOADCELL_10HZ_INTERNAL_OSC 0
95#define LOADCELL_80HZ_INTERNAL_OSC 1
102#define LOADCELL_POWER_UP 0
103#define LOADCELL_POWER_DOWN 1
110#define LOADCELL_GET_RESULT_ERROR 0
111#define LOADCELL_GET_RESULT_OK 1
118#define LOADCELL_WEIGHT_100G 100
119#define LOADCELL_WEIGHT_500G 500
120#define LOADCELL_WEIGHT_1000G 1000
121#define LOADCELL_WEIGHT_5000G 5000
122#define LOADCELL_WEIGHT_10000G 10000
129#define LOADCELL_DEFAULT_WEIGHT_SCALE_COEFFICIENT 0.088495575221
136#define LOADCELL_DATA_NO_DATA 0
137#define LOADCELL_DATA_OK 1
205 // End constants group
213 // End variable group
#define LOADCELL_RETVAL
Definition loadcell.h:75
float loadcell_get_weight(loadcell_t *ctx, uint8_t input_sel, loadcell_data_t *cell_data)
Get weight function.
uint8_t loadcell_calibration(loadcell_t *ctx, uint8_t input_sel, uint16_t cal_val, loadcell_data_t *cell_data)
Calibration function.
void loadcell_tare(loadcell_t *ctx, uint8_t input_sel, loadcell_data_t *cell_data)
Function of messure and read results.
void loadcell_set_rate(loadcell_t *ctx, uint8_t rate_sel)
Set rate function.
void loadcell_cfg_setup(loadcell_cfg_t *cfg)
Config Object Initialization function.
uint8_t loadcell_read_results(loadcell_t *ctx, uint8_t input_sel, uint32_t *data_out)
Read results of function.
void loadcell_reset(loadcell_t *ctx)
Reset clock function.
void loadcell_default_cfg(loadcell_t *ctx)
Click Default Configuration function.
uint8_t loadcell_check_out(loadcell_t *ctx)
Check status of pin DO (do_pin).
LOADCELL_RETVAL loadcell_init(loadcell_t *ctx, loadcell_cfg_t *cfg)
Initialization function.
void loadcell_set_mode(loadcell_t *ctx, uint8_t pwr_mode)
Set clock mode function.
loadcell_data_t cell_data
Definition main.c:39
Click configuration structure definition.
Definition loadcell.h:167
pin_name_t rte
Definition loadcell.h:170
pin_name_t clk
Definition loadcell.h:171
pin_name_t int_pin
Definition loadcell.h:172
Load cell data structure definition.
Definition loadcell.h:180
float tare
Definition loadcell.h:181
float weight_coeff_10000g
Definition loadcell.h:191
uint8_t weight_data_1000g_ok
Definition loadcell.h:188
uint8_t weight_data_500g_ok
Definition loadcell.h:186
float weight_coeff_100g
Definition loadcell.h:183
float weight_coeff_5000g
Definition loadcell.h:189
uint8_t weight_data_10000g_ok
Definition loadcell.h:192
float weight_coeff_500g
Definition loadcell.h:185
uint8_t weight_data_5000g_ok
Definition loadcell.h:190
uint8_t tare_ok
Definition loadcell.h:182
uint8_t weight_data_100g_ok
Definition loadcell.h:184
float weight_coeff_1000g
Definition loadcell.h:187
Click ctx object definition.
Definition loadcell.h:151
digital_out_t rte
Definition loadcell.h:154
digital_in_t int_pin
Definition loadcell.h:159
digital_out_t clk
Definition loadcell.h:155