34 #include "modulesettings.h" 
   41 #include "cameradesired.h" 
   44 #define STACK_SIZE_BYTES 512 
   45 #define TASK_PRIORITY PIOS_THREAD_PRIO_LOW 
   47 #define STORM32BGC_PERIOD_MS  20  // 50 Hz 
   48 #define STORM32BGC_QUEUE_SIZE 64 
  102         if (!storm32bgc_queue){
 
  126         CameraDesiredData cameraDesired;
 
  133                 CameraDesiredGet(&cameraDesired);
 
  135                 float pitch_setpoint = cameraDesired.Declination;
 
  136                 float yaw_setpoint   = cameraDesired.Bearing;
 
  138                 switch(
cmd_set_angle(pitch_setpoint, 0.0
f, yaw_setpoint, 0x00, 0x00)) {
 
  141                                 AlarmsSet(SYSTEMALARMS_ALARM_GIMBAL, SYSTEMALARMS_ALARM_WARNING);
 
  145                                 AlarmsSet(SYSTEMALARMS_ALARM_GIMBAL, SYSTEMALARMS_ALARM_OK);
 
  149                                 AlarmsSet(SYSTEMALARMS_ALARM_GIMBAL, SYSTEMALARMS_ALARM_CRITICAL);
 
  175 #define X25_INIT_CRC 0xFFFF 
  191         tmp = data ^ (uint8_t)(*crcAccum &0xFF);
 
  193         *crcAccum = (*crcAccum>>8) ^ (tmp<<8) ^ (tmp <<3) ^ (tmp>>4);
 
  218         for (i = 0; i < 
length; i++){
 
  239         uint8_t command_string[19];
 
  240         uint8_t read_data[6] = {0,};
 
  244         command_string[0] = 0xFA;  
 
  245         command_string[1] = 0x0E;  
 
  246         command_string[2] = 0x11;  
 
  266         command_string[15] = 
flags;  
 
  268         command_string[16] = 
type;   
 
  272         command_string[17] = 
crc.bytes[0];
 
  273         command_string[18] = 
crc.bytes[1];
 
  283                 if ((
crc.bytes[0] == read_data[4]) && (
crc.bytes[1] == read_data[5]))
 
uint32_t PIOS_Thread_Systime(void)
#define STORM32BGC_PERIOD_MS
int32_t Storm32BgcInitialize(void)
struct pios_queue * PIOS_Queue_Create(size_t queue_length, size_t item_size)
struct _msp_pid_item pitch
bool PIOS_Modules_IsEnabled(enum pios_modules module)
struct _msp_pid_item roll
static uint16_t crc_calculate(uint8_t *pBuffer, int length)
Calculates the X.25 checksum on a byte buffer. 
int32_t AlarmsSet(SystemAlarmsAlarmElem alarm, SystemAlarmsAlarmOptions severity)
static struct pios_thread * storm32bgcTaskHandle
uint8_t data[XFER_BYTES_PER_PACKET]
struct pios_recursive_mutex * PIOS_Recursive_Mutex_Create(void)
static uintptr_t storm32bgc_com_id
#define PIOS_COM_STORM32BGC
static uint8_t cmd_set_angle(float pitch, float roll, float yaw, uint8_t flags, uint8_t type)
uint16_t PIOS_COM_ReceiveBuffer(uintptr_t com_id, uint8_t *buf, uint16_t buf_len, uint32_t timeout_ms)
static void crc_accumulate(uint8_t data, uint16_t *crcAccum)
Accumulate the X.25 CRC by adding one char at a time. 
struct pios_thread * PIOS_Thread_Create(void(*fp)(void *), const char *namep, size_t stack_bytes, void *argp, enum pios_thread_prio_e prio)
static void storm32bgcTask(void *parameters)
int32_t TaskMonitorAdd(TaskInfoRunningElem task, struct pios_thread *threadp)
void PIOS_Thread_Sleep_Until(uint32_t *previous_ms, uint32_t increment_ms)
PIOS_COM_SendBuffer(shub_global->frsky_port, shub_global->serial_buf, msg_length)
#define STORM32BGC_QUEUE_SIZE
static struct pios_recursive_mutex * mutex
Includes PiOS and core architecture components. 
static bool module_enabled
int32_t Storm32BgcStart(void)
MODULE_INITCALL(Storm32BgcInitialize, Storm32BgcStart)
struct pios_queue * storm32bgc_queue