Skip to content

Commit

Permalink
[Silabs][SiWx917] Fixing uart to read only once (#25902)
Browse files Browse the repository at this point in the history
* 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 <commits@restyled.io>
  • Loading branch information
2 people authored and pull[bot] committed Jun 23, 2023
1 parent 5acffb2 commit 018777b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 17 deletions.
9 changes: 0 additions & 9 deletions examples/platform/silabs/SiWx917/uart.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,8 @@ extern ARM_DRIVER_USART Driver_USART0;
static ARM_DRIVER_USART * UARTdrv = &Driver_USART0;

ARM_USART_CAPABILITIES drv_capabilities;
ARM_USART_STATUS status;

#define BUFFER_SIZE 1
uint8_t rx_buffer;

#define BAUD_VALUE 115200

#define UART_CONSOLE_ERR -1 // Negative value in case of UART Console action failed. Triggers a failure for PW_RPC

void ARM_USART_SignalEvent(uint32_t event);
Expand Down Expand Up @@ -141,10 +136,6 @@ void uartConsoleInit(void)
DEBUGOUT("\r\n Receives data success \r\n");
}

// Creating the receive event as a temp buffer
// this is not used anywhere
status = UARTdrv->Receive(&rx_buffer, 1);

NVIC_EnableIRQ(USART0_IRQn);

NVIC_SetPriority(USART0_IRQn, 7);
Expand Down
12 changes: 4 additions & 8 deletions src/lib/shell/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,11 @@ static_library("shell") {
"MainLoopESP32.cpp",
"streamer_esp32.cpp",
]
} else if (chip_device_platform == "efr32") {
} else if (chip_device_platform == "efr32" ||
chip_device_platform == "SiWx917") {
sources += [
"MainLoopEFR32.cpp",
"streamer_efr32.cpp",
]
} else if (chip_device_platform == "SiWx917") {
sources += [
"MainLoopEFR32.cpp",
"streamer_efr32.cpp",
"MainLoopSilabs.cpp",
"streamer_silabs.cpp",
]
} else if (chip_device_platform == "k32w0") {
sources += [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,22 @@ void ReadLine(char * buffer, size_t max)
break;
}

#ifdef BRD4325A
// for 917 SoC board, we need to create a rx event before we wait for the shell activity
// NotifyShellProcessFromISR() is called once the buffer is filled
if (streamer_read(streamer_get(), buffer + line_sz, 1) != 1)
{
continue;
}
#endif
chip::WaitForShellActivity();
#ifndef BRD4325A
// for EFR32 boards
if (streamer_read(streamer_get(), buffer + line_sz, 1) != 1)
{
continue;
}
#endif

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

0 comments on commit 018777b

Please sign in to comment.