使用 PIO 串口(还未测试)

This commit is contained in:
2024-03-31 18:04:35 +08:00
parent d329c022b5
commit 7f9fc40757
7 changed files with 443 additions and 14 deletions

12
main.h
View File

@@ -14,15 +14,25 @@
#include "hardware/pwm.h"
#include "hardware/adc.h"
#include "hardware/pio.h"
#define UART0 uart0
#define BAUD_RATE 4800
#define DATA_BITS 8
#define STOP_BITS 1
#define PARITY UART_PARITY_NONE
#define UART0_TX_PIN 1
#define UART0_RX_PIN 0
#include "uart_tx.pio.h"
#include "uart_rx.pio.h"
#define IM1253B_PIO pio0
#define IM1253B_PIO_TX_PIN 19 // 接 IM1253B (TX) PIN
#define IM1253B_PIO_RX_PIN 20 // 接 IM1253B (RX) PIN
#define IM1253B_PIO_SM_TX 0
#define IM1253B_PIO_SM_RX 1
#define IM1253B_PIO_SERIAL_BAUD 4800
int Read_ID = 0x01;
unsigned char Tx_Buffer[8];
unsigned char Rx_Buffer[40];