Files
linuxSmartie/include/aio.h

59 lines
1.0 KiB
C

#ifndef LINUXSMARTIE_AIO_H
#define LINUXSMARTIE_AIO_H
#include <libusb-1.0/libusb.h>
#define AIO_USB_VID 0x1b1cU
#define AIO_USB_PID 0x0c13U
#define AIO_COLOR_CYAN { 0, 255, 255 }
#define AIO_COLOR_WHITE { 255, 255, 255 }
#define AIO_COLOR_OFF { 0, 0, 0 }
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
// roughly converts fan speed to duty
#define SPD2DTY(spd) MAX(0, MIN(spd * 100 / max_fan_speed, 100))
enum aio_pump_mode_t {
QUIET,
BALANCED,
EXTREME
};
enum aio_color_mode_t : uint8_t {
AIO_COLOR_PULSE,
AIO_COLOR_SHIFT,
AIO_COLOR_FIXED,
AIO_COLOR_BLINKING
};
struct rgb_t {
uint8_t r;
uint8_t g;
uint8_t b;
};
struct curve_point_t {
uint8_t temp;
uint8_t duty;
};
struct aio_t {
libusb_device_handle* handle;
enum aio_pump_mode_t pump_mode;
float water_temp;
float t_q;
float t_b;
float t_e;
uint16_t pump_speed;
uint16_t fan_speed[2];
};
void aio_detect(struct aio_t *aio);
void aio_update(struct aio_t *aio);
void aio_close(const struct aio_t *aio);
#endif