Skip to content

Commit

Permalink
Revert "Rework of WireProtocol (#1884)" (#1897)
Browse files Browse the repository at this point in the history
  • Loading branch information
josesimoes committed May 1, 2021
1 parent 30674ad commit 7e82e46
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 18 deletions.
9 changes: 6 additions & 3 deletions targets/ChibiOS/_common/WireProtocol_ReceiverThread.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#include <cmsis_os.h>
#include <WireProtocol_Message.h>

extern WP_Message inboundMessage;

#if (HAL_USE_SERIAL_USB == TRUE)
extern SerialUSBDriver SDU1;
#endif
Expand All @@ -21,8 +23,6 @@ __attribute__((noreturn)) void ReceiverThread(void const *argument)

osDelay(500);

WP_Message_PrepareReception();

// loop until thread receives a request to terminate
while (1)
{
Expand All @@ -33,7 +33,10 @@ __attribute__((noreturn)) void ReceiverThread(void const *argument)
{
#endif

WP_Message_Process();
WP_Message_Initialize(&inboundMessage);
WP_Message_PrepareReception(&inboundMessage);

WP_Message_Process(&inboundMessage);

#if (HAL_USE_SERIAL_USB == TRUE)
// pass control to the OS
Expand Down
16 changes: 11 additions & 5 deletions targets/FreeRTOS/_common/WireProtocol_ReceiverThread.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,26 @@

#include "FreeRTOS.h"
#include "task.h"
#include <WireProtocol_HAL_Interface.h>
#include <WireProtocol_Message.h>
#include "WireProtocol_HAL_Interface.h"

extern WP_Message inboundMessage;

void WP_Message_Initialize(WP_Message *a);
void WP_Message_PrepareReception(WP_Message *a);
void WP_Message_Process(WP_Message *a);

void ReceiverThread(void *argument)
{
(void)argument;

WP_Message_PrepareReception();

// loop forever
while (1)
{

WP_Message_Process();
WP_Message_Initialize(&inboundMessage);
WP_Message_PrepareReception(&inboundMessage);

WP_Message_Process(&inboundMessage);

// Allow other tasks a chance to run
taskYIELD();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,26 @@
//

#include <esp32_os.h>
#include <WireProtocol_HAL_Interface.h>
#include <WireProtocol_Message.h>
#include "WireProtocol_HAL_Interface.h"

extern WP_Message inboundMessage;

void WP_Message_Initialize(WP_Message *a);
void WP_Message_PrepareReception(WP_Message *a);
void WP_Message_Process(WP_Message *a);

void ReceiverThread(void const *argument)
{
(void)argument;

WP_Message_PrepareReception();

// loop forever
while (1)
{

WP_Message_Process();
WP_Message_Initialize(&inboundMessage);
WP_Message_PrepareReception(&inboundMessage);

WP_Message_Process(&inboundMessage);

// Allow other tasks a chance to run
vTaskDelay(0);
Expand Down
16 changes: 11 additions & 5 deletions targets/TI-SimpleLink/_common/WireProtocol_ReceiverThread.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,28 @@
// See LICENSE file in the project root for full license information.
//

#include <WireProtocol_HAL_Interface.h>
#include <WireProtocol_Message.h>
#include "WireProtocol_HAL_Interface.h"
#include <ti/sysbios/knl/Task.h>
#include <xdc/std.h>

extern WP_Message inboundMessage;

void WP_Message_Initialize(WP_Message *a);
void WP_Message_PrepareReception(WP_Message *a);
void WP_Message_Process(WP_Message *a);

void ReceiverThread(UArg arg0, UArg arg1)
{
(void)arg0;
(void)arg1;

WP_Message_PrepareReception();

// loop forever
while (1)
{
WP_Message_Process();
WP_Message_Initialize(&inboundMessage);
WP_Message_PrepareReception(&inboundMessage);

WP_Message_Process(&inboundMessage);

// Allow other tasks a chance to run
Task_yield();
Expand Down

0 comments on commit 7e82e46

Please sign in to comment.