2004-12-24 01:23:27 +00:00
|
|
|
// ATC-Outputs.hxx -- Translate FGFS properties into ATC hardware outputs
|
|
|
|
//
|
|
|
|
// Written by Curtis Olson, started November 2004.
|
|
|
|
//
|
|
|
|
// Copyright (C) 2004 Curtis L. Olson - http://www.flightgear.org/~curt
|
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License as
|
|
|
|
// published by the Free Software Foundation; either version 2 of the
|
|
|
|
// License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful, but
|
|
|
|
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program; if not, write to the Free Software
|
2006-02-21 01:16:04 +00:00
|
|
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2004-12-24 01:23:27 +00:00
|
|
|
//
|
|
|
|
// $Id$
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef _FG_ATC_OUTPUTS_HXX
|
|
|
|
#define _FG_ATC_OUTPUTS_HXX
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include <config.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <Main/fg_props.hxx>
|
|
|
|
|
|
|
|
#define ATC_RADIO_DISPLAY_BYTES 48
|
2009-02-04 21:11:14 +00:00
|
|
|
#define ATC_ANALOG_OUT_CHANNELS 48
|
2004-12-24 01:23:27 +00:00
|
|
|
#define ATC_COMPASS_CH 5
|
|
|
|
#define ATC_STEPPER_HOME 0xC0
|
|
|
|
|
|
|
|
|
|
|
|
class FGATCOutput {
|
|
|
|
|
|
|
|
int is_open;
|
|
|
|
|
|
|
|
int board;
|
|
|
|
SGPath config;
|
|
|
|
|
2009-02-04 21:11:14 +00:00
|
|
|
int analog_out_fd;
|
2004-12-24 01:23:27 +00:00
|
|
|
int lamps_fd;
|
|
|
|
int radio_display_fd;
|
|
|
|
int stepper_fd;
|
|
|
|
|
2009-02-04 21:11:14 +00:00
|
|
|
char analog_out_file[256];
|
2004-12-24 01:23:27 +00:00
|
|
|
char lamps_file[256];
|
|
|
|
char radio_display_file[256];
|
|
|
|
char stepper_file[256];
|
|
|
|
|
2009-02-04 21:11:14 +00:00
|
|
|
unsigned char analog_out_data[ATC_ANALOG_OUT_CHANNELS*2];
|
2004-12-24 01:23:27 +00:00
|
|
|
unsigned char radio_display_data[ATC_RADIO_DISPLAY_BYTES];
|
|
|
|
|
2009-02-04 21:11:14 +00:00
|
|
|
SGPropertyNode_ptr analog_out_node;
|
2006-06-11 10:21:10 +00:00
|
|
|
SGPropertyNode_ptr lamps_out_node;
|
|
|
|
SGPropertyNode_ptr radio_display_node;
|
|
|
|
SGPropertyNode_ptr steppers_node;
|
2004-12-24 01:23:27 +00:00
|
|
|
|
|
|
|
void init_config();
|
2009-02-04 21:11:14 +00:00
|
|
|
bool do_analog_out();
|
2004-12-24 01:23:27 +00:00
|
|
|
bool do_lamps();
|
|
|
|
bool do_radio_display();
|
|
|
|
bool do_steppers();
|
|
|
|
|
|
|
|
// hardwired stepper motor code
|
|
|
|
float compass_position;
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
// Constructor: The _board parameter specifies which board to
|
|
|
|
// reference. Possible values are 0 or 1. The _config_file
|
|
|
|
// parameter specifies the location of the output config file (xml)
|
|
|
|
FGATCOutput( const int _board, const SGPath &_config_file );
|
|
|
|
|
|
|
|
// Destructor
|
|
|
|
~FGATCOutput() { }
|
|
|
|
|
|
|
|
// need to pass in atc hardware lock_fd so that the radios and
|
|
|
|
// lamps can be blanked and so that the compass can be homed.
|
|
|
|
bool open( int lock_fd );
|
|
|
|
|
|
|
|
// process the hardware outputs. This code assumes the calling
|
|
|
|
// layer will lock the hardware.
|
|
|
|
bool process();
|
|
|
|
|
|
|
|
bool close();
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // _FG_ATC_OUTPUTS_HXX
|