Attempt 1

This commit is contained in:
Łukasz Moskała 2023-01-30 22:03:49 +01:00
parent 6a026d0086
commit 2965291073
2 changed files with 5 additions and 20 deletions

View file

@ -1,8 +1,8 @@
#include <string.h> #include <string.h>
#include "freertos/FreeRTOS.h" #include <FreeRTOS.h>
#include "freertos/task.h" //#include "freertos/task.h"
#include "freertos/event_groups.h" //#include "freertos/event_groups.h"
#include "esp_system.h" #include "esp_system.h"
#include "esp_wifi.h" #include "esp_wifi.h"
#include "esp_event_loop.h" #include "esp_event_loop.h"
@ -171,23 +171,8 @@ char* data = (char*)malloc(BUF_SIZE);
} }
void PPPOS_init(int txPin, int rxPin, int baudrate, int uart_number, char* user, char* pass){ void PPPOS_init(int uart_number, char* user, char* pass){
PPPOS_uart_num = uart_number; PPPOS_uart_num = uart_number;
gpio_set_direction(txPin, GPIO_MODE_OUTPUT);
gpio_set_direction(rxPin, GPIO_MODE_INPUT);
gpio_set_pull_mode(rxPin, GPIO_PULLUP_ONLY);
uart_config_t uart_config = {
.baud_rate = baudrate,
.data_bits = UART_DATA_8_BITS,
.parity = UART_PARITY_DISABLE,
.stop_bits = UART_STOP_BITS_1,
.flow_ctrl = UART_HW_FLOWCTRL_DISABLE
};
uart_param_config(PPPOS_uart_num, &uart_config) ;
uart_set_pin(PPPOS_uart_num, txPin, rxPin, UART_PIN_NO_CHANGE, UART_PIN_NO_CHANGE);
uart_driver_install(PPPOS_uart_num, BUF_SIZE * 2, BUF_SIZE * 2, 0, NULL, 0);
tcpip_adapter_init(); tcpip_adapter_init();
PPP_User = user; PPP_User = user;
PPP_Pass = pass; PPP_Pass = pass;

View file

@ -8,7 +8,7 @@ extern "C" {
#define BUF_SIZE (1024) #define BUF_SIZE (1024)
void PPPOS_init(int txPin, int rxPin, int baudrate, int uart_number, char* user, char* pass); void PPPOS_init(int uart_number, char* user, char* pass);
bool PPPOS_isConnected(); bool PPPOS_isConnected();