Build pico-example/cdc_msc sample on qmk build system Add usb descriptors Use usb config in config.h tentative implementation Enable debug print by cdc Process queued transfer before new report Fix dprint hang on Windows resolve warnings Add pico uart/i2c/spi sources Trim mouse report ID before send implement atomic_util Add eeprom emulation Save emulated eeprom by CLI comamnd Delete unused file Implement RGBLIGHT Add pio_manager Implement split Chang default serial speed Print elf size Fix make command Add eeprom save command to keymaps Reset when CDC baudrate is 1200bps Replace pro micro pin config to RP2040 pro micro Add i2c functions Disable LTO automatically Add CTPIM, CONVERT_TO_PICO_MICRO option Add MIDI functions Call usb_task() in midi send function Convert pico-sdk results to i2c_status Add build target uf2 to rp2040 Remove unused parts Fix warnings rp2040 samples: Update readme.md Check pico-sdk setup Implement lazy write back from eepemu to ROM Add PiPi Gherkin Change DDYNAMIC_KEYMAP_EEPROM_MAX_ADDR to 4095 PiPi Gherkin: Increase DYNAMIC_KEYMAP_LAYER_COUNT to 6 Change interface number of RAW to 1 due to VIA restriction Generate bs2_default_padded_checksummed.S at build time Calculate eeprom emulation region Fix warning Add pico/usb_util.c to SRC Fix pico's split Add keyboard_quantizer/rp Add pwm driver Remove unused file Add analog.c Change default FLASH clock div to 4 Fix merge mistakes and issues. rejig files remove ugfx more rejigging remove qmk_main add watchdog back
73 lines
2.5 KiB
C
73 lines
2.5 KiB
C
// -------------------------------------------------- //
|
|
// This file is autogenerated by pioasm; do not edit! //
|
|
// -------------------------------------------------- //
|
|
|
|
#pragma once
|
|
|
|
#if !PICO_NO_HARDWARE
|
|
#include "hardware/pio.h"
|
|
#endif
|
|
|
|
// ------- //
|
|
// uart_tx //
|
|
// ------- //
|
|
|
|
#define uart_tx_wrap_target 0
|
|
#define uart_tx_wrap 3
|
|
|
|
static const uint16_t uart_tx_program_instructions[] = {
|
|
// .wrap_target
|
|
0x9fa0, // 0: pull block side 1 [7]
|
|
0xf727, // 1: set x, 7 side 0 [7]
|
|
0x6001, // 2: out pins, 1
|
|
0x0642, // 3: jmp x--, 2 [6]
|
|
// .wrap
|
|
};
|
|
|
|
#if !PICO_NO_HARDWARE
|
|
static const struct pio_program uart_tx_program = {
|
|
.instructions = uart_tx_program_instructions,
|
|
.length = 4,
|
|
.origin = -1,
|
|
};
|
|
|
|
static inline pio_sm_config uart_tx_program_get_default_config(uint offset) {
|
|
pio_sm_config c = pio_get_default_sm_config();
|
|
sm_config_set_wrap(&c, offset + uart_tx_wrap_target, offset + uart_tx_wrap);
|
|
sm_config_set_sideset(&c, 2, true, false);
|
|
return c;
|
|
}
|
|
|
|
#include "hardware/clocks.h"
|
|
static inline void uart_tx_program_init(PIO pio, uint sm, uint offset, uint pin_tx, uint baud) {
|
|
// Tell PIO to initially drive output-high on the selected pin, then map PIO
|
|
// onto that pin with the IO muxes.
|
|
pio_sm_set_pins_with_mask(pio, sm, 1u << pin_tx, 1u << pin_tx);
|
|
pio_sm_set_pindirs_with_mask(pio, sm, 1u << pin_tx, 1u << pin_tx);
|
|
pio_gpio_init(pio, pin_tx);
|
|
pio_sm_config c = uart_tx_program_get_default_config(offset);
|
|
// OUT shifts to right, no autopull
|
|
sm_config_set_out_shift(&c, true, false, 32);
|
|
// We are mapping both OUT and side-set to the same pin, because sometimes
|
|
// we need to assert user data onto the pin (with OUT) and sometimes
|
|
// assert constant values (start/stop bit)
|
|
sm_config_set_out_pins(&c, pin_tx, 1);
|
|
sm_config_set_sideset_pins(&c, pin_tx);
|
|
// We only need TX, so get an 8-deep FIFO!
|
|
sm_config_set_fifo_join(&c, PIO_FIFO_JOIN_TX);
|
|
// SM transmits 1 bit per 8 execution cycles.
|
|
float div = (float)clock_get_hz(clk_sys) / (8 * baud);
|
|
sm_config_set_clkdiv(&c, div);
|
|
pio_sm_init(pio, sm, offset, &c);
|
|
pio_sm_set_enabled(pio, sm, true);
|
|
}
|
|
static inline void uart_tx_program_putc(PIO pio, uint sm, char c) {
|
|
pio_sm_put_blocking(pio, sm, (uint32_t)c);
|
|
}
|
|
static inline void uart_tx_program_puts(PIO pio, uint sm, const char *s) {
|
|
while (*s)
|
|
uart_tx_program_putc(pio, sm, *s++);
|
|
}
|
|
|
|
#endif
|
|
|