dRonin  adbada4
dRonin firmware
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Storm32bgc Module

Files

file  storm32bgc.c
 Forward a set of UAVObjects when updated out a PIOS_COM port.
 

Macros

#define STACK_SIZE_BYTES   512
 
#define TASK_PRIORITY   PIOS_THREAD_PRIO_LOW
 
#define STORM32BGC_PERIOD_MS   20
 
#define STORM32BGC_QUEUE_SIZE   64
 
#define X25_INIT_CRC   0xFFFF
 

Functions

static void storm32bgcTask (void *parameters)
 
static uint16_t crc_calculate (uint8_t *pBuffer, int length)
 Calculates the X.25 checksum on a byte buffer. More...
 
static uint8_t cmd_set_angle (float pitch, float roll, float yaw, uint8_t flags, uint8_t type)
 
int32_t Storm32BgcInitialize (void)
 
int32_t Storm32BgcStart (void)
 
 MODULE_INITCALL (Storm32BgcInitialize, Storm32BgcStart)
 
static void crc_accumulate (uint8_t data, uint16_t *crcAccum)
 Accumulate the X.25 CRC by adding one char at a time. More...
 

Variables

static struct pios_thread * storm32bgcTaskHandle
 
static bool module_enabled
 
struct pios_queuestorm32bgc_queue
 
static struct
pios_recursive_mutex
mutex
 
static uintptr_t storm32bgc_com_id
 
union {
   uint16_t   value
 
   uint8_t   bytes [2]
 
crc
 
union {
   uint16_t   value
 
   uint8_t   bytes [2]
 
dataU16
 
union {
   float   value
 
   uint8_t   bytes [4]
 
dataFloat
 

Detailed Description

Macro Definition Documentation

#define STACK_SIZE_BYTES   512

Definition at line 44 of file storm32bgc.c.

#define STORM32BGC_PERIOD_MS   20

Definition at line 47 of file storm32bgc.c.

#define STORM32BGC_QUEUE_SIZE   64

Definition at line 48 of file storm32bgc.c.

#define TASK_PRIORITY   PIOS_THREAD_PRIO_LOW

Definition at line 45 of file storm32bgc.c.

#define X25_INIT_CRC   0xFFFF

CALCULATE THE CHECKSUM

Definition at line 175 of file storm32bgc.c.

Function Documentation

static uint8_t cmd_set_angle ( float  pitch,
float  roll,
float  yaw,
uint8_t  flags,
uint8_t  type 
)
static

Send the Set Angle Command

Returns
0 = No Response from Storm32bgc
1 = SERIALRCCMD_ACK_OK
2 = SERIALRCCMD_ACK_ERR_FAIL
3 = SERIALRCCMD_ACK_ERR_ACCESS_DENIED
4 = SERIALRCCMD_ACK_ERR_NOT_SUPPORTED
151 = SERIALRCCMD_ACK_ERR_TIMEOUT
152 = SERIALRCCMD_ACK_ERR_CRC
153 = SERIALRCCMD_ACK_ERR_PAYLOADLEN
200 = Storm32bgc ACK CRC incorrect

Definition at line 237 of file storm32bgc.c.

static void crc_accumulate ( uint8_t  data,
uint16_t *  crcAccum 
)
inlinestatic

Accumulate the X.25 CRC by adding one char at a time.

The checksum function adds the hash of one char at a time to the 16 bit checksum (uint16_t).

Parameters
datanew char to hash
crcAccumthe already accumulated checksum

Definition at line 186 of file storm32bgc.c.

static uint16_t crc_calculate ( uint8_t *  pBuffer,
int  length 
)
inlinestatic

Calculates the X.25 checksum on a byte buffer.

Parameters
pBufferbuffer containing the byte array to hash
lengthlength of the byte array
Returns
the checksum over the buffer bytes

Definition at line 203 of file storm32bgc.c.

MODULE_INITCALL ( Storm32BgcInitialize  ,
Storm32BgcStart   
)
int32_t Storm32BgcInitialize ( void  )

Initialise the Storm32Bgc module

Returns
-1 if initialisation failed
0 on success

Definition at line 73 of file storm32bgc.c.

int32_t Storm32BgcStart ( void  )

Start the Storm32Bgc module

Returns
-1 if initialisation failed
0 on success

Definition at line 93 of file storm32bgc.c.

static void storm32bgcTask ( void *  parameters)
static

Definition at line 122 of file storm32bgc.c.

Variable Documentation

uint8_t { ... } bytes[2]

Definition at line 156 of file storm32bgc.c.

uint8_t { ... } bytes[2]

Definition at line 161 of file storm32bgc.c.

uint8_t { ... } bytes[4]

Definition at line 166 of file storm32bgc.c.

union { ... } crc
union { ... } dataFloat
union { ... } dataU16
bool module_enabled
static

Definition at line 54 of file storm32bgc.c.

struct pios_recursive_mutex* mutex
static

Definition at line 56 of file storm32bgc.c.

uintptr_t storm32bgc_com_id
static

Definition at line 66 of file storm32bgc.c.

struct pios_queue* storm32bgc_queue

Definition at line 55 of file storm32bgc.c.

struct pios_thread* storm32bgcTaskHandle
static

Definition at line 53 of file storm32bgc.c.

uint16_t { ... } value

Definition at line 155 of file storm32bgc.c.

uint16_t { ... } value

Definition at line 160 of file storm32bgc.c.

float { ... } value

Definition at line 165 of file storm32bgc.c.