mirror of
https://github.com/openshwprojects/OpenBK7231T_App.git
synced 2025-10-29 11:33:20 +00:00
hal
This commit is contained in:
parent
ff035b8870
commit
cad47c3431
@ -60,7 +60,7 @@ void DMX_Show() {
|
||||
HAL_Delay_us(120); // ≥88µs
|
||||
HAL_PIN_SetOutputValue(dmx_pin, 1);
|
||||
HAL_Delay_us(12); // MAB ≥8µs
|
||||
HAL_UART_Init(250000, 2, false);
|
||||
HAL_UART_Init(250000, 2, false, dmx_pin, -1);
|
||||
#else
|
||||
#define DMX_BREAK_DURATION_MICROS 88
|
||||
uint32_t breakBaud = 1000000 * 8 / DMX_BREAK_DURATION_MICROS;
|
||||
@ -107,7 +107,7 @@ void DMX_Init() {
|
||||
|
||||
LEDS_InitShared(&ws_export);
|
||||
|
||||
HAL_UART_Init(250000, 2, false);
|
||||
HAL_UART_Init(250000, 2, false, dmx_pin, -1);
|
||||
}
|
||||
void DMX_OnEverySecond() {
|
||||
}
|
||||
|
||||
@ -254,7 +254,7 @@ int UART_InitUARTEx(int auartindex, int baud, int parity, bool hwflowc)
|
||||
#ifdef UART_2_UARTS_CONCURRENT
|
||||
HAL_UART_InitEx(auartindex, baud, parity, hwflowc);
|
||||
#else
|
||||
HAL_UART_Init(baud, parity, hwflowc);
|
||||
HAL_UART_Init(baud, parity, hwflowc, -1, -1);
|
||||
#endif
|
||||
return fuartbuf->g_uart_init_counter;
|
||||
}
|
||||
|
||||
@ -28,7 +28,7 @@ void HAL_UART_SendByteEx(int auartindex, byte b)
|
||||
bk_send_byte(bk_port_from_portindex(auartindex), b);
|
||||
}
|
||||
|
||||
int HAL_UART_InitEx(int auartindex, int baud, int parity, bool hwflowc)
|
||||
int HAL_UART_InitEx(int auartindex, int baud, int parity, bool hwflowc, int txOverride, int rxOverride)
|
||||
{
|
||||
bk_uart_config_t config;
|
||||
|
||||
|
||||
@ -66,7 +66,7 @@ void HAL_UART_SendByte(byte b)
|
||||
//bl_uart_data_send(g_id, b);
|
||||
}
|
||||
|
||||
int HAL_UART_Init(int baud, int parity, bool hwflowc)
|
||||
int HAL_UART_Init(int baud, int parity, bool hwflowc, int txOverride, int rxOverride)
|
||||
{
|
||||
if(fd_console < 0)
|
||||
{
|
||||
|
||||
@ -25,7 +25,7 @@ void HAL_UART_SendByte(byte b)
|
||||
drv_uart_send_poll(uart, &b, 1);
|
||||
}
|
||||
|
||||
int HAL_UART_Init(int baud, int parity, bool hwflowc)
|
||||
int HAL_UART_Init(int baud, int parity, bool hwflowc, int txOverride, int rxOverride)
|
||||
{
|
||||
drv_uart_close(uart);
|
||||
T_DRV_UART_CONFIG config =
|
||||
|
||||
@ -111,7 +111,7 @@ void HAL_SetBaud(uint32_t baud)
|
||||
uart_set_baudrate(uartnum, baud);
|
||||
}
|
||||
|
||||
int HAL_UART_Init(int baud, int parity, bool hwflowc)
|
||||
int HAL_UART_Init(int baud, int parity, bool hwflowc, int txOverride, int rxOverride)
|
||||
{
|
||||
if(CFG_HasFlag(OBK_FLAG_USE_SECONDARY_UART))
|
||||
{
|
||||
@ -145,9 +145,11 @@ int HAL_UART_Init(int baud, int parity, bool hwflowc)
|
||||
|
||||
|
||||
#if PLATFORM_ESPIDF
|
||||
uart_set_pin(uartnum,
|
||||
22, 21,
|
||||
UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE);
|
||||
if (txOverride != -1) {
|
||||
uart_set_pin(uartnum,
|
||||
txOverride, 21,
|
||||
UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE);
|
||||
}
|
||||
#endif
|
||||
|
||||
xTaskCreate(uart_event_task, "uart_event_task", 1024, NULL, 16, NULL);
|
||||
|
||||
@ -4,7 +4,7 @@ void __attribute__((weak)) HAL_UART_SendByte(byte b)
|
||||
{
|
||||
|
||||
}
|
||||
int __attribute__((weak)) HAL_UART_Init(int baud, int parity, bool hwflowc)
|
||||
int __attribute__((weak)) HAL_UART_Init(int baud, int parity, bool hwflowc, int txOverride, int rxOverride)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -12,5 +12,5 @@ int HAL_UART_InitEx(int auartindex, int baud, int parity, bool hwflowc);
|
||||
#else
|
||||
void HAL_UART_SendByte(byte b);
|
||||
|
||||
int HAL_UART_Init(int baud, int parity, bool hwflowc);
|
||||
int HAL_UART_Init(int baud, int parity, bool hwflowc, int txOverride, int rxOverride);
|
||||
#endif
|
||||
@ -28,7 +28,7 @@ void HAL_UART_SendByte(byte b)
|
||||
serial_putc(&sobj, b);
|
||||
}
|
||||
|
||||
int HAL_UART_Init(int baud, int parity, bool hwflowc)
|
||||
int HAL_UART_Init(int baud, int parity, bool hwflowc, int txOverride, int rxOverride)
|
||||
{
|
||||
if(isInitialized)
|
||||
{
|
||||
|
||||
@ -31,7 +31,7 @@ void HAL_UART_SendByte(byte b)
|
||||
serial_putc(&sobj, b);
|
||||
}
|
||||
|
||||
int HAL_UART_Init(int baud, int parity, bool hwflowc)
|
||||
int HAL_UART_Init(int baud, int parity, bool hwflowc, int txOverride, int rxOverride)
|
||||
{
|
||||
if(isInitialized)
|
||||
{
|
||||
|
||||
@ -36,7 +36,7 @@ void HAL_UART_SendByte(byte b)
|
||||
serial_putc(&sobj, b);
|
||||
}
|
||||
|
||||
int HAL_UART_Init(int baud, int parity, bool hwflowc)
|
||||
int HAL_UART_Init(int baud, int parity, bool hwflowc, int txOverride, int rxOverride)
|
||||
{
|
||||
if(isInitialized)
|
||||
{
|
||||
|
||||
@ -46,7 +46,7 @@ void HAL_UART_SendByte(byte b)
|
||||
serial_putc(&sobj, b);
|
||||
}
|
||||
|
||||
int HAL_UART_Init(int baud, int parity, bool hwflowc)
|
||||
int HAL_UART_Init(int baud, int parity, bool hwflowc, int txOverride, int rxOverride)
|
||||
{
|
||||
if(isInitialized)
|
||||
{
|
||||
|
||||
@ -34,7 +34,7 @@ void HAL_UART_SendByte(byte b)
|
||||
hal_uart_putc(&sobj.uart_adp, b);
|
||||
}
|
||||
|
||||
int HAL_UART_Init(int baud, int parity, bool hwflowc)
|
||||
int HAL_UART_Init(int baud, int parity, bool hwflowc, int txOverride, int rxOverride)
|
||||
{
|
||||
if(isInitialized)
|
||||
{
|
||||
|
||||
@ -45,7 +45,7 @@ void HAL_UART_SendByte(byte b)
|
||||
tls_uart_write(used_uart, (char*)&b, 1);
|
||||
}
|
||||
|
||||
int HAL_UART_Init(int baud, int parity, bool hwflowc)
|
||||
int HAL_UART_Init(int baud, int parity, bool hwflowc, int txOverride, int rxOverride)
|
||||
{
|
||||
struct tls_uart_options uart_opts;
|
||||
uart_opts.baudrate = baud;
|
||||
|
||||
@ -13,7 +13,7 @@ void HAL_UART_SendByte(byte b)
|
||||
//addLogAdv(LOG_INFO, LOG_FEATURE_TUYAMCU,"%02X", b);
|
||||
}
|
||||
|
||||
int HAL_UART_Init(int baud, int parity, bool hwflowc)
|
||||
int HAL_UART_Init(int baud, int parity, bool hwflowc, int txOverride, int rxOverride)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -29,7 +29,7 @@ void HAL_UART_SendByte(byte b)
|
||||
HAL_UART_Transmit_IT(uart, &b, 1);
|
||||
}
|
||||
|
||||
int OBK_HAL_UART_Init(int baud, int parity, bool hwflowc)
|
||||
int OBK_HAL_UART_Init(int baud, int parity, bool hwflowc, int txOverride, int rxOverride)
|
||||
{
|
||||
if(isInit) return 1;
|
||||
HAL_Status status = HAL_ERROR;
|
||||
|
||||
@ -314,18 +314,18 @@ void Test_WS2812B() {
|
||||
}
|
||||
CMD_ExecuteCommand("startDriver DDP", 0);
|
||||
CMD_ExecuteCommand("startDriver DDPSend", 0);
|
||||
CMD_ExecuteCommand("DDP_Send 127.0.0.1 4048 3 0 FF00AB", 0);
|
||||
CMD_ExecuteCommand("DDP_Send 127.0.0.1 3 0 FF00AB", 0);
|
||||
SIM_WaitForDDPPacket();
|
||||
// this requires udp to work so it can pass...
|
||||
if (1) {
|
||||
SELFTEST_ASSERT_PIXEL(0, 0xFF, 0x00, 0xAB);
|
||||
}
|
||||
CMD_ExecuteCommand("DDP_Send 127.0.0.1 4048 3 0 ABCDEF", 0);
|
||||
CMD_ExecuteCommand("DDP_Send 127.0.0.1 3 0 ABCDEF", 0);
|
||||
SIM_WaitForDDPPacket();
|
||||
if (1) {
|
||||
SELFTEST_ASSERT_PIXEL(0, 0xAB, 0xCD, 0xEF);
|
||||
}
|
||||
CMD_ExecuteCommand("DDP_Send 127.0.0.1 4048 3 0 ABCDEFAABBCC", 0);
|
||||
CMD_ExecuteCommand("DDP_Send 127.0.0.1 3 0 ABCDEFAABBCC", 0);
|
||||
SIM_WaitForDDPPacket();
|
||||
if (1) {
|
||||
SELFTEST_ASSERT_PIXEL(0, 0xAB, 0xCD, 0xEF);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user