X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Fappa-55ii%2Fprotocol.c;h=708262bd779403fd1cfd65f7c20afd7a3a89a8fa;hb=8789564070383e058cf5c9511c80c2398ff221e2;hp=161861fef72c7e824a0aa67bb305b5fc01855d9a;hpb=76b4d4f422060718673da16fee6ab054d505ab7d;p=libsigrok.git diff --git a/hardware/appa-55ii/protocol.c b/hardware/appa-55ii/protocol.c index 161861fe..708262bd 100644 --- a/hardware/appa-55ii/protocol.c +++ b/hardware/appa-55ii/protocol.c @@ -27,7 +27,7 @@ typedef enum { LOG_DATA = 0x14, LOG_START = 0x18, LOG_END = 0x19, -} packet_type_t; +} packet_type; static gboolean appa_55ii_checksum(const uint8_t *buf) { @@ -69,13 +69,13 @@ static uint64_t appa_55ii_flags(const uint8_t *buf) return flags; } -static float appa_55ii_temp(const uint8_t *buf, int probe) +static float appa_55ii_temp(const uint8_t *buf, int ch) { const uint8_t *ptr; int16_t temp; uint8_t flags; - ptr = buf + 4 + 14 + 3 * probe; + ptr = buf + 4 + 14 + 3 * ch; temp = RL16(ptr); flags = ptr[2]; @@ -92,8 +92,8 @@ static void appa_55ii_live_data(struct sr_dev_inst *sdi, const uint8_t *buf) struct dev_context *devc; struct sr_datafeed_packet packet; struct sr_datafeed_analog analog; - struct sr_probe *probe; - float values[APPA_55II_NUM_PROBES], *val_ptr; + struct sr_channel *ch; + float values[APPA_55II_NUM_CHANNELS], *val_ptr; int i; devc = sdi->priv; @@ -109,18 +109,18 @@ static void appa_55ii_live_data(struct sr_dev_inst *sdi, const uint8_t *buf) analog.mqflags = appa_55ii_flags(buf); analog.data = values; - for (i = 0; i < APPA_55II_NUM_PROBES; i++) { - probe = g_slist_nth_data(sdi->probes, i); - if (!probe->enabled) + for (i = 0; i < APPA_55II_NUM_CHANNELS; i++) { + ch = g_slist_nth_data(sdi->channels, i); + if (!ch->enabled) continue; - analog.probes = g_slist_append(analog.probes, probe); + analog.channels = g_slist_append(analog.channels, ch); *val_ptr++ = appa_55ii_temp(buf, i); } packet.type = SR_DF_ANALOG; packet.payload = &analog; sr_session_send(devc->session_cb_data, &packet); - g_slist_free(analog.probes); + g_slist_free(analog.channels); devc->num_samples++; } @@ -138,8 +138,8 @@ static void appa_55ii_log_data_parse(struct sr_dev_inst *sdi) struct dev_context *devc; struct sr_datafeed_packet packet; struct sr_datafeed_analog analog; - struct sr_probe *probe; - float values[APPA_55II_NUM_PROBES], *val_ptr; + struct sr_channel *ch; + float values[APPA_55II_NUM_CHANNELS], *val_ptr; const uint8_t *buf; int16_t temp; int offset, i; @@ -160,19 +160,19 @@ static void appa_55ii_log_data_parse(struct sr_dev_inst *sdi) analog.unit = SR_UNIT_CELSIUS; analog.data = values; - for (i = 0; i < APPA_55II_NUM_PROBES; i++) { + for (i = 0; i < APPA_55II_NUM_CHANNELS; i++) { temp = RL16(buf + 12 + 2 * i); - probe = g_slist_nth_data(sdi->probes, i); - if (!probe->enabled) + ch = g_slist_nth_data(sdi->channels, i); + if (!ch->enabled) continue; - analog.probes = g_slist_append(analog.probes, probe); + analog.channels = g_slist_append(analog.channels, ch); *val_ptr++ = temp == 0x7FFF ? INFINITY : (float)temp / 10; } packet.type = SR_DF_ANALOG; packet.payload = &analog; sr_session_send(devc->session_cb_data, &packet); - g_slist_free(analog.probes); + g_slist_free(analog.channels); devc->num_samples++; devc->log_buf_len -= 20; @@ -237,7 +237,7 @@ static const uint8_t *appa_55ii_parse_data(struct sr_dev_inst *sdi, /* Skip broken packet. */ return buf + 4 + buf[3] + 1; - switch ((packet_type_t)buf[2]) { + switch ((packet_type)buf[2]) { case LIVE_DATA: appa_55ii_live_data(sdi, buf); break;