X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Fhardware%2Fzketech-ebd-usb%2Fprotocol.h;h=004ce5fb25385bc3f3dcfc7edf9825eb350536d6;hb=77b6b98d1c3790b8feb55105f243cec63418ab0f;hp=9f750b7753b7ef62b7eb9c66a593b71551cd2025;hpb=9890fb1f08ff399c5ea6cf0e99226f23dddcaf8c;p=libsigrok.git diff --git a/src/hardware/zketech-ebd-usb/protocol.h b/src/hardware/zketech-ebd-usb/protocol.h index 9f750b77..004ce5fb 100644 --- a/src/hardware/zketech-ebd-usb/protocol.h +++ b/src/hardware/zketech-ebd-usb/protocol.h @@ -27,12 +27,12 @@ #define LOG_PREFIX "zketech-ebd-usb" -#define MSGLEN 19 -#define MSGCHECKSUMPOS 17 -#define MSGFRAMEBEGIN 0xfa -#define MSGFRAMEBEGINPOS 0 -#define MSGFRAMEEND 0xf8 -#define MSGFRAMEENDPOS 18 +#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; @@ -42,29 +42,19 @@ struct dev_context { gboolean load_activated; }; -SR_PRIV float zketech_ebd_usb_value_decode(uint8_t b1, uint8_t b2, float divisor); -SR_PRIV void zketech_ebd_usb_value_encode(float voltage, uint8_t *b1, uint8_t *b2, float divisor); - /* Communication via serial. */ -SR_PRIV int zketech_ebd_usb_send(struct sr_serial_dev_inst *serial, uint8_t buf[], size_t count); -SR_PRIV int zketech_ebd_usb_sendcfg(struct sr_serial_dev_inst *serial, struct dev_context *devc); -SR_PRIV int zketech_ebd_usb_read_chars(struct sr_serial_dev_inst *serial, - int count, uint8_t *buf); +SR_PRIV int ebd_read_chars(struct sr_serial_dev_inst *serial, int count, uint8_t *buf); /* Commands. */ -SR_PRIV int zketech_ebd_usb_init(struct sr_serial_dev_inst *serial, struct dev_context *devc); -SR_PRIV int zketech_ebd_usb_loadstart(struct sr_serial_dev_inst *serial, struct dev_context *devc); -SR_PRIV int zketech_ebd_usb_receive_data(int fd, int revents, void *cb_data); -SR_PRIV int zketech_ebd_usb_stop(struct sr_serial_dev_inst *serial, struct dev_context *devc); -SR_PRIV int zketech_ebd_usb_loadstop(struct sr_serial_dev_inst *serial, struct dev_context *devc); +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 zketech_ebd_usb_get_current_limit(const struct sr_dev_inst *sdi, - float *current); -SR_PRIV int zketech_ebd_usb_set_current_limit(const struct sr_dev_inst *sdi, - float current); -SR_PRIV gboolean zketech_ebd_usb_current_is0(struct dev_context *devc); - -SR_PRIV void zketech_ebd_usb_buffer_debug(const char *message, uint8_t buf[], size_t count); +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