Skip to content

Commit

Permalink
[rp] pio asm: simplify syntax, check encoding all instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
andryblack committed Oct 26, 2024
1 parent 3f6d36c commit aabdeb5
Show file tree
Hide file tree
Showing 6 changed files with 739 additions and 566 deletions.
22 changes: 11 additions & 11 deletions examples/rp_pico/pio_ws2812/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,17 +54,17 @@ struct do_zero {};
.wrap
*/
// PIO program
static constexpr auto pio_prog = modm::platform::PIOProgram::begin()
.sideset<1>()
.wrapTarget()
.label<bitloop>()
.instr(pio::Out().x<1>() .side<0>().delay<TL_Common-1>())
.instr(pio::Jmp().not_x().to<do_zero>() .side<1>().delay<TH_Common-1>())
.label<do_one>()
.instr(pio::Jmp().to<bitloop>() .side<1>().delay<TH_Add-1>())
.label<do_zero>()
.instr(pio::Nop() .side<0>().delay<TL_Add-1>())
.wrap()
static constexpr auto pio_prog = PIOProgram::begin()
.sideset<1>
.wrapTarget<>
.label<bitloop>
.instr(pio::Out.x<1> .side<0>.delay<TL_Common-1>)
.instr(pio::Jmp.not_x.to<do_zero> .side<1>.delay<TH_Common-1>)
.label<do_one>
.instr(pio::Jmp.to<bitloop> .side<1>.delay<TH_Add-1>)
.label<do_zero>
.instr(pio::Nop .side<0>.delay<TL_Add-1>)
.wrap<>
.end();


Expand Down
4 changes: 2 additions & 2 deletions src/modm/platform/pio/rp/pio.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ namespace modm::platform
}

template <typename Pio,size_t SM>
friend class pio::StateMachine;
friend class pio::implementation::StateMachine;

public:
static constexpr Peripheral peripherial = Peripheral::Pio{{ id }};
template <size_t SM>
class StateMachine : public modm::platform::pio::StateMachine<Pio{{ id }},SM> {};
class StateMachine : public modm::platform::pio::implementation::StateMachine<Pio{{ id }},SM> {};

template< class... Signals >
static void
Expand Down
Loading

0 comments on commit aabdeb5

Please sign in to comment.