X-Git-Url: http://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fzketech-ebd-usb%2Fprotocol.h;h=004ce5fb25385bc3f3dcfc7edf9825eb350536d6;hb=8b607a24e7e7dec8b65963281b9cb43a0c5ba0a6;hp=888ead09f16896ae793277256f99144bf5b342f2;hpb=c527132aec5ff8f2fc9646f360a7b0874301e4e7;p=libsigrok.git diff --git a/src/hardware/zketech-ebd-usb/protocol.h b/src/hardware/zketech-ebd-usb/protocol.h index 888ead09..004ce5fb 100644 --- a/src/hardware/zketech-ebd-usb/protocol.h +++ b/src/hardware/zketech-ebd-usb/protocol.h @@ -27,9 +27,34 @@ #define LOG_PREFIX "zketech-ebd-usb" +#define MSG_LEN 19 +#define MSG_CHECKSUM_POS 17 +#define MSG_FRAME_BEGIN 0xfa +#define MSG_FRAME_BEGIN_POS 0 +#define MSG_FRAME_END 0xf8 +#define MSG_FRAME_END_POS 18 + struct dev_context { + struct sr_sw_limits limits; + GMutex rw_mutex; + float current_limit; + gboolean running; + gboolean load_activated; }; -SR_PRIV int zketech_ebd_usb_receive_data(int fd, int revents, void *cb_data); +/* Communication via serial. */ +SR_PRIV int ebd_read_chars(struct sr_serial_dev_inst *serial, int count, uint8_t *buf); + +/* Commands. */ +SR_PRIV int ebd_init(struct sr_serial_dev_inst *serial, struct dev_context *devc); +SR_PRIV int ebd_loadstart(struct sr_serial_dev_inst *serial, struct dev_context *devc); +SR_PRIV int ebd_receive_data(int fd, int revents, void *cb_data); +SR_PRIV int ebd_stop(struct sr_serial_dev_inst *serial, struct dev_context *devc); +SR_PRIV int ebd_loadstop(struct sr_serial_dev_inst *serial, struct dev_context *devc); + +/* Configuration. */ +SR_PRIV int ebd_get_current_limit(const struct sr_dev_inst *sdi, float *current); +SR_PRIV int ebd_set_current_limit(const struct sr_dev_inst *sdi, float current); +SR_PRIV gboolean ebd_current_is0(struct dev_context *devc); #endif