36#ifndef HX711_DEVICES_NB
37#define HX711_DEVICES_NB 4
44#ifndef HX711_PWM_FREQUENCY
45#define HX711_PWM_FREQUENCY 6000000
49#define HX711_DEVICES {}
52#ifndef HX711_FORCE_SENSOR_ID
53#define HX711_FORCE_SENSOR_ID ABI_BROADCAST
57#define HX711_DEBUG false
65#define HX711_PERIOD (HX711_PWM_FREQUENCY / 50000)
87 .measurement_ready =
false,
215 dev->measurement = 0;
217 dev->measurement <<= 1;
221 dev->measurement |= 1;
224 if(
dev->measurement & (1 << 23)) {
225 dev->measurement |= 0xFF000000;
Main include for ABI (AirBorneInterface).
void gpio_setup_pin_af(ioportid_t port, uint16_t pin, uint8_t af, bool is_output)
Setup a gpio for input or output with alternate function.
void gpio_setup_input(ioportid_t port, uint16_t gpios)
Setup one or more pins of the given GPIO port as inputs.
static uint8_t gpio_get(ioportid_t port, uint16_t pin)
Get level of a gpio.
uint32_t get_sys_time_usec(void)
Get the time in microseconds since startup.
Common code for AP and FBW telemetry.
static struct uart_periph * dev
Some architecture independent helper functions for GPIOs.
static void pwmpcb(PWMDriver *pwmp)
Callback on the falling edge of the clock signal.
struct hx711_dev_t devices[HX711_DEVICES_NB]
static volatile struct hx711_t hx711
#define HX711_FORCE_SENSOR_ID
volatile uint8_t read_bit_idx
#define HX711_PWM_FREQUENCY
volatile bool measurement_ready
void hx711_event(void)
Start a measurement and publish the results when possible.
Interface for the HX711 sensor.
struct pprzlog_transport pprzlog_tp
PPRZLOG transport structure.
Architecture independent timing functions.
static float get_sys_time_float(void)
Get the time in seconds since startup.
Periodic telemetry system header (includes downlink utility and generated code).
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
int int32_t
Typedef defining 32 bit int type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.