X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=hardware%2Fzeroplus-logic-cube%2Fprotocol.c;h=ce20ccf4012f1a5fadd9098b82ef32e10b0a8c50;hb=fe90fbb7829ac745d59be37e61fa55e45b251a4e;hp=205bf560e168f45f043f11385cadf0e149222203;hpb=4c1433d172e974f8b47ade71ef5e9557ba77a9f5;p=libsigrok.git diff --git a/hardware/zeroplus-logic-cube/protocol.c b/hardware/zeroplus-logic-cube/protocol.c index 205bf560..ce20ccf4 100644 --- a/hardware/zeroplus-logic-cube/protocol.c +++ b/hardware/zeroplus-logic-cube/protocol.c @@ -17,6 +17,7 @@ * along with this program. If not, see . */ +#include #include "protocol.h" SR_PRIV unsigned int get_memory_size(int type) @@ -29,7 +30,7 @@ SR_PRIV unsigned int get_memory_size(int type) return 0; } -SR_PRIV int clz(unsigned int x) +static int clz(unsigned int x) { int n = 0; if (x == 0) @@ -91,6 +92,22 @@ SR_PRIV int set_capture_ratio(struct dev_context *devc, uint64_t ratio) return SR_OK; } +SR_PRIV int set_voltage_threshold(struct dev_context *devc, double thresh) +{ + if (thresh > 6.0) + thresh = 6.0; + if (thresh < -6.0) + thresh = -6.0; + + devc->cur_threshold = thresh; + + analyzer_set_voltage_threshold((int) round(-9.1*thresh + 62.6)); + + sr_info("Setting voltage threshold to %fV.", devc->cur_threshold); + + return SR_OK; +} + SR_PRIV void set_triggerbar(struct dev_context *devc) { unsigned int trigger_depth, triggerbar, ramsize_trigger;