Skip to content

Commit 1425426

Browse files
chirag-silabsrestyled-commits
authored andcommitted
[Silabs][SiWx917] Fixing uart to read only once (#25902)
* fixing uart to read only once * Restyled by clang-format * Uart fix to read character by character * restyling the PR * removing the duplicate files * removing the siwx917 file * Restyled by gn * adding some comments --------- Co-authored-by: Restyled.io <[email protected]>
1 parent 1210189 commit 1425426

File tree

4 files changed

+15
-17
lines changed

4 files changed

+15
-17
lines changed

examples/platform/silabs/SiWx917/uart.cpp

-9
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,8 @@ extern ARM_DRIVER_USART Driver_USART0;
3333
static ARM_DRIVER_USART * UARTdrv = &Driver_USART0;
3434

3535
ARM_USART_CAPABILITIES drv_capabilities;
36-
ARM_USART_STATUS status;
37-
38-
#define BUFFER_SIZE 1
39-
uint8_t rx_buffer;
4036

4137
#define BAUD_VALUE 115200
42-
4338
#define UART_CONSOLE_ERR -1 // Negative value in case of UART Console action failed. Triggers a failure for PW_RPC
4439

4540
void ARM_USART_SignalEvent(uint32_t event);
@@ -141,10 +136,6 @@ void uartConsoleInit(void)
141136
DEBUGOUT("\r\n Receives data success \r\n");
142137
}
143138

144-
// Creating the receive event as a temp buffer
145-
// this is not used anywhere
146-
status = UARTdrv->Receive(&rx_buffer, 1);
147-
148139
NVIC_EnableIRQ(USART0_IRQn);
149140

150141
NVIC_SetPriority(USART0_IRQn, 7);

src/lib/shell/BUILD.gn

+4-8
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,11 @@ static_library("shell") {
5050
"MainLoopESP32.cpp",
5151
"streamer_esp32.cpp",
5252
]
53-
} else if (chip_device_platform == "efr32") {
53+
} else if (chip_device_platform == "efr32" ||
54+
chip_device_platform == "SiWx917") {
5455
sources += [
55-
"MainLoopEFR32.cpp",
56-
"streamer_efr32.cpp",
57-
]
58-
} else if (chip_device_platform == "SiWx917") {
59-
sources += [
60-
"MainLoopEFR32.cpp",
61-
"streamer_efr32.cpp",
56+
"MainLoopSilabs.cpp",
57+
"streamer_silabs.cpp",
6258
]
6359
} else if (chip_device_platform == "k32w0") {
6460
sources += [

src/lib/shell/MainLoopEFR32.cpp renamed to src/lib/shell/MainLoopSilabs.cpp

+11
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,22 @@ void ReadLine(char * buffer, size_t max)
4949
break;
5050
}
5151

52+
#ifdef BRD4325A
53+
// for 917 SoC board, we need to create a rx event before we wait for the shell activity
54+
// NotifyShellProcessFromISR() is called once the buffer is filled
55+
if (streamer_read(streamer_get(), buffer + line_sz, 1) != 1)
56+
{
57+
continue;
58+
}
59+
#endif
5260
chip::WaitForShellActivity();
61+
#ifndef BRD4325A
62+
// for EFR32 boards
5363
if (streamer_read(streamer_get(), buffer + line_sz, 1) != 1)
5464
{
5565
continue;
5666
}
67+
#endif
5768

5869
// Process character we just read.
5970
switch (buffer[line_sz])
File renamed without changes.

0 commit comments

Comments
 (0)