- Check for the numpy Python module (bug #533).
- Check for zip_discard(), provide alternative if not available (bug #674).
* Portability:
- - Android: Add fallbacks for missing stoi()/stod().
+ - Android: Add fallbacks for missing stoi()/stod().
- FreeBSD: Fix a libusb related compiler error.
- FreeBSD: Fix an issue with libusb_get_port_numbers().
- FreeBSD: Fix an issue with BSD Make (bug #556).
return result;
}
-Trigger::Trigger(shared_ptr<Context> context, string name) :
+Trigger::Trigger(shared_ptr<Context> context, string name) :
_structure(sr_trigger_new(name.c_str())),
_context(move(context))
{
TriggerStage::~TriggerStage()
{
}
-
+
int TriggerStage::number() const
{
return _structure->stage;
%pragma(java) jniclassimports=%{
/**
* @mainpage API Reference
- *
+ *
* Introduction
* ------------
- *
+ *
* The sigrok-java API provides an object-oriented Java interface to the
* functionality in libsigrok. It is built on top of the libsigrokcxx C++ API.
- *
+ *
* Getting started
* ---------------
- *
+ *
* Usage of the sigrok-java API needs to begin with a call to Context.create().
* This will create the global libsigrok context and returns a Context object.
* Methods on this object provide access to the hardware drivers, input and
* output formats supported by the library, as well as means of creating other
* objects such as sessions and triggers.
- *
+ *
* Error handling
* --------------
- *
+ *
* When any libsigrok C API call returns an error, an Error exception is raised,
* which provides access to the error code and description.
*/
%typemap(in, numinputs=0) JNIEnv * %{
$1 = jenv;
-%}
+%}
/* Thread safe JNIEnv handling */
import org.sigrok.core.classes.LogLevel;
-public interface LogCallback
+public interface LogCallback
{
public void run(LogLevel loglevel, String message);
}
extern SR_PRIV const uint64_t samplerates[];
extern SR_PRIV const size_t samplerates_count;
-SR_PRIV int sigma_write_register(uint8_t reg, uint8_t *data, size_t len,
+SR_PRIV int sigma_write_register(uint8_t reg, uint8_t *data, size_t len,
struct dev_context *devc);
SR_PRIV int sigma_set_register(uint8_t reg, uint8_t value, struct dev_context *devc);
SR_PRIV int sigma_write_trigger_lut(struct triggerlut *lut, struct dev_context *devc);
int i;
uint8_t chksum = 0;
uint8_t *payload;
-
+
payload = (uint8_t *)(buf + sizeof(struct brymen_header));
hdr = (void *)buf;
tail = (void *)(payload + hdr->len);
-
+
for (i = 0; i< hdr->len; i++)
chksum ^= payload[i];
-
+
if (tail->checksum != chksum) {
sr_dbg("Packet has invalid checksum 0x%.2x. Expected 0x%.2x.",
chksum, tail->checksum);
return FALSE;
}
-
+
return TRUE;
}
if (i < 0)
return SR_ERR_ARG;
devc->dslogic_clock_edge = i;
- break;
+ break;
default:
ret = SR_ERR_NA;
}
v16 |= 1 << 2;
}
if (devc->limit_samples > DS_MAX_LOGIC_DEPTH *
- ceil(devc->cur_samplerate * 1.0 / DS_MAX_LOGIC_SAMPLERATE)
+ ceil(devc->cur_samplerate * 1.0 / DS_MAX_LOGIC_SAMPLERATE)
&& !devc->dslogic_continuous_mode) {
/* Enable RLE for long captures.
* Without this, captured data present errors.
if (devc->cur_acq_frame == devc->frame_limit - 1) {
/* All frames accquired. */
sr_spew("All frames acquired.");
-
+
sdi->driver->dev_acquisition_stop(sdi);
return TRUE;
} else {
if (devc->df_started) {
packet.type = SR_DF_FRAME_END;
sr_session_send(sdi, &packet);
-
+
packet.type = SR_DF_FRAME_BEGIN;
sr_session_send(sdi, &packet);
}
if (devc->df_started) {
packet.type = SR_DF_FRAME_END;
sr_session_send(sdi, &packet);
-
+
packet.type = SR_DF_FRAME_BEGIN;
sr_session_send(sdi, &packet);
}
trigger_config |= 0x20; //DSO level trigger & width < trigger_width
break;
case 2:
- trigger_config |= 0x40; //DSO level trigger & width >= trigger_width
+ trigger_config |= 0x40; //DSO level trigger & width >= trigger_width
break;
case 3:
trigger_config |= 0x60; //LA combination trigger
if (p_ols_open(devc) != SR_OK) {
goto err_free_ftdic;
}
-
+
/* The discovery procedure is like this: first send the Reset
* command (0x00) 5 times, since the device could be anywhere
* in a 5-byte command. Then send the ID command (0x02).
sr_dbg("flag_reg = %x", devc->flag_reg);
/*
- * In demux mode the OLS is processing two 8-bit or 16-bit samples
- * in parallel and for this to work the lower two bits of the four
+ * In demux mode the OLS is processing two 8-bit or 16-bit samples
+ * in parallel and for this to work the lower two bits of the four
* "channel_disable" bits must be replicated to the upper two bits.
*/
flag_tmp = devc->flag_reg;
goto err_open_close_ftdic;
}
sr_dbg("FTDI chip read data chunk size set successfully.");
-
+
return SR_OK;
err_open_close_ftdic:
sr_spew("Received byte 0x%.2x.", byte);
if ((devc->flag_reg & FLAG_DEMUX) && (devc->flag_reg & FLAG_RLE)) {
- /* RLE in demux mode must be processed differently
+ /* RLE in demux mode must be processed differently
* since in this case the RLE encoder is operating on pairs of samples.
*/
if (devc->num_bytes == num_channels * 2) {
* sample.
*/
devc->tmp_sample[i] = devc->sample[j++];
- }
+ }
}
/* Clear out the most significant bit of the sample */
devc->tmp_sample[devc->num_bytes - 1] &= 0x7f;
* sample.
*/
devc->tmp_sample2[i] = devc->sample[j++];
- }
+ }
}
/* Clear out the most significant bit of the sample */
devc->tmp_sample2[devc->num_bytes - 1] &= 0x7f;
* sample.
*/
devc->tmp_sample[i] = devc->sample[j++];
- }
+ }
}
memcpy(devc->sample, devc->tmp_sample, 4);
sr_spew("Expanded sample: 0x%.8x.", sample);
if (!(devc = sdi->priv))
return SR_ERR;
- /*
+ /*
* If timebase < 50 msecs/DIV just sleep about one sweep time except
* for really fast sweeps.
*/
return SR_ERR_DEV_CLOSED;
std_session_send_df_header(sdi);
-
+
sr_sw_limits_acquisition_start(&devc->limits);
/* Poll every 500ms, or whenever some data comes in. */
struct sr_usb_dev_inst *usb;
usb = sdi->conn;
-
+
/* Detach kernel drivers which grabbed this device (if any). */
if (libusb_kernel_driver_active(usb->devhdl, 0) == 1) {
ret = libusb_detach_kernel_driver(usb->devhdl, 0);
*
* skip: Allows skipping until given timestamp in the file.
* This can speed up analyzing of long captures.
- *
+ *
* Value < 0: Skip until first timestamp listed in
* the file. (default)
*
struct modbus_serial_rtu *modbus = priv;
int ret;
- ret = serial_read_nonblocking(modbus->serial, buf, maxlen);
+ ret = serial_read_nonblocking(modbus->serial, buf, maxlen);
if (ret < 0)
return ret;
- modbus->crc = modbus_serial_rtu_crc(modbus->crc, buf, ret);
- return ret;
+ modbus->crc = modbus_serial_rtu_crc(modbus->crc, buf, ret);
+ return ret;
}
static int modbus_serial_rtu_read_end(void *priv)
outc = o->priv;
for (i = 0; i < outc->num_channels; i++) {
- if (!(outc->chanbuf[i] = g_try_realloc(outc->chanbuf[i], sizeof(float) * size))) {
+ if (!(outc->chanbuf[i] = g_try_realloc(outc->chanbuf[i], sizeof(float) * size))) {
sr_err("Unable to allocate enough output buffer memory.");
return SR_ERR;
}
if ((ret = libusb_release_interface(usb->devhdl, uscpi->interface)) < 0)
sr_err("Failed to release interface: %s.",
libusb_error_name(ret));
-
+
if (uscpi->detached_kernel_driver) {
if ((ret = libusb_attach_kernel_driver(usb->devhdl,
uscpi->interface)) < 0)
libusb_free_device_list(devlist, 1);
sr_dbg("Found %d device(s).", g_slist_length(devices));
-
+
return devices;
}