This commit is contained in:
pvvx 2017-12-28 18:44:55 +03:00
parent 8c8b03208e
commit 8e26e8ec8d
24 changed files with 2592 additions and 2483 deletions

View file

@ -269,10 +269,9 @@ int reset_uart_atcmd_setting(){
return 0;
}
#if ATCMD_RX_GPIO_WAKEUP
#ifdef UART_AT_RX_WAKE // UART_RX
#if defined(configUSE_WAKELOCK_PMU) && (configUSE_WAKELOCK_PMU == 1)
#include "gpio_irq_api.h"
#define UART_AT_RX_WAKE UART_RX
void gpio_uart_at_rx_irq_callback (uint32_t id, gpio_irq_event event)
{
/* PMU_LOGUART_DEVICE is also handled in log service.
@ -289,7 +288,6 @@ void uart_at_rx_wakeup()
gpio_irq_enable(&gpio_rx_wake);
}
#endif
#endif
void uart_atcmd_reinit(UART_LOG_CONF* uartconf){
serial_baud(&at_cmd_sobj,uartconf->BaudRate);
@ -297,14 +295,12 @@ void uart_atcmd_reinit(UART_LOG_CONF* uartconf){
// set flow control, only support RTS and CTS concurrent mode
// rxflow and tx flow is fixed by hardware
#define rxflow UART_RTS
#define txflow UART_CTS
if(uartconf->FlowControl){
pin_mode(txflow, PullDown); //init CTS in low
serial_set_flow_control(&at_cmd_sobj, FlowControlRTSCTS, rxflow, txflow);
serial_set_flow_control(&at_cmd_sobj, FlowControlRTSCTS); // , rxflow, txflow);
}
else
serial_set_flow_control(&at_cmd_sobj, FlowControlNone, rxflow, txflow);
serial_set_flow_control(&at_cmd_sobj, FlowControlNone); // , rxflow, txflow);
}
void uart_at_send_string(char *str)
@ -532,10 +528,10 @@ void uart_atcmd_main(void)
#define txflow UART_CTS
if(uartconf.FlowControl){
pin_mode(txflow, PullDown); //init CTS in low
serial_set_flow_control(&at_cmd_sobj, FlowControlRTSCTS, rxflow, txflow);
serial_set_flow_control(&at_cmd_sobj, FlowControlRTSCTS); //, rxflow, txflow);
}
else
serial_set_flow_control(&at_cmd_sobj, FlowControlNone, rxflow, txflow);
serial_set_flow_control(&at_cmd_sobj, FlowControlNone); //, rxflow, txflow);
/*uart_at_lock_init();*/
@ -550,7 +546,7 @@ void uart_atcmd_main(void)
serial_irq_handler(&at_cmd_sobj, uart_irq, (uint32_t)&at_cmd_sobj);
serial_irq_set(&at_cmd_sobj, RxIrq, 1);
#if ATCMD_RX_GPIO_WAKEUP
#ifdef UART_AT_RX_WAKE
#if defined(configUSE_WAKELOCK_PMU) && (configUSE_WAKELOCK_PMU == 1)
uart_at_rx_wakeup();
#endif

View file

@ -12,20 +12,48 @@
#include "semphr.h"
/*UART Pinmux*/
#define CONFIG_AMEBA1 1
#if CONFIG_AMEBA1
#define UART_TX PA_4
#define UART_RX PA_0
#define UART_RTS PA_2
#define UART_CTS PA_1
#else
#define UART_TX PA_23
#define UART_RX PA_18
#define UART_RTS PA_22
#define UART_CTS PA_19
#if defined(RTL8710AF) && defined(RTL8711AM)
#if 1
// RTL8711AM + RTL8710AF + RTL8195AM
#define UART_TX PE_0
#define UART_RX PE_3
#define UART_AT_RX_WAKE PE_3
#define UART_RTS PE_1
#define UART_CTS PE_2
#elif 0
// RTL8711AM + RTL8710AF
#define UART_TX PC_3
#define UART_RX PC_0 // no Interrupt!
//#define UART_AT_RX_WAKE PE_3
#define UART_RTS PC_2
#define UART_CTS PC_1
#elif 0
// RTL8711AM - RAK473
#define UART_TX PA_7
#define UART_RX PA_6 // no Interrupt!
//#define UART_RX_INT PE_3
#define UART_RTS PA_3
#define UART_CTS PA_5
#endif
#elif defined(RTL8710AF)
// RTL8710AF
#define UART_TX PA_4
#define UART_RX PA_0
#define UART_AT_RX_WAKE PA_0
#define UART_RTS PA_2
#define UART_CTS PA_1
#elif defined(RTL8711AM)
// RTL8711AM - RAK473
#define UART_TX PA_7
#define UART_RX PA_6 // no Interrupt!
//#define UART_AT_RX_WAKE PE_3
#define UART_RTS PA_3
#define UART_CTS PA_5
#endif
#define ATCMD_RX_GPIO_WAKEUP 0
#define KEY_NL 0xa // '\n'
#define KEY_ENTER 0xd // '\r'
#define KEY_BS 0x8