Danger-alarm/SOFTWARE-FreeRTOS/Source/HC-12.cpp

21 lines
526 B
C++
Raw Normal View History

2024-06-03 16:27:41 +08:00
#include "HC-12.hpp"
void _HC_12_INIT()
{
uint tx_offset = pio_add_program(pio1, &uart_tx_program);
uart_tx_program_init(HC_12_PIO, HC_12_PIO_SM_TX, tx_offset, HC_12_PIO_TX_PIN, HC_12_PIO_SERIAL_BAUD);
uint rx_offset = pio_add_program(pio1, &uart_rx_program);
uart_rx_program_init(HC_12_PIO, HC_12_PIO_SM_RX, rx_offset, HC_12_PIO_RX_PIN, HC_12_PIO_SERIAL_BAUD);
return;
}
void _HC_12(const char *string)
{
uart_tx_program_puts(HC_12_PIO, HC_12_PIO_SM_TX, string);
sleep_ms(100);
return;
}