58 lines
1.8 KiB
C
58 lines
1.8 KiB
C
/*
|
|
* This file is part of the libsidservo project.
|
|
* Copyright 2025 Edward V. Emelianov <edward.emelianoff@gmail.com>.
|
|
*
|
|
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <sys/time.h>
|
|
|
|
// error codes
|
|
typedef enum{
|
|
MCC_E_OK = 0, // all OK
|
|
MCC_E_FATAL, // some fatal error
|
|
MCC_E_BADFORMAT, // wrong arguments of function
|
|
MCC_E_ENCODERDEV, // encoder device error or can't open
|
|
MCC_E_MOUNTDEV, // mount device error or can't open
|
|
} mcc_errcodes_t;
|
|
|
|
typedef struct{
|
|
char* MountPath; // path to mount device
|
|
int MountSpeed; // serial speed
|
|
char* EncoderPath; // path to encoder device
|
|
int EncoderSpeed; // serial speed
|
|
int SepEncoder; // ==1 if encoder works as separate serial device
|
|
} conf_t;
|
|
|
|
// coordinates in degrees: X, Y and time when they were reached
|
|
typedef struct{
|
|
double X; double Y; struct timeval msrtime;
|
|
} coords_t;
|
|
|
|
typedef struct{
|
|
coords_t position;
|
|
coords_t speed;
|
|
} mountdata_t;
|
|
|
|
// mount class
|
|
typedef struct{
|
|
mcc_errcodes_t (*init)(conf_t *c);
|
|
void (*quit)();
|
|
mcc_errcodes_t (*getMountData)(mountdata_t *d);
|
|
} mount_t;
|
|
|
|
extern mount_t Mount;
|