Skip to content

Commit 3ff07f7

Browse files
authored
Revert "Optimize UART data transmission. (#60)
1 parent 8435a2b commit 3ff07f7

File tree

3 files changed

+15
-19
lines changed

3 files changed

+15
-19
lines changed

app/main.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1916,7 +1916,20 @@ static uint8_t calcXor(uint8_t* buf, uint8_t len)
19161916
}
19171917
static void uart_put_data(uint8_t* pdata, uint8_t lenth)
19181918
{
1919-
app_uart_put_data(pdata, lenth);
1919+
uint32_t err_code;
1920+
1921+
while ( lenth-- )
1922+
{
1923+
do
1924+
{
1925+
err_code = app_uart_put(*pdata++);
1926+
if ( (err_code != NRF_SUCCESS) && (err_code != NRF_ERROR_BUSY) )
1927+
{
1928+
APP_ERROR_CHECK(err_code);
1929+
}
1930+
}
1931+
while ( err_code == NRF_ERROR_BUSY );
1932+
}
19201933
}
19211934

19221935
static void send_stm_data(uint8_t* pdata, uint8_t lenth)

ble-firmware/components/libraries/uart/app_uart.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ uint32_t app_uart_flush(void);
251251
*/
252252
uint32_t app_uart_close(void);
253253

254-
uint32_t app_uart_put_data(uint8_t* pdata, uint8_t lenth);
254+
255255

256256
#ifdef __cplusplus
257257
}

ble-firmware/components/libraries/uart/app_uart_fifo.c

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
#include "app_fifo.h"
4444
#include "nrf_drv_uart.h"
4545
#include "nrf_assert.h"
46-
#include "nrf_delay.h"
4746

4847
static nrf_drv_uart_t app_uart_inst = NRF_DRV_UART_INSTANCE(APP_UART_DRIVER_INSTANCE);
4948

@@ -244,22 +243,6 @@ uint32_t app_uart_put(uint8_t byte)
244243
return err_code;
245244
}
246245

247-
uint32_t app_uart_put_data(uint8_t* pdata, uint8_t lenth)
248-
{
249-
uint32_t count = 0;
250-
while (nrf_drv_uart_tx_in_progress(&app_uart_inst))
251-
{
252-
nrf_delay_ms(10);
253-
count++;
254-
}
255-
if (count > 50)
256-
{
257-
return NRF_ERROR_BUSY;
258-
}
259-
ret_code_t ret = nrf_drv_uart_tx(&app_uart_inst, pdata, lenth);
260-
return ret;
261-
}
262-
263246

264247
uint32_t app_uart_close(void)
265248
{

0 commit comments

Comments
 (0)