element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Personal Blogs
  • Community Hub
  • More
Personal Blogs
NexGen Flight Simuator NexGen: Radio SubSystem: RSS_IOP Part 1 Redux
  • Blog
  • Documents
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: phoenixcomm
  • Date Created: 13 Apr 2014 9:52 PM Date Created
  • Views 237 views
  • Likes 0 likes
  • Comments 0 comments
  • nexgen
  • c
  • nexgen_flight_simulator
  • diy_cockpit
  • linux
Related
Recommended

NexGen: Radio SubSystem: RSS_IOP Part 1 Redux

phoenixcomm
phoenixcomm
13 Apr 2014

Ok, it seems that we are back where we started from talking about the RSS_IOP. There have been so many changes that we may as well just start over.image

So now I can share with you the major data structures  from here forward. So lets get started.

rss and tunerradio_xxxxx

typedef enum _Radio_Types {

  G3717,

  C614L8,

  G1981,

  G3490,

  G4214 }Radio_Types;

 

 

 

struct rss_s {

  char * device_info;             // some thing about the radio NAV/COM/etc.

  char * device_model;         // the Manufactures part/model number.

  char * device_serial;          // the device's serial number..

  Radio_Types device_type; // Its device_type which is defined by the typedef above Radio_Types

  int power_48v;                   // power to the unit..

  int power_400hz;

  int panel_lamps;                // turn off or on the Panel Lamps only

  void * radio_info;

  void * tuner;

  int sub_devices;                // how many tuners are in this device.

};

 

 

 

enum fd_index {

  RD,

  WR,

  FD_pair

};

 

 

typedef enum _tuned_units { // this is for numbers that have the form of nnn.ff (n= number) (f= fractions)

  hundreds,

  tens,

  units,

  tenths,

  hundredths,

  tuned

}tuned_units;

 

 

typedef struct tuner_s { // when we talk about 'sub-radios' we are really saying how many tuners are there??

  int power;

  int dial_lamp;

  char * device_name; // OS-name

  int fd[ FD_pair ]; // file descriptors

  int frequency[ tuned_units ];

}tuner;

// This is for the Collins G14L8 Adf head.

typedef enum _mode_sw_614L8 {

  OFF = 0,

  ADF,

  ANT,

  LOOP

}mode_sw614L8;

 

 

typedef enum _loop_sw_614L8 {

  LEFT,

  RIGHT,

  SLEW_LEFT,

  SLEW_RIGHT,

}loop_sw614L8;

 

 

struct radio_s_614L8 {

loop_sw614L8 loop_sw_614L8;

mode_sw614L8 mode_sw_614L8;

  int sw_band;

  int sw_bfo;

  int meter;

};

 

 

////   G1981 ATC  Transponder

//     As the ATC Transponder does not have a tuner

//     we can ignore the field 'int frequency[ tuned ];'

 

 

typedef enum _mode_sw_G1981 {

  STBY,

  ON,

  LOW,

  mode_swG1981

  }mode_sw_G1981;

 

 

typedef enum _band_sw_G1981 {

  band_A,

  band_B,

  band_C,

  band_D,

  band_swG1981

  }band_sw_G1981;

 

 

struct radio_s_G1981 {

  mode_sw_G1981 mode_switch;

band_sw_G1981 band_switch;

  int sw_ATC;

  int sw_ident;

  int test_monitor;

  int alt_off;

  int squawk[ 4 ];

};

 

//// G-3717  this is a simple radio with 2 tuners.

 

 

struct radio_s_G3717 {

  int sw_VHF_NAV;

  int sw_VOR_TEST;

  int sw_DME_TEST;

  int sw_DME_STBY;

  int sw_UP;

  int sw_DOWN;

};

 

main.c

 

 

#include <stdio.h>

 

 

#include "rss.h"

#include "main.h"

#include "rss_init.h"

 

 

