Closed endail closed 1 year ago
The current PIO program requires that, if the OSR is empty, the previously obtained value - the gain - is loaded into the x
register. pull noblock
does this.
A nonblocking PULL on an empty FIFO has the same effect as MOV OSR, X. - Pico C/C++ SDK pg. 64
If autopull is enabled it must similarly accomplish loading into the x
register. The correct timing/delays must also be preserved.
sm_config_set_out_shift()
would need to be used to enable autopull. The fourth parameter, pull_threshold, is interesting. Only 2 bits are needed by the state machine (ie. out x, 2
).
pio_sm_put
takes a 32 bit word to put data into the OSR. So, pull_threshold may not be too relevant unless perhaps the RX FIFO is accessed directly in C?
The RX FIFO cannot be directly accessed.
https://github.com/endail/hx711-pico-c/blob/1b634c3bd4e65b52ca3437721fa77f1268befcc8/src/hx711_noblock.pio#L111