dRonin  adbada4
dRonin firmware
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Com Port to Radio Bridge Module

Data Structures

struct  RadioComBridgeData
 

Macros

#define STACK_SIZE_BYTES   600
 
#define TASK_PRIORITY   PIOS_THREAD_PRIO_LOW
 
#define MAX_RETRIES   2
 
#define MAX_PORT_DELAY   200
 
#define COMSTATS_INJECT   400
 
#define RETRY_TIMEOUT_MS   150
 
#define USB_ACTIVITY_TIMEOUT_MS   6000
 
#define MetaObjectId(x)   (x+1)
 

Functions

static void telemetryRxTask (void *parameters)
 
static void radioRxTask (void *parameters)
 
static int32_t UAVTalkSendHandler (void *ctx, uint8_t *buf, int32_t length)
 Transmit data buffer to the com port. More...
 
static int32_t RadioSendHandler (void *ctx, uint8_t *buf, int32_t length)
 
static void ProcessLocalStream (UAVTalkConnection inConnectionHandle, UAVTalkConnection outConnectionHandle, uint8_t rxbyte)
 Process a byte of data received on the telemetry stream. More...
 
static void ProcessRadioStream (UAVTalkConnection inConnectionHandle, UAVTalkConnection outConnectionHandle, uint8_t rxbyte)
 Process a byte of data received on the radio data stream. More...
 
static void NewReceiverData (const UAVObjEvent *ev, void *ctx, void *obj, int len)
 
static uintptr_t getComPort ()
 
static int32_t RadioComBridgeStart (void)
 Start the module. More...
 
static int32_t RadioComBridgeInitialize (void)
 Initialise the module. More...
 
 MODULE_INITCALL (RadioComBridgeInitialize, RadioComBridgeStart)
 
static void updateRadioComBridgeStats ()
 
static void radioRxTask (__attribute__((unused)) void *parameters)
 Radio rx task. Receive data packets from the radio and pass them on. More...
 
static void telemetryRxTask (__attribute__((unused)) void *parameters)
 Receive telemetry from the USB/COM port. More...
 

Variables

struct pios_thread * RadioComBridgeData::telemetryRxTaskHandle
 
struct pios_thread * RadioComBridgeData::radioRxTaskHandle
 
UAVTalkConnection RadioComBridgeData::telemUAVTalkCon
 
UAVTalkConnection RadioComBridgeData::radioUAVTalkCon
 
volatile bool RadioComBridgeData::have_port
 
static RadioComBridgeDatadata
 

Detailed Description

Macro Definition Documentation

#define COMSTATS_INJECT   400

Definition at line 72 of file radiocombridge.c.

#define MAX_PORT_DELAY   200

Definition at line 71 of file radiocombridge.c.

#define MAX_RETRIES   2

Definition at line 70 of file radiocombridge.c.

#define MetaObjectId (   x)    (x+1)

Definition at line 457 of file radiocombridge.c.

#define RETRY_TIMEOUT_MS   150

Definition at line 73 of file radiocombridge.c.

#define STACK_SIZE_BYTES   600

Definition at line 68 of file radiocombridge.c.

#define TASK_PRIORITY   PIOS_THREAD_PRIO_LOW

Definition at line 69 of file radiocombridge.c.

#define USB_ACTIVITY_TIMEOUT_MS   6000

Definition at line 74 of file radiocombridge.c.

Function Documentation

static uintptr_t getComPort ( )
static

Determine input/output com port as highest priority available

Definition at line 159 of file radiocombridge.c.

MODULE_INITCALL ( RadioComBridgeInitialize  ,
RadioComBridgeStart   
)
static void NewReceiverData ( const UAVObjEvent ev,
void *  ctx,
void *  obj,
int  len 
)
static

Definition at line 111 of file radiocombridge.c.

static void ProcessLocalStream ( UAVTalkConnection  inConnectionHandle,
UAVTalkConnection  outConnectionHandle,
uint8_t  rxbyte 
)
static

Process a byte of data received on the telemetry stream.

Parameters
[in]inConnectionHandleThe UAVTalk connection handle on the telemetry port
[in]outConnectionHandleThe UAVTalk connection handle on the radio port.
[in]rxbyteThe received byte.

Definition at line 465 of file radiocombridge.c.

static void ProcessRadioStream ( UAVTalkConnection  inConnectionHandle,
UAVTalkConnection  outConnectionHandle,
uint8_t  rxbyte 
)
static

Process a byte of data received on the radio data stream.

Parameters
[in]inConnectionHandleThe UAVTalk connection handle on the radio port.
[in]outConnectionHandleThe UAVTalk connection handle on the telemetry port.
[in]rxbyteThe received byte.

Definition at line 509 of file radiocombridge.c.

static int32_t RadioComBridgeInitialize ( void  )
static

Initialise the module.

Returns
-1 if initialisation failed on success

Definition at line 224 of file radiocombridge.c.

static int32_t RadioComBridgeStart ( void  )
static

Start the module.

Returns
-1 if initialisation failed, 0 on success

Definition at line 190 of file radiocombridge.c.

static void radioRxTask ( void *  parameters)
static
static void radioRxTask ( __attribute__((unused)) void *  parameters)
static

Radio rx task. Receive data packets from the radio and pass them on.

Parameters
[in]parametersThe task parameters

Definition at line 305 of file radiocombridge.c.

static int32_t RadioSendHandler ( void *  ctx,
uint8_t *  buf,
int32_t  length 
)
static

Transmit data buffer to the com port.

Parameters
[in]bufData buffer to send
[in]lengthLength of buffer
Returns
-1 on failure
number of bytes transmitted on success

Definition at line 442 of file radiocombridge.c.

static void telemetryRxTask ( void *  parameters)
static
static void telemetryRxTask ( __attribute__((unused)) void *  parameters)
static

Receive telemetry from the USB/COM port.

Parameters
[in]parametersThe task parameters

Definition at line 358 of file radiocombridge.c.

static int32_t UAVTalkSendHandler ( void *  ctx,
uint8_t *  buf,
int32_t  length 
)
static

Transmit data buffer to the com port.

Parameters
[in]bufData buffer to send
[in]lengthLength of buffer
Returns
-1 on failure
number of bytes transmitted on success

Definition at line 417 of file radiocombridge.c.

static void updateRadioComBridgeStats ( )
static

Update telemetry statistics

Definition at line 261 of file radiocombridge.c.

Variable Documentation

RadioComBridgeData* data
static

Definition at line 109 of file radiocombridge.c.

volatile bool RadioComBridgeData::have_port

Definition at line 88 of file radiocombridge.c.

struct pios_thread* RadioComBridgeData::radioRxTaskHandle

Definition at line 82 of file radiocombridge.c.

UAVTalkConnection RadioComBridgeData::radioUAVTalkCon

Definition at line 86 of file radiocombridge.c.

struct pios_thread* RadioComBridgeData::telemetryRxTaskHandle

Definition at line 81 of file radiocombridge.c.

UAVTalkConnection RadioComBridgeData::telemUAVTalkCon

Definition at line 85 of file radiocombridge.c.