dc mode flag

This commit is contained in:
BENEDEK László 2025-02-21 12:09:36 +01:00
parent 6055d50eaf
commit 8010b7e24f

View File

@ -10,6 +10,7 @@
const char* DEFAULT_TYPE = "float";
const char* DEFAULT_RANGE = "10V";
const uint8_t DEFAULT_CHANNEL = 0;
const bool DEFAULT_DC_MODE = false;
const uint32_t DEFAULT_BUFFERSIZE = 10000;
const uint32_t DEFAULT_MAX_BUFFERSIZE = DEFAULT_BUFFERSIZE * 5;
const uint32_t DEFAULT_SAMPLE_INTERVAL = 1000;
@ -19,6 +20,7 @@ bool stop = false;
uint8_t* channel;
uint32_t* max_buffersize;
// ctrl+c -> stop
void capture_stop(int signal) {
(void)signal;
stop = true;
@ -118,6 +120,7 @@ int main(int argc, char** argv) {
char** type = c_flag_string("type", "t", "type for output", DEFAULT_TYPE);
char** range = c_flag_string("range", "r", "voltage range", DEFAULT_RANGE);
channel = c_flag_uint8("channel", "c", "channel", DEFAULT_CHANNEL);
bool* dc = c_flag_bool("dc", "dc", "dc mode", DEFAULT_DC_MODE);
uint32_t* buffersize = c_flag_uint32("buffersize", "b", "buffersize", DEFAULT_BUFFERSIZE);
max_buffersize = c_flag_uint32("max_buffersize", "mb", "max buffersize the driver stores", DEFAULT_MAX_BUFFERSIZE);
uint32_t* sample_interval = c_flag_uint32("sample_interval", "s", "sample interval", DEFAULT_SAMPLE_INTERVAL);
@ -161,7 +164,7 @@ int main(int argc, char** argv) {
// configure picoscope
int16_t unit = ps2000_open_unit();
if (ps2000_set_channel(unit, PS2000_CHANNEL_A + *channel, true, false, selected_range) == 0) {
if (ps2000_set_channel(unit, PS2000_CHANNEL_A + *channel, true, *dc, selected_range) == 0) {
fprintf(stderr, "set_channel failed!\n");
cleanup(unit);
return -1;