Here is stream_bit.pio.h
It's about as simple as you can get - the PIO program reads a 32-bit word from the FIFO and sends 1 bit per clock to an IO pin to generate frequencies.
// -------------------------------------------------- //
// This file is autogenerated by pioasm; do not edit! //
// -------------------------------------------------- //
#pragma once
#if !PICO_NO_HARDWARE
#include "hardware/pio.h"
#endif
// ----------- //
// stream_bits //
// ----------- //
#define stream_bits_wrap_target 0
#define stream_bits_wrap 0
static const uint16_t stream_bits_program_instructions[] = {
// .wrap_target
0x6001, // 0: out pins, 1
// .wrap
};
#if !PICO_NO_HARDWARE
static const struct pio_program stream_bits_program = {
.instructions = stream_bits_program_instructions,
.length = 1,
.origin = -1,
};
----------------------
I do have #include "hardware/pio.h" in my sketch.
Thanks again, Bob
static inline pio_sm_config stream_bits_program_get_default_config(uint offset) {
pio_sm_config c = pio_get_default_sm_config();
sm_config_set_wrap(&c, offset + stream_bits_wrap_target, offset + stream_bits_wrap);
return c;
}
static inline void stream_bits_program_init(PIO pio, uint sm, uint offset, uint pin) {
pio_sm_config c = stream_bits_program_get_default_config(offset);
// Map the state machine's OUT pin group to one pin, namely the `pin`
// parameter to this function.
sm_config_set_out_pins(&c, pin, 1);
// Set this pin's GPIO function (connect PIO to the pad)
pio_gpio_init(pio, pin);
// Set the pin direction to output at the PIO
pio_sm_set_consecutive_pindirs(pio, sm, pin, 1, true);
// Set the pin direction to output at the PIO
sm_config_set_out_shift(&c, true, true, 32);
// We only need TX, so get an 8-deep FIFO!
sm_config_set_fifo_join(&c, PIO_FIFO_JOIN_TX);
// Load our configuration, and jump to the start of the program
pio_sm_init(pio, sm, offset, &c);
// Set the state machine running
pio_sm_set_enabled(pio, sm, true);
}
#endif
I do have #include "hardware/pio.h" at the top of my sketch. Thanks again, Bob.
It's about as simple as you can get - the PIO program reads a 32-bit word from the FIFO and sends 1 bit per clock to an IO pin to generate frequencies.
// -------------------------------------------------- //
// This file is autogenerated by pioasm; do not edit! //
// -------------------------------------------------- //
#pragma once
#if !PICO_NO_HARDWARE
#include "hardware/pio.h"
#endif
// ----------- //
// stream_bits //
// ----------- //
#define stream_bits_wrap_target 0
#define stream_bits_wrap 0
static const uint16_t stream_bits_program_instructions[] = {
// .wrap_target
0x6001, // 0: out pins, 1
// .wrap
};
#if !PICO_NO_HARDWARE
static const struct pio_program stream_bits_program = {
.instructions = stream_bits_program_instructions,
.length = 1,
.origin = -1,
};
----------------------
I do have #include "hardware/pio.h" in my sketch.
Thanks again, Bob
static inline pio_sm_config stream_bits_program_get_default_config(uint offset) {
pio_sm_config c = pio_get_default_sm_config();
sm_config_set_wrap(&c, offset + stream_bits_wrap_target, offset + stream_bits_wrap);
return c;
}
static inline void stream_bits_program_init(PIO pio, uint sm, uint offset, uint pin) {
pio_sm_config c = stream_bits_program_get_default_config(offset);
// Map the state machine's OUT pin group to one pin, namely the `pin`
// parameter to this function.
sm_config_set_out_pins(&c, pin, 1);
// Set this pin's GPIO function (connect PIO to the pad)
pio_gpio_init(pio, pin);
// Set the pin direction to output at the PIO
pio_sm_set_consecutive_pindirs(pio, sm, pin, 1, true);
// Set the pin direction to output at the PIO
sm_config_set_out_shift(&c, true, true, 32);
// We only need TX, so get an 8-deep FIFO!
sm_config_set_fifo_join(&c, PIO_FIFO_JOIN_TX);
// Load our configuration, and jump to the start of the program
pio_sm_init(pio, sm, offset, &c);
// Set the state machine running
pio_sm_set_enabled(pio, sm, true);
}
#endif
I do have #include "hardware/pio.h" at the top of my sketch. Thanks again, Bob.
Statistics: Posted by W9RAN — Mon Jan 22, 2024 12:45 am