kopia lustrzana https://github.com/jamescoxon/dl-fldigi
gpio ptt
* Added gpio support for PTT. - used primarily by Pi experimenters - submitted by Lior, KK6KWApull/4/head
rodzic
d6a34a40f1
commit
93342e4dd7
|
@ -3799,6 +3799,31 @@ btnInitHWPTT->redraw();
|
||||||
progdefaults.changed = true;
|
progdefaults.changed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Fl_Round_Button *btnUseGPIOPTT=(Fl_Round_Button *)0;
|
||||||
|
|
||||||
|
static void cb_btnUseGPIOPTT(Fl_Round_Button* o, void*) {
|
||||||
|
btnTTYptt->value(false);
|
||||||
|
btnUsePPortPTT->value(false);
|
||||||
|
btnUseUHrouterPTT->value(false);
|
||||||
|
|
||||||
|
progdefaults.TTYptt = false;
|
||||||
|
progdefaults.UsePPortPTT = false;
|
||||||
|
progdefaults.UseUHrouterPTT = false;
|
||||||
|
progdefaults.UseGPIOPTT = o->value();
|
||||||
|
|
||||||
|
btnInitHWPTT->labelcolor(FL_RED);
|
||||||
|
btnInitHWPTT->redraw();
|
||||||
|
progdefaults.changed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
Fl_Counter2 *inpGPIOPort=(Fl_Counter2 *)0;
|
||||||
|
|
||||||
|
static void cb_inpGPIOPort(Fl_Counter2*, void*) {
|
||||||
|
btnInitHWPTT->labelcolor(FL_RED);
|
||||||
|
btnInitHWPTT->redraw();
|
||||||
|
progdefaults.changed = true;
|
||||||
|
}
|
||||||
|
|
||||||
Fl_Group *grpPTTdelays=(Fl_Group *)0;
|
Fl_Group *grpPTTdelays=(Fl_Group *)0;
|
||||||
|
|
||||||
Fl_Counter *cntPTT_on_delay=(Fl_Counter *)0;
|
Fl_Counter *cntPTT_on_delay=(Fl_Counter *)0;
|
||||||
|
@ -9355,7 +9380,7 @@ le Earth)"));
|
||||||
} // Fl_Check_Button* btnPTTrightchannel
|
} // Fl_Check_Button* btnPTTrightchannel
|
||||||
o->end();
|
o->end();
|
||||||
} // Fl_Group* o
|
} // Fl_Group* o
|
||||||
{ grpHWPTT = new Fl_Group(55, 97, 490, 171, _("h/w ptt device-pin"));
|
{ grpHWPTT = new Fl_Group(55, 97, 490, 184, _("h/w ptt device-pin"));
|
||||||
grpHWPTT->box(FL_ENGRAVED_FRAME);
|
grpHWPTT->box(FL_ENGRAVED_FRAME);
|
||||||
grpHWPTT->align(Fl_Align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE));
|
grpHWPTT->align(Fl_Align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE));
|
||||||
{ btnTTYptt = new Fl_Round_Button(74, 121, 220, 20, _("Use separate serial port PTT"));
|
{ btnTTYptt = new Fl_Round_Button(74, 121, 220, 20, _("Use separate serial port PTT"));
|
||||||
|
@ -9401,22 +9426,45 @@ le Earth)"));
|
||||||
btnInitHWPTT->tooltip(_("Initialize the H/W PTT interface"));
|
btnInitHWPTT->tooltip(_("Initialize the H/W PTT interface"));
|
||||||
btnInitHWPTT->callback((Fl_Callback*)cb_btnInitHWPTT);
|
btnInitHWPTT->callback((Fl_Callback*)cb_btnInitHWPTT);
|
||||||
} // Fl_Button* btnInitHWPTT
|
} // Fl_Button* btnInitHWPTT
|
||||||
{ btnUsePPortPTT = new Fl_Round_Button(74, 197, 170, 20, _("Use parallel port PTT"));
|
{ btnUsePPortPTT = new Fl_Round_Button(74, 191, 170, 20, _("Use parallel port PTT"));
|
||||||
btnUsePPortPTT->down_box(FL_DOWN_BOX);
|
btnUsePPortPTT->down_box(FL_DOWN_BOX);
|
||||||
btnUsePPortPTT->selection_color((Fl_Color)1);
|
btnUsePPortPTT->selection_color((Fl_Color)1);
|
||||||
btnUsePPortPTT->callback((Fl_Callback*)cb_btnUsePPortPTT);
|
btnUsePPortPTT->callback((Fl_Callback*)cb_btnUsePPortPTT);
|
||||||
} // Fl_Round_Button* btnUsePPortPTT
|
} // Fl_Round_Button* btnUsePPortPTT
|
||||||
{ btnUseUHrouterPTT = new Fl_Round_Button(74, 227, 170, 20, _("Use uHRouter PTT"));
|
{ btnUseUHrouterPTT = new Fl_Round_Button(74, 221, 170, 20, _("Use uHRouter PTT"));
|
||||||
btnUseUHrouterPTT->down_box(FL_DOWN_BOX);
|
btnUseUHrouterPTT->down_box(FL_DOWN_BOX);
|
||||||
btnUseUHrouterPTT->selection_color((Fl_Color)1);
|
btnUseUHrouterPTT->selection_color((Fl_Color)1);
|
||||||
btnUseUHrouterPTT->callback((Fl_Callback*)cb_btnUseUHrouterPTT);
|
btnUseUHrouterPTT->callback((Fl_Callback*)cb_btnUseUHrouterPTT);
|
||||||
} // Fl_Round_Button* btnUseUHrouterPTT
|
} // Fl_Round_Button* btnUseUHrouterPTT
|
||||||
|
{ btnUseGPIOPTT = new Fl_Round_Button(74, 252, 170, 20, _("Use GPIO PTT"));
|
||||||
|
btnUseGPIOPTT->down_box(FL_DOWN_BOX);
|
||||||
|
btnUseGPIOPTT->selection_color((Fl_Color)1);
|
||||||
|
btnUseGPIOPTT->callback((Fl_Callback*)cb_btnUseGPIOPTT);
|
||||||
|
} // Fl_Round_Button* btnUseGPIOPTT
|
||||||
|
{ inpGPIOPort = new Fl_Counter2(286, 252, 65, 20, _("GPIO:"));
|
||||||
|
inpGPIOPort->tooltip(_("Select GPIO port"));
|
||||||
|
inpGPIOPort->type(1);
|
||||||
|
inpGPIOPort->box(FL_UP_BOX);
|
||||||
|
inpGPIOPort->color(FL_BACKGROUND_COLOR);
|
||||||
|
inpGPIOPort->selection_color(FL_INACTIVE_COLOR);
|
||||||
|
inpGPIOPort->labeltype(FL_NORMAL_LABEL);
|
||||||
|
inpGPIOPort->labelfont(0);
|
||||||
|
inpGPIOPort->labelsize(14);
|
||||||
|
inpGPIOPort->labelcolor(FL_FOREGROUND_COLOR);
|
||||||
|
inpGPIOPort->minimum(0);
|
||||||
|
inpGPIOPort->maximum(31);
|
||||||
|
inpGPIOPort->step(1);
|
||||||
|
inpGPIOPort->value(17);
|
||||||
|
inpGPIOPort->callback((Fl_Callback*)cb_inpGPIOPort);
|
||||||
|
inpGPIOPort->align(Fl_Align(FL_ALIGN_LEFT));
|
||||||
|
inpGPIOPort->when(FL_WHEN_CHANGED);
|
||||||
|
} // Fl_Counter2* inpGPIOPort
|
||||||
grpHWPTT->end();
|
grpHWPTT->end();
|
||||||
} // Fl_Group* grpHWPTT
|
} // Fl_Group* grpHWPTT
|
||||||
{ grpPTTdelays = new Fl_Group(55, 270, 490, 91, _("PTT delays valid for all CAT/PTT types"));
|
{ grpPTTdelays = new Fl_Group(55, 284, 490, 91, _("PTT delays valid for all CAT/PTT types"));
|
||||||
grpPTTdelays->box(FL_ENGRAVED_FRAME);
|
grpPTTdelays->box(FL_ENGRAVED_FRAME);
|
||||||
grpPTTdelays->align(Fl_Align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE));
|
grpPTTdelays->align(Fl_Align(FL_ALIGN_TOP_LEFT|FL_ALIGN_INSIDE));
|
||||||
{ Fl_Counter* o = cntPTT_on_delay = new Fl_Counter(74, 297, 100, 21, _("Start of transmit PTT delay"));
|
{ Fl_Counter* o = cntPTT_on_delay = new Fl_Counter(74, 311, 100, 21, _("Start of transmit PTT delay"));
|
||||||
cntPTT_on_delay->tooltip(_("Delay NN msec before starting audio"));
|
cntPTT_on_delay->tooltip(_("Delay NN msec before starting audio"));
|
||||||
cntPTT_on_delay->minimum(0);
|
cntPTT_on_delay->minimum(0);
|
||||||
cntPTT_on_delay->maximum(500);
|
cntPTT_on_delay->maximum(500);
|
||||||
|
@ -9426,7 +9474,7 @@ le Earth)"));
|
||||||
o->value(progdefaults.PTT_on_delay);
|
o->value(progdefaults.PTT_on_delay);
|
||||||
o->lstep(10);
|
o->lstep(10);
|
||||||
} // Fl_Counter* cntPTT_on_delay
|
} // Fl_Counter* cntPTT_on_delay
|
||||||
{ Fl_Counter* o = cntPTT_off_delay = new Fl_Counter(74, 327, 100, 21, _("PTT end of transmit delay"));
|
{ Fl_Counter* o = cntPTT_off_delay = new Fl_Counter(74, 341, 100, 21, _("PTT end of transmit delay"));
|
||||||
cntPTT_off_delay->tooltip(_("Delay NN msec before releasing PTT"));
|
cntPTT_off_delay->tooltip(_("Delay NN msec before releasing PTT"));
|
||||||
cntPTT_off_delay->minimum(0);
|
cntPTT_off_delay->minimum(0);
|
||||||
cntPTT_off_delay->maximum(500);
|
cntPTT_off_delay->maximum(500);
|
||||||
|
|
|
@ -359,7 +359,7 @@ static const char szBaudRates[] = "300|600|1200|2400|4800|9600|19200|38400|57600
|
||||||
static const char szProsigns[] = "~|%|&|+|=|{|}|<|>|[|]| ";} {}
|
static const char szProsigns[] = "~|%|&|+|=|{|}|<|>|[|]| ";} {}
|
||||||
Fl_Window {} {
|
Fl_Window {} {
|
||||||
label {Fldigi configuration} open
|
label {Fldigi configuration} open
|
||||||
xywh {434 227 600 415} type Double color 45 selection_color 51 labelsize 18 align 80 non_modal visible
|
xywh {610 168 600 415} type Double color 45 selection_color 51 labelsize 18 align 80 non_modal visible
|
||||||
} {
|
} {
|
||||||
Fl_Tabs tabsConfigure {open
|
Fl_Tabs tabsConfigure {open
|
||||||
xywh {0 0 600 380} color 50 selection_color 50
|
xywh {0 0 600 380} color 50 selection_color 50
|
||||||
|
@ -4634,7 +4634,7 @@ progdefaults.changed = true;}
|
||||||
}
|
}
|
||||||
Fl_Group grpHWPTT {
|
Fl_Group grpHWPTT {
|
||||||
label {h/w ptt device-pin} open
|
label {h/w ptt device-pin} open
|
||||||
xywh {55 97 490 171} box ENGRAVED_FRAME align 21
|
xywh {55 97 490 184} box ENGRAVED_FRAME align 21
|
||||||
} {
|
} {
|
||||||
Fl_Round_Button btnTTYptt {
|
Fl_Round_Button btnTTYptt {
|
||||||
label {Use separate serial port PTT}
|
label {Use separate serial port PTT}
|
||||||
|
@ -4704,7 +4704,7 @@ progdefaults.UseUHrouterPTT = false;
|
||||||
btnInitHWPTT->labelcolor(FL_RED);
|
btnInitHWPTT->labelcolor(FL_RED);
|
||||||
btnInitHWPTT->redraw();
|
btnInitHWPTT->redraw();
|
||||||
progdefaults.changed = true;}
|
progdefaults.changed = true;}
|
||||||
xywh {74 197 170 20} down_box DOWN_BOX selection_color 1
|
xywh {74 191 170 20} down_box DOWN_BOX selection_color 1
|
||||||
}
|
}
|
||||||
Fl_Round_Button btnUseUHrouterPTT {
|
Fl_Round_Button btnUseUHrouterPTT {
|
||||||
label {Use uHRouter PTT}
|
label {Use uHRouter PTT}
|
||||||
|
@ -4717,18 +4717,42 @@ progdefaults.UseUHrouterPTT = o->value();
|
||||||
btnInitHWPTT->labelcolor(FL_RED);
|
btnInitHWPTT->labelcolor(FL_RED);
|
||||||
btnInitHWPTT->redraw();
|
btnInitHWPTT->redraw();
|
||||||
progdefaults.changed = true;}
|
progdefaults.changed = true;}
|
||||||
xywh {74 227 170 20} down_box DOWN_BOX selection_color 1
|
xywh {74 221 170 20} down_box DOWN_BOX selection_color 1
|
||||||
|
}
|
||||||
|
Fl_Round_Button btnUseGPIOPTT {
|
||||||
|
label {Use GPIO PTT}
|
||||||
|
callback {btnTTYptt->value(false);
|
||||||
|
btnUsePPortPTT->value(false);
|
||||||
|
btnUseUHrouterPTT->value(false);
|
||||||
|
|
||||||
|
progdefaults.TTYptt = false;
|
||||||
|
progdefaults.UsePPortPTT = false;
|
||||||
|
progdefaults.UseUHrouterPTT = false;
|
||||||
|
progdefaults.UseGPIOPTT = o->value();
|
||||||
|
|
||||||
|
btnInitHWPTT->labelcolor(FL_RED);
|
||||||
|
btnInitHWPTT->redraw();
|
||||||
|
progdefaults.changed = true;}
|
||||||
|
xywh {74 252 170 20} down_box DOWN_BOX selection_color 1
|
||||||
|
}
|
||||||
|
Fl_Counter inpGPIOPort {
|
||||||
|
label {GPIO:}
|
||||||
|
callback {btnInitHWPTT->labelcolor(FL_RED);
|
||||||
|
btnInitHWPTT->redraw();
|
||||||
|
progdefaults.changed = true;}
|
||||||
|
tooltip {Select GPIO port} xywh {286 252 65 20} type Simple align 4 minimum 0 maximum 31 step 1 value 17
|
||||||
|
class Fl_Counter2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Fl_Group grpPTTdelays {
|
Fl_Group grpPTTdelays {
|
||||||
label {PTT delays valid for all CAT/PTT types}
|
label {PTT delays valid for all CAT/PTT types}
|
||||||
xywh {55 270 490 91} box ENGRAVED_FRAME align 21
|
xywh {55 284 490 91} box ENGRAVED_FRAME align 21
|
||||||
} {
|
} {
|
||||||
Fl_Counter cntPTT_on_delay {
|
Fl_Counter cntPTT_on_delay {
|
||||||
label {Start of transmit PTT delay}
|
label {Start of transmit PTT delay}
|
||||||
callback {progdefaults.PTT_on_delay = o->value();
|
callback {progdefaults.PTT_on_delay = o->value();
|
||||||
progdefaults.changed = true;}
|
progdefaults.changed = true;}
|
||||||
tooltip {Delay NN msec before starting audio} xywh {74 297 100 21} align 8 minimum 0 maximum 500 step 1
|
tooltip {Delay NN msec before starting audio} xywh {74 311 100 21} align 8 minimum 0 maximum 500 step 1
|
||||||
code0 {o->value(progdefaults.PTT_on_delay);}
|
code0 {o->value(progdefaults.PTT_on_delay);}
|
||||||
code1 {o->lstep(10);}
|
code1 {o->lstep(10);}
|
||||||
}
|
}
|
||||||
|
@ -4736,7 +4760,7 @@ progdefaults.changed = true;}
|
||||||
label {PTT end of transmit delay}
|
label {PTT end of transmit delay}
|
||||||
callback {progdefaults.PTT_off_delay = o->value();
|
callback {progdefaults.PTT_off_delay = o->value();
|
||||||
progdefaults.changed = true;}
|
progdefaults.changed = true;}
|
||||||
tooltip {Delay NN msec before releasing PTT} xywh {74 327 100 21} align 8 minimum 0 maximum 500 step 1
|
tooltip {Delay NN msec before releasing PTT} xywh {74 341 100 21} align 8 minimum 0 maximum 500 step 1
|
||||||
code0 {o->value(progdefaults.PTT_off_delay);}
|
code0 {o->value(progdefaults.PTT_off_delay);}
|
||||||
code1 {o->lstep(10);}
|
code1 {o->lstep(10);}
|
||||||
}
|
}
|
||||||
|
|
|
@ -438,6 +438,8 @@ extern Fl_Round_Button *btnDTRplusV;
|
||||||
extern Fl_Button *btnInitHWPTT;
|
extern Fl_Button *btnInitHWPTT;
|
||||||
extern Fl_Round_Button *btnUsePPortPTT;
|
extern Fl_Round_Button *btnUsePPortPTT;
|
||||||
extern Fl_Round_Button *btnUseUHrouterPTT;
|
extern Fl_Round_Button *btnUseUHrouterPTT;
|
||||||
|
extern Fl_Round_Button *btnUseGPIOPTT;
|
||||||
|
extern Fl_Counter2 *inpGPIOPort;
|
||||||
extern Fl_Group *grpPTTdelays;
|
extern Fl_Group *grpPTTdelays;
|
||||||
extern Fl_Counter *cntPTT_on_delay;
|
extern Fl_Counter *cntPTT_on_delay;
|
||||||
extern Fl_Counter *cntPTT_off_delay;
|
extern Fl_Counter *cntPTT_off_delay;
|
||||||
|
|
|
@ -59,6 +59,7 @@
|
||||||
# define DEFAULT_HAMRIGDEVICE "/dev/rig"
|
# define DEFAULT_HAMRIGDEVICE "/dev/rig"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define DEFAULT_GPIO_PORT 17
|
||||||
|
|
||||||
// Format: ELEM_(TYPE, VARIABLE-NAME, TAG-STRING, DOC-STRING, DEFAULT-VALUE)
|
// Format: ELEM_(TYPE, VARIABLE-NAME, TAG-STRING, DOC-STRING, DEFAULT-VALUE)
|
||||||
// Variables that are not saved to the xml file have empty TAG-STRINGs and DOC-STRINGs
|
// Variables that are not saved to the xml file have empty TAG-STRINGs and DOC-STRINGs
|
||||||
|
@ -961,6 +962,9 @@
|
||||||
ELEM_(std::string, PTTdev, "PTTDEV", \
|
ELEM_(std::string, PTTdev, "PTTDEV", \
|
||||||
"PTT device", \
|
"PTT device", \
|
||||||
DEFAULT_PTTDEV) \
|
DEFAULT_PTTDEV) \
|
||||||
|
ELEM_(int, GPIOPort, "GPIOPORT", \
|
||||||
|
"PTT GPIO Port", \
|
||||||
|
DEFAULT_GPIO_PORT) \
|
||||||
ELEM_(std::string, CWFSKport, "", "", DEFAULT_CWFSKPORT) \
|
ELEM_(std::string, CWFSKport, "", "", DEFAULT_CWFSKPORT) \
|
||||||
ELEM_(std::string, HamRigDevice, "HAMRIGDEVICE", \
|
ELEM_(std::string, HamRigDevice, "HAMRIGDEVICE", \
|
||||||
"Hamlib rig device", \
|
"Hamlib rig device", \
|
||||||
|
@ -1009,6 +1013,9 @@
|
||||||
ELEM_(bool, UsePPortPTT, "USEPPORTPTT", \
|
ELEM_(bool, UsePPortPTT, "USEPPORTPTT", \
|
||||||
"Use parallel port PTT", \
|
"Use parallel port PTT", \
|
||||||
false) \
|
false) \
|
||||||
|
ELEM_(bool, UseGPIOPTT, "USEGPIOPTT", \
|
||||||
|
"Use parallel port PTT", \
|
||||||
|
false) \
|
||||||
/* RigCAT parameters */ \
|
/* RigCAT parameters */ \
|
||||||
ELEM_(bool, RigCatRTSplus, "RIGCATRTSPLUS", \
|
ELEM_(bool, RigCatRTSplus, "RIGCATRTSPLUS", \
|
||||||
"Initial state of RTS", \
|
"Initial state of RTS", \
|
||||||
|
|
|
@ -66,7 +66,7 @@ public:
|
||||||
// code is not compiled. New tags go to the end of the list.
|
// code is not compiled. New tags go to the end of the list.
|
||||||
enum ptt_t {
|
enum ptt_t {
|
||||||
PTT_INVALID = -1, PTT_NONE, PTT_HAMLIB,
|
PTT_INVALID = -1, PTT_NONE, PTT_HAMLIB,
|
||||||
PTT_RIGCAT, PTT_TTY, PTT_PARPORT, PTT_UHROUTER
|
PTT_RIGCAT, PTT_TTY, PTT_PARPORT, PTT_UHROUTER, PTT_GPIO
|
||||||
};
|
};
|
||||||
|
|
||||||
PTT(ptt_t dev = PTT_NONE);
|
PTT(ptt_t dev = PTT_NONE);
|
||||||
|
@ -96,6 +96,10 @@ private:
|
||||||
void set_tty(bool ptt);
|
void set_tty(bool ptt);
|
||||||
void close_tty(void);
|
void close_tty(void);
|
||||||
|
|
||||||
|
void open_gpio(void);
|
||||||
|
void set_gpio(bool ptt);
|
||||||
|
void close_gpio(void);
|
||||||
|
|
||||||
#if HAVE_PARPORT
|
#if HAVE_PARPORT
|
||||||
void open_parport(void);
|
void open_parport(void);
|
||||||
void set_parport(bool ptt);
|
void set_parport(bool ptt);
|
||||||
|
|
|
@ -526,6 +526,8 @@ int configuration::setDefaults()
|
||||||
|
|
||||||
inpTTYdev->value(PTTdev.c_str());
|
inpTTYdev->value(PTTdev.c_str());
|
||||||
|
|
||||||
|
inpGPIOPort->value(GPIOPort);
|
||||||
|
|
||||||
chkUSEHAMLIB->value(0);
|
chkUSEHAMLIB->value(0);
|
||||||
chkUSERIGCAT->value(0);
|
chkUSERIGCAT->value(0);
|
||||||
chkUSEXMLRPC->value(0);
|
chkUSEXMLRPC->value(0);
|
||||||
|
@ -729,6 +731,8 @@ void configuration::initInterface()
|
||||||
|
|
||||||
PTTdev = inpTTYdev->value();
|
PTTdev = inpTTYdev->value();
|
||||||
|
|
||||||
|
GPIOPort = static_cast<int>(inpGPIOPort->value());
|
||||||
|
|
||||||
#if USE_HAMLIB
|
#if USE_HAMLIB
|
||||||
chkUSEHAMLIBis = chkUSEHAMLIB->value();
|
chkUSEHAMLIBis = chkUSEHAMLIB->value();
|
||||||
HamlibCMDptt = btnHamlibCMDptt->value();
|
HamlibCMDptt = btnHamlibCMDptt->value();
|
||||||
|
@ -789,6 +793,8 @@ void configuration::initInterface()
|
||||||
push2talk->reset(PTT::PTT_TTY);
|
push2talk->reset(PTT::PTT_TTY);
|
||||||
else if (UsePPortPTT)
|
else if (UsePPortPTT)
|
||||||
push2talk->reset(PTT::PTT_PARPORT);
|
push2talk->reset(PTT::PTT_PARPORT);
|
||||||
|
else if (UseGPIOPTT)
|
||||||
|
push2talk->reset(PTT::PTT_GPIO);
|
||||||
else if (UseUHrouterPTT)
|
else if (UseUHrouterPTT)
|
||||||
push2talk->reset(PTT::PTT_UHROUTER);
|
push2talk->reset(PTT::PTT_UHROUTER);
|
||||||
else
|
else
|
||||||
|
|
|
@ -9,6 +9,8 @@
|
||||||
// Copyright (C) 2009
|
// Copyright (C) 2009
|
||||||
// Diane Bruce, VA3DB
|
// Diane Bruce, VA3DB
|
||||||
//
|
//
|
||||||
|
// Added gpio for PTT (Lior KK6BWA)
|
||||||
|
//
|
||||||
// This file is part of fldigi. Adapted from code contained in gmfsk source code
|
// This file is part of fldigi. Adapted from code contained in gmfsk source code
|
||||||
// distribution.
|
// distribution.
|
||||||
// gmfsk Copyright (C) 2001, 2002, 2003
|
// gmfsk Copyright (C) 2001, 2002, 2003
|
||||||
|
@ -104,6 +106,9 @@ void PTT::reset(ptt_t dev)
|
||||||
case PTT_TTY:
|
case PTT_TTY:
|
||||||
open_tty();
|
open_tty();
|
||||||
break;
|
break;
|
||||||
|
case PTT_GPIO:
|
||||||
|
open_gpio();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break; // nothing to open
|
break; // nothing to open
|
||||||
}
|
}
|
||||||
|
@ -136,6 +141,9 @@ void PTT::set(bool ptt)
|
||||||
case PTT_TTY:
|
case PTT_TTY:
|
||||||
set_tty(ptt);
|
set_tty(ptt);
|
||||||
break;
|
break;
|
||||||
|
case PTT_GPIO:
|
||||||
|
set_gpio(ptt);
|
||||||
|
break;
|
||||||
#if HAVE_PARPORT
|
#if HAVE_PARPORT
|
||||||
case PTT_PARPORT:
|
case PTT_PARPORT:
|
||||||
set_parport(ptt);
|
set_parport(ptt);
|
||||||
|
@ -157,6 +165,9 @@ void PTT::close_all(void)
|
||||||
case PTT_TTY:
|
case PTT_TTY:
|
||||||
close_tty();
|
close_tty();
|
||||||
break;
|
break;
|
||||||
|
case PTT_GPIO:
|
||||||
|
close_gpio();
|
||||||
|
break;
|
||||||
#if HAVE_PARPORT
|
#if HAVE_PARPORT
|
||||||
case PTT_PARPORT:
|
case PTT_PARPORT:
|
||||||
close_parport();
|
close_parport();
|
||||||
|
@ -173,6 +184,38 @@ void PTT::close_all(void)
|
||||||
pttfd = -1;
|
pttfd = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-------------------- gpio port PTT --------------------//
|
||||||
|
void PTT::open_gpio(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void PTT::close_gpio(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void PTT::set_gpio(bool ptt)
|
||||||
|
{
|
||||||
|
#define VALUE_MAX 30
|
||||||
|
static const char s_values_str[] = "01";
|
||||||
|
|
||||||
|
char path[VALUE_MAX];
|
||||||
|
|
||||||
|
snprintf(path, VALUE_MAX, "/sys/class/gpio/gpio%d/value", progdefaults.GPIOPort);
|
||||||
|
int fd = open(path, O_WRONLY);
|
||||||
|
if (-1 == fd) {
|
||||||
|
LOG_ERROR("Failed to open gpio (%s) value for writing!\n", path);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (1 != write(fd, &s_values_str[ ptt ? 1 : 0], 1)) {
|
||||||
|
LOG_ERROR("Failed to write value!\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
close(fd);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
//-------------------- serial port PTT --------------------//
|
//-------------------- serial port PTT --------------------//
|
||||||
|
|
||||||
void PTT::open_tty(void)
|
void PTT::open_tty(void)
|
||||||
|
|
Ładowanie…
Reference in New Issue