hx711-pico-c
|
#include "hardware/pio.h"
#include <assert.h>
#include <stddef.h>
#include "hardware/clocks.h"
#include "hardware/structs/clocks.h"
#include "hx711.h"
Go to the source code of this file.
Macros | |
#define | hx711_reader_wrap_target 3 |
#define | hx711_reader_wrap 13 |
#define | hx711_reader_HZ 10000000 |
Functions | |
static pio_sm_config | hx711_reader_program_get_default_config (uint offset) |
void | hx711_reader_pio_init (hx711_t *const hx) |
void | hx711_reader_program_init (hx711_t *const hx) |
Variables | |
static const uint16_t | hx711_reader_program_instructions [] |
static const struct pio_program | hx711_reader_program |
#define hx711_reader_HZ 10000000 |
Definition at line 18 of file hx711_reader.pio.h.
#define hx711_reader_wrap 13 |
Definition at line 16 of file hx711_reader.pio.h.
#define hx711_reader_wrap_target 3 |
Definition at line 15 of file hx711_reader.pio.h.
void hx711_reader_pio_init | ( | hx711_t *const | hx | ) |
Definition at line 80 of file hx711_reader.pio.h.
References hx711_t::_clock_pin, hx711_t::_data_pin, hx711_t::_pio, and hx711_t::_reader_sm.
|
inlinestatic |
Definition at line 46 of file hx711_reader.pio.h.
References hx711_reader_wrap, and hx711_reader_wrap_target.
Referenced by hx711_reader_program_init().
void hx711_reader_program_init | ( | hx711_t *const | hx | ) |
Why enable autopush?
"The state machine keeps an eye on the total amount of data shifted into the ISR, and on the in which reaches or breaches a total shift count of 32 (or whatever number you have configured), the ISR contents, along with the new data from the in. goes straight to the RX FIFO. The ISR is cleared to zero in the same operation."
When manually pushing using noblock, the FIFO contents are NOT changed.
"The PIO assembler sets the Block bit by default. If the Block bit is not set, the PUSH does not stall on a full RX FIFO, instead continuing immediately to the next instruction. The FIFO state and contents are unchanged when this happens. The ISR is still cleared to all-zeroes, and the FDEBUG_RXSTALL flag is set (the same as a blocking PUSH or autopush to a full RX FIFO) to indicate data was lost."
Manually pushing is not ideal. Application code should be able to look at the FIFO and assume that the value inside is the most up-to-date data available. Autopushing does this.
Definition at line 118 of file hx711_reader.pio.h.
References hx711_t::_clock_pin, hx711_t::_data_pin, hx711_t::_pio, hx711_t::_reader_offset, hx711_t::_reader_prog_default_config, hx711_t::_reader_sm, HX711_READ_BITS, hx711_reader_HZ, and hx711_reader_program_get_default_config().
|
static |
Definition at line 20 of file hx711_reader.pio.h.
|
static |
Definition at line 20 of file hx711_reader.pio.h.