fix(radio): race condition on pulse buffer (#6634)
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
enum ChannelsProtocols {
|
||||
PROTOCOL_CHANNELS_UNINITIALIZED,
|
||||
@@ -62,6 +63,9 @@ struct etx_proto_driver_t {
|
||||
// Some module settings may have been modified
|
||||
void (*onConfigChange)(void* ctx);
|
||||
|
||||
// Previous Frame already sent?
|
||||
bool (*txCompleted)(void* ctx);
|
||||
|
||||
// Module state mode has been modified
|
||||
// void (*onModeChange)(void* ctx, uint8_t old_mode, uint8_t new_mode);
|
||||
};
|
||||
|
||||
@@ -297,6 +297,22 @@ uint8_t modulePortGetModule(etx_module_state_t* st)
|
||||
return st - _module_states;
|
||||
}
|
||||
|
||||
bool modulePortSerialTxCompleted(void* ctx)
|
||||
{
|
||||
auto st = (etx_module_state_t*)ctx;
|
||||
auto drv = modulePortGetSerialDrv(st->tx);
|
||||
auto drv_ctx = modulePortGetCtx(st->tx);
|
||||
return drv->txCompleted(drv_ctx);
|
||||
}
|
||||
|
||||
bool modulePortTimerTxCompleted(void* ctx)
|
||||
{
|
||||
auto st = (etx_module_state_t*)ctx;
|
||||
auto drv = modulePortGetTimerDrv(st->tx);
|
||||
auto drv_ctx = modulePortGetCtx(st->tx);
|
||||
return drv->txCompleted(drv_ctx);
|
||||
}
|
||||
|
||||
bool modulePortIsPortUsedByModule(uint8_t module, uint8_t port)
|
||||
{
|
||||
auto mod_st = modulePortGetState(module);
|
||||
|
||||
@@ -162,6 +162,9 @@ inline void* modulePortGetCtx(const etx_module_driver_t& d) {
|
||||
return d.ctx;
|
||||
}
|
||||
|
||||
bool modulePortSerialTxCompleted(void* ctx);
|
||||
bool modulePortTimerTxCompleted(void* ctx);
|
||||
|
||||
bool modulePortIsPortUsedByModule(uint8_t module, uint8_t port);
|
||||
bool modulePortIsPortUsed(uint8_t port);
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
|
||||
enum SerialEncoding {
|
||||
@@ -79,7 +80,7 @@ typedef struct {
|
||||
void (*sendBuffer)(void* ctx, const uint8_t* data, uint32_t size);
|
||||
|
||||
// Is TX phase completed
|
||||
uint8_t (*txCompleted)(void* ctx);
|
||||
bool (*txCompleted)(void* ctx);
|
||||
|
||||
// Wait for last send operation to complete
|
||||
void (*waitForTxCompleted)(void* ctx);
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
|
||||
typedef struct {
|
||||
@@ -33,4 +34,5 @@ typedef struct {
|
||||
void* (*init)(void* hw_def, const etx_timer_config_t* cfg);
|
||||
void (*deinit)(void* ctx);
|
||||
void (*send)(void* ctx, const etx_timer_config_t* cfg, const void* pulses, uint16_t length);
|
||||
bool (*txCompleted)(void* ctx);
|
||||
} etx_timer_driver_t;
|
||||
|
||||
Reference in New Issue
Block a user