Small doc/example changes
* Use PIO IRQ accessors in PIO I2C example * Update pio/ir_nec/README.adoc file links (#183) The "List of Files" now links (only) to files, not to directories (which prevented this example being included in the C SDK databook)
This commit is contained in:
@@ -108,10 +108,11 @@ static inline void i2c_program_init(PIO pio, uint sm, uint offset, uint pin_sda,
|
||||
gpio_set_oeover(pin_scl, GPIO_OVERRIDE_INVERT);
|
||||
pio_sm_set_pins_with_mask(pio, sm, 0, both_pins);
|
||||
|
||||
// Clear IRQ flag before starting
|
||||
hw_clear_bits(&pio->inte0, 1u << sm);
|
||||
hw_clear_bits(&pio->inte1, 1u << sm);
|
||||
pio->irq = 1u << sm;
|
||||
// Clear IRQ flag before starting, and make sure flag doesn't actually
|
||||
// assert a system-level interrupt (we're using it as a status flag)
|
||||
pio_set_irq0_source_enabled(pio, pis_interrupt0 + sm, false);
|
||||
pio_set_irq1_source_enabled(pio, pis_interrupt0 + sm, false);
|
||||
pio_interrupt_clear(pio, sm);
|
||||
|
||||
// Configure and start SM
|
||||
pio_sm_init(pio, sm, offset + i2c_offset_entry_point, &c);
|
||||
|
||||
@@ -13,13 +13,13 @@ const int PIO_I2C_NAK_LSB = 0;
|
||||
|
||||
|
||||
bool pio_i2c_check_error(PIO pio, uint sm) {
|
||||
return !!(pio->irq & (1u << sm));
|
||||
return pio_interrupt_get(pio, sm);
|
||||
}
|
||||
|
||||
void pio_i2c_resume_after_error(PIO pio, uint sm) {
|
||||
pio_sm_drain_tx_fifo(pio, sm);
|
||||
pio_sm_exec(pio, sm, (pio->sm[sm].execctrl & PIO_SM0_EXECCTRL_WRAP_BOTTOM_BITS) >> PIO_SM0_EXECCTRL_WRAP_BOTTOM_LSB);
|
||||
pio->irq = 1u << sm;
|
||||
pio_interrupt_clear(pio, sm);
|
||||
}
|
||||
|
||||
void pio_i2c_rx_enable(PIO pio, uint sm, bool en) {
|
||||
|
||||
@@ -26,20 +26,17 @@ After a successful build the executable program can be found in the **build/ir_l
|
||||
== List of Files
|
||||
|
||||
CMakeLists.txt:: CMake file to incorporate the example in to the examples build tree.
|
||||
ir_loopback:: A directory containing the code for the loopback example.
|
||||
CMakeLists.txt::: CMake file to incorporate the example in to the examples build tree.
|
||||
ir_loopback.c::: The code for the loopback example.
|
||||
nec_receive_library:: A directory containing the code for the IR receive functions.
|
||||
CMakeLists.txt::: CMake file to incorporate the IR receive library in to the examples build tree.
|
||||
nec_receive.c::: The source code for the IR receive functions.
|
||||
nec_receive.h::: The headers for the IR receive functions.
|
||||
nec_receive.pio::: The PIO assembler code to receive a frame.
|
||||
nec_transmit_library:: A directory containing the code for the IR transmit functions.
|
||||
CMakeLists.txt::: CMake file to incorporate the IR transmit library in to the examples build tree.
|
||||
nec_transmit.c::: The source code for the IR transmit functions.
|
||||
nec_transmit.h::: The headers for the IR transmit functions.
|
||||
nec_carrier_burst.pio::: The PIO assembler code to generate a carrier burst.
|
||||
nec_carrier_control.pio::: The PIO assembler code to transmit a complete frame.
|
||||
ir_loopback/CMakeLists.txt:: CMake file to incorporate the loopback example in to the examples build tree.
|
||||
ir_loopback/ir_loopback.c:: The code for the loopback example.
|
||||
nec_receive_library/CMakeLists.txt:: CMake file to incorporate the IR receive library in to the examples build tree.
|
||||
nec_receive_library/nec_receive.c:: The source code for the IR receive functions.
|
||||
nec_receive_library/nec_receive.h:: The headers for the IR receive functions.
|
||||
nec_receive_library/nec_receive.pio:: The PIO assembler code to receive a frame.
|
||||
nec_transmit_library/CMakeLists.txt:: CMake file to incorporate the IR transmit library in to the examples build tree.
|
||||
nec_transmit_library/nec_transmit.c:: The source code for the IR transmit functions.
|
||||
nec_transmit_library/nec_transmit.h:: The headers for the IR transmit functions.
|
||||
nec_transmit_library/nec_carrier_burst.pio:: The PIO assembler code to generate a carrier burst.
|
||||
nec_transmit_library/nec_carrier_control.pio:: The PIO assembler code to transmit a complete frame.
|
||||
|
||||
== Bill of Materials
|
||||
|
||||
|
||||
Reference in New Issue
Block a user