2 * This file is part of the libsigrok project.
4 * Copyright (C) 2016 George Hopkins <george-hopkins@null.net>
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #ifndef LIBSIGROK_HARDWARE_PCE_322A_PROTOCOL_H
21 #define LIBSIGROK_HARDWARE_PCE_322A_PROTOCOL_H
25 #include <libsigrok/libsigrok.h>
26 #include "libsigrok-internal.h"
28 #define LOG_PREFIX "pce-322a"
30 #define BUFFER_SIZE 13
34 CMD_DISCONNECT = 0xcaff,
35 CMD_TOGGLE_WEIGHT_FREQ = 0xaaf1,
36 CMD_TOGGLE_MEAS_RANGE = 0xaaf2,
37 CMD_TOGGLE_HOLD_MAX_MIN = 0xaaf3,
38 CMD_TOGGLE_WEIGHT_TIME = 0xaaf4,
39 CMD_TOGGLE_HOLD = 0xaaf5,
40 CMD_TOGGLE_BACKLIGHT = 0xaaf6,
41 CMD_TOGGLE_DATE_TIME = 0xaaf7,
42 CMD_LOG_START = 0x7e00,
43 CMD_MEMORY_STATUS = 0xadda,
44 CMD_MEMORY_TRANSFER = 0xd3da,
45 CMD_MEMORY_CLEAR = 0xaac1,
46 CMD_POWER_OFF = 0xaaf8,
50 MEAS_RANGE_30_130 = 0,
52 MEAS_RANGE_50_100 = 2,
53 MEAS_RANGE_80_130 = 3,
56 /** Private, per-device-instance driver context. */
58 /* Model-specific information */
60 uint8_t cur_meas_range;
62 /* Acquisition settings */
63 uint64_t limit_samples;
65 /* Operational state */
68 /* Temporary state across callbacks */
69 uint8_t buffer[BUFFER_SIZE];
73 SR_PRIV int pce_322a_connect(const struct sr_dev_inst *sdi);
74 SR_PRIV int pce_322a_disconnect(const struct sr_dev_inst *sdi);
75 SR_PRIV int pce_322a_receive_data(int fd, int revents, void *cb_data);
76 SR_PRIV uint64_t pce_322a_weight_freq_get(const struct sr_dev_inst *sdi);
77 SR_PRIV int pce_322a_weight_freq_set(const struct sr_dev_inst *sdi, uint64_t freqw);
78 SR_PRIV uint64_t pce_322a_weight_time_get(const struct sr_dev_inst *sdi);
79 SR_PRIV int pce_322a_weight_time_set(const struct sr_dev_inst *sdi, uint64_t timew);
80 SR_PRIV int pce_322a_meas_range_get(const struct sr_dev_inst *sdi,
81 uint64_t *low, uint64_t *high);
82 SR_PRIV int pce_322a_meas_range_set(const struct sr_dev_inst *sdi,
83 uint64_t low, uint64_t high);
84 SR_PRIV int pce_322a_power_off(const struct sr_dev_inst *sdi);