Skip to content

Commit fa3120c

Browse files
committed
PPPoS example: Move pin configuration to menuconfig, add log statement
Also remove spurious infinite loop in app_main()
1 parent f3a567b commit fa3120c

File tree

2 files changed

+44
-12
lines changed

2 files changed

+44
-12
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,49 @@
1-
menu "GSM configuration"
1+
menu "Example Configuration"
22

33
config GSM_INTERNET_USER
4-
string "Internet User"
4+
string "GSM Internet User"
55
default ""
66
help
77
Network provider internet user.
88

99
config GSM_INTERNET_PASSWORD
10-
string "Internet password"
10+
string "GSM Internet password"
1111
default ""
1212
help
1313
Network provider internet password
14-
14+
1515
config GSM_APN
16-
string "Internet APN"
16+
string "GSM Internet APN"
1717
default "playmetric"
1818
help
1919
APN from network provider for internet access
2020

21-
endmenu
21+
config UART1_TX_PIN
22+
int "PPP serial TX GPIO"
23+
default 17
24+
range 0 31
25+
help
26+
Pin to configure for UART1 TX
27+
28+
config UART1_RX_PIN
29+
int "PPP serial RX GPIO"
30+
default 16
31+
range 0 31
32+
help
33+
Pin to configure for UART1 RX
34+
35+
config UART1_RTS_PIN
36+
int "PPP serial RTS GPIO"
37+
default 18
38+
range 0 31
39+
help
40+
Pin to configure for UART1 RTS
41+
42+
config UART1_CTS_PIN
43+
int "PPP serial CTS GPIO"
44+
default 23
45+
range 0 31
46+
help
47+
Pin to configure for UART1 CTS
48+
49+
endmenu

examples/protocols/pppos_client/main/pppos_client_main.c

+10-6
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,12 @@ const char *PPP_ApnATReq = "AT+CGDCONT=1,\"IP\",\"" \
3636
CONFIG_GSM_APN \
3737
"\"";
3838

39+
/* Pins used for serial communication with GSM module */
40+
#define UART1_TX_PIN CONFIG_UART1_TX_PIN
41+
#define UART1_RX_PIN CONFIG_UART1_RX_PIN
42+
#define UART1_RTS_PIN CONFIG_UART1_RTS_PIN
43+
#define UART1_CTS_PIN CONFIG_UART1_CTS_PIN
44+
3945
/* UART */
4046
int uart_num = UART_NUM_1;
4147

@@ -208,8 +214,10 @@ static void pppos_client_task()
208214
//Configure UART1 parameters
209215
uart_param_config(uart_num, &uart_config);
210216

211-
//Set UART1 pins(TX: IO17, RX: IO16, RTS: IO18, CTS: IO23)
212-
uart_set_pin(uart_num, 17, 16, 18, 23);
217+
// Configure UART1 pins (as set in example's menuconfig)
218+
ESP_LOGI(TAG, "Configuring UART1 GPIOs: TX:%d RX:%d RTS:%d CTS: %d",
219+
UART1_TX_PIN, UART1_RX_PIN, UART1_RTS_PIN, UART1_CTS_PIN);
220+
uart_set_pin(uart_num, UART1_TX_PIN, UART1_RX_PIN, UART1_RTS_PIN, UART1_CTS_PIN);
213221
uart_driver_install(uart_num, BUF_SIZE * 2, BUF_SIZE * 2, 0, NULL, 0);
214222

215223
while (1) {
@@ -285,8 +293,4 @@ void app_main()
285293
{
286294
tcpip_adapter_init();
287295
xTaskCreate(&pppos_client_task, "pppos_client_task", 2048, NULL, 5, NULL);
288-
289-
while (1) {
290-
vTaskDelay(1000 / portTICK_RATE_MS);
291-
}
292296
}

0 commit comments

Comments
 (0)