hx711-pico-c
hx711_multi_awaiter.pio.h File Reference
#include "hardware/pio.h"
#include <assert.h>
#include <stddef.h>
#include "hardware/pio_instructions.h"
#include "hx711_multi.h"

Go to the source code of this file.

Macros

#define hx711_multi_awaiter_wrap_target   0
 
#define hx711_multi_awaiter_wrap   6
 
#define hx711_multi_awaiter_offset_wait_in_pins_bit_count   0u
 

Functions

static pio_sm_config hx711_multi_awaiter_program_get_default_config (uint offset)
 
void hx711_multi_awaiter_program_init (hx711_multi_t *const hxm)
 

Variables

static const uint16_t hx711_multi_awaiter_program_instructions []
 
static const struct pio_program hx711_multi_awaiter_program
 

Macro Definition Documentation

◆ hx711_multi_awaiter_offset_wait_in_pins_bit_count

#define hx711_multi_awaiter_offset_wait_in_pins_bit_count   0u

Definition at line 18 of file hx711_multi_awaiter.pio.h.

◆ hx711_multi_awaiter_wrap

#define hx711_multi_awaiter_wrap   6

Definition at line 16 of file hx711_multi_awaiter.pio.h.

◆ hx711_multi_awaiter_wrap_target

#define hx711_multi_awaiter_wrap_target   0

Definition at line 15 of file hx711_multi_awaiter.pio.h.

Function Documentation

◆ hx711_multi_awaiter_program_get_default_config()

static pio_sm_config hx711_multi_awaiter_program_get_default_config ( uint  offset)
inlinestatic

Definition at line 39 of file hx711_multi_awaiter.pio.h.

39  {
40  pio_sm_config c = pio_get_default_sm_config();
41  sm_config_set_wrap(&c, offset + hx711_multi_awaiter_wrap_target, offset + hx711_multi_awaiter_wrap);
42  return c;
43 }
#define hx711_multi_awaiter_wrap
#define hx711_multi_awaiter_wrap_target

References hx711_multi_awaiter_wrap, and hx711_multi_awaiter_wrap_target.

Referenced by hx711_multi_awaiter_program_init().

◆ hx711_multi_awaiter_program_init()

void hx711_multi_awaiter_program_init ( hx711_multi_t *const  hxm)

Definition at line 71 of file hx711_multi_awaiter.pio.h.

71  {
72  assert(hxm != NULL);
73  assert(hxm->_pio != NULL);
74  assert(hxm->_chips_len > 0);
76  hxm->_awaiter_offset);
77  //replace placeholder in instruction with the number of pins
78  //to read
80  pio_encode_in(pio_pins, hxm->_chips_len);
81  //data pins
82  pio_sm_set_in_pins(
83  hxm->_pio,
84  hxm->_awaiter_sm,
85  hxm->_data_pin_base);
86  pio_sm_set_consecutive_pindirs(
87  hxm->_pio,
88  hxm->_awaiter_sm,
89  hxm->_data_pin_base,
90  hxm->_chips_len,
91  false); //false = output pins
92  sm_config_set_in_pins(
93  &cfg,
94  hxm->_data_pin_base);
95  //even though the program reads data into the ISR,
96  //it does not push any data, so make sure autopushing
97  //is disabled
98  sm_config_set_in_shift(
99  &cfg,
100  false, //false = shift left
101  false, //false = autopush disabled
102  hxm->_chips_len); //autopush threshold
103  pio_sm_clear_fifos(
104  hxm->_pio,
105  hxm->_awaiter_sm);
106  hxm->_awaiter_default_config = cfg;
107 }
static pio_sm_config hx711_multi_awaiter_program_get_default_config(uint offset)
#define hx711_multi_awaiter_offset_wait_in_pins_bit_count
uint _data_pin_base
Definition: hx711_multi.h:95
pio_sm_config _awaiter_default_config
Definition: hx711_multi.h:101
size_t _chips_len
Definition: hx711_multi.h:96
uint _awaiter_offset
Definition: hx711_multi.h:103

References hx711_multi_t::_awaiter_default_config, hx711_multi_t::_awaiter_offset, hx711_multi_t::_awaiter_sm, hx711_multi_t::_chips_len, hx711_multi_t::_data_pin_base, hx711_multi_t::_pio, hx711_multi_awaiter_offset_wait_in_pins_bit_count, and hx711_multi_awaiter_program_get_default_config().

Variable Documentation

◆ hx711_multi_awaiter_program

const struct pio_program hx711_multi_awaiter_program
static
Initial value:
= {
.length = 7,
.origin = -1,
}
static const uint16_t hx711_multi_awaiter_program_instructions[]

Definition at line 20 of file hx711_multi_awaiter.pio.h.

◆ hx711_multi_awaiter_program_instructions

const uint16_t hx711_multi_awaiter_program_instructions[]
static
Initial value:
= {
0x4001,
0xa046,
0x8000,
0x0066,
0xc044,
0x0000,
0xc004,
}

Definition at line 20 of file hx711_multi_awaiter.pio.h.