File syn_scale.h¶
FileList > sensor > syn_scale.h
Go to the source code of this file
Generic Weight Scale & Load Cell Driver (HX711 24-bit ADC, NAU7802).
#include "../common/syn_defs.h"#include "../port/syn_port_gpio.h"#include <stdbool.h>#include <stddef.h>#include <stdint.h>
Classes¶
| Type | Name |
|---|---|
| struct | SYN_Scale Generic Weight Scale Instance Context. |
Public Types¶
| Type | Name |
|---|---|
| enum | SYN_ScaleType Load Cell ADC IC Type. |
Public Functions¶
| Type | Name |
|---|---|
| void | syn_scale_feed_adc (SYN_Scale * scale, int32_t raw_adc24) Feed raw 24-bit ADC reading from load cell chip. |
| float | syn_scale_get_grams (const SYN_Scale * scale) Get calculated weight in grams. |
| float | syn_scale_get_kg (const SYN_Scale * scale) Get calculated weight in kilograms. |
| SYN_Status | syn_scale_init (SYN_Scale * scale, SYN_GPIO_Pin dout_pin, SYN_GPIO_Pin sck_pin, SYN_ScaleType type) Initialize Weight Scale context. |
| void | syn_scale_set_calibration_factor (SYN_Scale * scale, float factor) Set calibration scale factor (counts per gram). |
| void | syn_scale_tare (SYN_Scale * scale, int32_t tare_offset) Set zero-point Tare offset. |
Public Types Documentation¶
enum SYN_ScaleType¶
Load Cell ADC IC Type.
Public Functions Documentation¶
function syn_scale_feed_adc¶
Feed raw 24-bit ADC reading from load cell chip.
Parameters:
scaleScale context.raw_adc24Signed 24-bit raw ADC reading.
function syn_scale_get_grams¶
Get calculated weight in grams.
Parameters:
scaleScale context.
Returns:
Weight in grams.
function syn_scale_get_kg¶
Get calculated weight in kilograms.
Parameters:
scaleScale context.
Returns:
Weight in kg.
function syn_scale_init¶
Initialize Weight Scale context.
SYN_Status syn_scale_init (
SYN_Scale * scale,
SYN_GPIO_Pin dout_pin,
SYN_GPIO_Pin sck_pin,
SYN_ScaleType type
)
Parameters:
scaleScale context.dout_pinData GPIO pin (or SDA for I2C).sck_pinClock GPIO pin (or SCL for I2C).typeScale ADC type (HX711 or NAU7802).
Returns:
SYN_OK on success.
function syn_scale_set_calibration_factor¶
Set calibration scale factor (counts per gram).
Parameters:
scaleScale context.factorCalibration factor (e.g. 420.0f counts/gram).
function syn_scale_tare¶
Set zero-point Tare offset.
Parameters:
scaleScale context.tare_offsetZero reading value.
The documentation for this class was generated from the following file src/syntropic/sensor/syn_scale.h