full version of beta including resources and binary
This commit is contained in:
76
include/mightywatt.h
Normal file
76
include/mightywatt.h
Normal file
@ -0,0 +1,76 @@
|
||||
#ifndef MIGHTYWATT_H
|
||||
#define MIGHTYWATT_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define MW_FW_VERSION_MAX 31
|
||||
#define MW_BOARD_REV_MAX 31
|
||||
|
||||
typedef struct mw_device mw_device;
|
||||
|
||||
typedef enum {
|
||||
MW_MODE_CURRENT = 0,
|
||||
MW_MODE_VOLTAGE = 1,
|
||||
MW_MODE_POWER = 2,
|
||||
MW_MODE_RESISTANCE = 3,
|
||||
MW_MODE_VOLTAGE_INVERTED = 4,
|
||||
} mw_mode;
|
||||
|
||||
enum {
|
||||
MW_STATUS_READY = 0,
|
||||
MW_STATUS_CURRENT_OVERLOAD = 1 << 0,
|
||||
MW_STATUS_VOLTAGE_OVERLOAD = 1 << 1,
|
||||
MW_STATUS_POWER_OVERLOAD = 1 << 2,
|
||||
MW_STATUS_OVERHEAT = 1 << 3,
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
char firmware_version[MW_FW_VERSION_MAX + 1];
|
||||
char board_revision[MW_BOARD_REV_MAX + 1];
|
||||
uint32_t max_current_dac_ma;
|
||||
uint32_t max_current_adc_ma;
|
||||
uint32_t max_voltage_dac_mv;
|
||||
uint32_t max_voltage_adc_mv;
|
||||
uint32_t max_power_mw;
|
||||
uint32_t dvm_input_resistance_ohm;
|
||||
uint32_t temperature_threshold_c;
|
||||
} mw_capabilities;
|
||||
|
||||
typedef struct {
|
||||
uint16_t current_ma;
|
||||
uint16_t voltage_mv;
|
||||
uint8_t temperature_c;
|
||||
bool remote;
|
||||
uint8_t status;
|
||||
} mw_report;
|
||||
|
||||
const char *mw_last_error(const mw_device *dev);
|
||||
int mw_open(mw_device **out_dev, const char *port_path, int settle_ms);
|
||||
void mw_close(mw_device *dev);
|
||||
|
||||
int mw_identify(mw_device *dev);
|
||||
int mw_query_capabilities(mw_device *dev, mw_capabilities *caps);
|
||||
int mw_get_report(mw_device *dev, mw_report *report);
|
||||
int mw_set(mw_device *dev, mw_mode mode, uint32_t milli_units, mw_report *report);
|
||||
int mw_set_remote(mw_device *dev, bool enable, mw_report *report);
|
||||
int mw_set_series_resistance(mw_device *dev, uint16_t milliohm, mw_report *report);
|
||||
int mw_get_series_resistance(mw_device *dev, uint16_t *milliohm);
|
||||
|
||||
size_t mw_status_string(uint8_t status, char *buffer, size_t buffer_size);
|
||||
const char *mw_mode_name(mw_mode mode);
|
||||
uint32_t mw_report_power_mw(const mw_report *report);
|
||||
uint32_t mw_capability_limit_for_mode(const mw_capabilities *caps, mw_mode mode);
|
||||
int mw_validate_target(const mw_capabilities *caps, mw_mode mode, uint32_t milli_units,
|
||||
char *buffer, size_t buffer_size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user