kopia lustrzana https://github.com/Hamlib/Hamlib
Dead simple sample Hamlib program
git-svn-id: https://hamlib.svn.sourceforge.net/svnroot/hamlib/trunk@2214 7ae35d74-ebe9-4afe-98af-79ac388436b8Hamlib-1.2.7
rodzic
b572fbfaf3
commit
30bb34efa5
|
@ -0,0 +1,27 @@
|
|||
/* This is a minimal program calling Hamlib to get receive frequency.
|
||||
*
|
||||
* To compile:
|
||||
* gcc -L/usr/local/lib -lhamlib -o example example.c
|
||||
* if hamlib is installed in /usr/local/...
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <hamlib/rig.h>
|
||||
|
||||
int main() {
|
||||
RIG *my_rig;
|
||||
char *rig_file;
|
||||
freq_t freq;
|
||||
int status, retcode;
|
||||
|
||||
rig_set_debug(RIG_DEBUG_ERR); // signal errors only
|
||||
my_rig = rig_init(1608); // Ten-Tec Orion code
|
||||
rig_file = "/dev/ham.orion"; // communications dev.
|
||||
// you may prefer /dev/ttyS0
|
||||
strncpy(my_rig->state.rigport.pathname, rig_file, FILPATHLEN);
|
||||
my_rig->state.rigport.parm.serial.rate = 57600;
|
||||
retcode = rig_open(my_rig); // open the rig
|
||||
status = rig_get_freq(my_rig, RIG_VFO_CURR, &freq); // get freq
|
||||
printf("%f\n", freq);
|
||||
};
|
Ładowanie…
Reference in New Issue