int main(int argc, char *argv[]){

 

 

  max_fd = 0;

  int ecode;

  // bus voltages

  int p400;

  int p48;

 

 

  // The Radio Tuners

  // ** Please note the "dev/stuff is not right and must be changed before testing.

 

 

static struct tuner tuner_G_3717[] = {

  { 0, 0, "/dev/tty0/usb1", },

  { 0, 0, "/dev/tty0/usb1", } };

static struct tuner tuner_C_614L8[] = {

  { 0, 0, "/dev/tty0/usb1", }};

  static struct tuner tuner_G_1981[] = {

  { 0, 0, "/dev/tty0/usb1", }};

static struct tuner tuner_G_4214[] = {

  { 0, 0, "/dev/tty0/usb1", }};

static struct tuner tuner_G_3490[] = {

  { 0, 0, "/dev/tty0/usb1", },

  { 0, 0, "/dev/tty0/usb1", },

  { 0, 0, "/dev/tty0/usb1", },

  { 0, 0, "/dev/tty0/usb1", }};

 

 

  // The Radio Details

static struct radio_s_G3713 radio_G_3713  = {

  { 0, 0, 0, 0, 0, 0 }};

  static struct radio_s_614L8 radio_C_614L8 = {

  { 0, 0, 0, 0, 0 }};

  static struct radio_s_G1981 radio_G_1981  = {

  { 0, 0, 0, 0, 0, 0, {0}}};

static struct radio_s_G3490 radio_G_3490  = {

  { 0, 0, 0, 0, 0, 0, 0 }};

  static struct radio_s_G4214 radio_G_4214  = {

  { 0 }};

 

 

  // The Radio(s) Master List

 

 

  static struct rss_s radios[] = {

  { "COM 1 & 2", "G-4214", "68", G4214,  0, 0, 0, & radio_G_4214,  tuner_G_4214,  DIM( tuner_G_4214 )  },

  { "VOR, DME", "G-3717", "81", G3717,  0, 0, 0, & radio_G_3713,  tuner_G_3713,  DIM( tuner_G_3713 )  },

  { "ADF", "614L8", "8384", C614L8, 0, 0, 0, & radio_C_614L8,  tuner_C_614L8, DIM( tuner_C_614L8 ) },

  { "ATC", "G-1981", "336", G1981,  0, 0, 0, & radio_G_1981,  tuner_G_1981,  DIM( tuner_G_1981 )  },

  { "5in1", "G-3490", "31", G3490,  0, 0, 0, & radio_G_3490,  tuner_G_3490,  DIM( tuner_G_3490 )  }, // Optional Radio

  };

 

 

 

 

 

 

  int i, j;

  // loop over the installed Radios and sub radios

  for( i = 0; i < DIM( radios ); i++ ){

  if( rss_init( & radios[ i ] ) == ERROR ){

  perror( "Initialization failed");

  return( ERROR ); }

  }

 

 

  do{

  ecode = 1;

  // test for power errors

    p400 = power_buss_400hz();

    p48 = power__buss_48v();

    if( p48 != OFF || p400 != OFF ){

  ecode = GO;}

  else {

  ecode = ERROR;

  if( !p400 )

  error_msg();

  if( !p48 )

  error_msg();

  }

 

 

  // iop returns with error TBD!!

 

 

 

 

  }  while( ecode != ERROR );

}

So far so good. I have shown you what our data structures are now.  I will show you my main.c. You will notice that all of the radio components ie: radio[], tuners, and radios are all declared static, as their "lifetime or extent" extends across the entire run of the program.


image Keep tuned in, more to come!

~~ Cris.



Apr 14, 2014

Changes just a few:

1)  struct radio_614L8 is now struct radio_s_614L8

     the radio_s_XXXX is the form that I will be using the _s_ stands for structure

     this changes the invocation of the radio in my main.c

     from

     static struct radio_G3713 radio_G_3713

     to

     static struct radio_s_G3713 radio_G_3713

2) power testing has been simplified:

      if ((( p400 = power_buss_400hz()) || ( p48 = power__buss_48v())) != OFF ){

   to

    p400 = power_buss_400hz();

    p48 = power__buss_48v();

    if( p48 != OFF || p400 != OFF ){

  • Sign in to reply
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube