remove dependence of libusefull_macros

This commit is contained in:
2025-01-28 20:44:12 +03:00
parent 19f61697d6
commit 5441a87fff
11 changed files with 453 additions and 166 deletions

View File

@@ -18,21 +18,32 @@
#pragma once
typedef struct{
char* MountPath;
int MountSpeed;
char* EncoderPath;
int EncoderSpeed;
int verbose;
} conf_t;
// 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{
int (*readconf)(const char *path); // read config file
void (*dumpconf)();
void (*helpandquit)();
int (*init)();
void (*quit)();
char* MountPath; // path to mount device
int MountSpeed; // serial speed
char* EncoderPath; // path to encoder device
int EncoderSpeed; // serial speed
} conf_t;
// coordinates in degrees: X, Y and time when they were reached
typedef struct{
double X; double Y; double msrtime;
} coords_t;
// mount class
typedef struct{
mcc_errcodes_t (*init)(conf_t *c);
void (*quit)();
mcc_errcodes_t (*getEnc)(coords_t *c);
} mount_t;
extern mount_t Mount;
extern conf_t Conf;