Software support for external-trigger-once
This commit is contained in:
parent
a984e1c8ff
commit
66050aca5b
|
@ -26,6 +26,7 @@ std::string trigger_mode_to_string(puzzlefw::TriggerMode mode)
|
|||
switch (mode) {
|
||||
case TriggerMode::TRIG_AUTO: return "auto";
|
||||
case TriggerMode::TRIG_EXTERNAL: return "external";
|
||||
case TriggerMode::TRIG_EXTERNAL_ONCE: return "external-once";
|
||||
default: return "none";
|
||||
}
|
||||
}
|
||||
|
@ -206,6 +207,7 @@ int main(int argc, char **argv)
|
|||
OPT_CLEAR_DMA, OPT_CLEAR_TIMESTAMP, OPT_CLEAR_RANGE,
|
||||
OPT_ACQUISITION_ON, OPT_ACQUISITION_OFF, OPT_CHANNELS,
|
||||
OPT_TRIGGER_NONE, OPT_TRIGGER_AUTO, OPT_TRIGGER_EXT,
|
||||
OPT_TRIGGER_EXT_ONCE,
|
||||
OPT_TRIGGER_CHANNEL, OPT_TRIGGER_RISING, OPT_TRIGGER_FALLING,
|
||||
OPT_TRIGGER_DELAY, OPT_TRIGGER,
|
||||
OPT_RECORD_LEN, OPT_DIVISOR, OPT_AVERAGE, OPT_DECIMATE, OPT_SHIFT,
|
||||
|
@ -226,6 +228,7 @@ int main(int argc, char **argv)
|
|||
{"trigger-none", 0, 0, OPT_TRIGGER_NONE},
|
||||
{"trigger-auto", 0, 0, OPT_TRIGGER_AUTO},
|
||||
{"trigger-ext", 0, 0, OPT_TRIGGER_EXT},
|
||||
{"trigger-ext-once", 0, 0, OPT_TRIGGER_EXT_ONCE},
|
||||
{"trigger-channel", 1, 0, OPT_TRIGGER_CHANNEL},
|
||||
{"trigger-rising", 0, 0, OPT_TRIGGER_RISING},
|
||||
{"trigger-falling", 0, 0, OPT_TRIGGER_FALLING},
|
||||
|
@ -264,6 +267,7 @@ int main(int argc, char **argv)
|
|||
" --trigger-none Disable triggering.\n"
|
||||
" --trigger-auto Enable continuous triggering.\n"
|
||||
" --trigger-ext Enable external trigger.\n"
|
||||
" --trigger-ext-once Enable external trigger once.\n"
|
||||
" --trigger-channel N Select trigger input channel (range 0 to 3)."
|
||||
"\n"
|
||||
" --trigger-rising Trigger on rising edge.\n"
|
||||
|
@ -359,6 +363,9 @@ int main(int argc, char **argv)
|
|||
case OPT_TRIGGER_EXT:
|
||||
args.trigger_mode = puzzlefw::TRIG_EXTERNAL;
|
||||
break;
|
||||
case OPT_TRIGGER_EXT_ONCE:
|
||||
args.trigger_mode = puzzlefw::TRIG_EXTERNAL_ONCE;
|
||||
break;
|
||||
case OPT_TRIGGER_CHANNEL:
|
||||
args.trigger_channel = parse_int(optarg, ok);
|
||||
if (!ok
|
||||
|
|
|
@ -88,9 +88,10 @@ static inline void sync_dma()
|
|||
|
||||
/** Trigger modes. */
|
||||
enum TriggerMode {
|
||||
TRIG_NONE = 0, // trigger disabled, manual trigger only
|
||||
TRIG_AUTO = 1, // continuous triggering
|
||||
TRIG_EXTERNAL = 2 // external triggering
|
||||
TRIG_NONE = 0, // trigger disabled, manual trigger only
|
||||
TRIG_AUTO = 1, // continuous triggering
|
||||
TRIG_EXTERNAL = 2, // external triggering
|
||||
TRIG_EXTERNAL_ONCE = 3 // external trigger once
|
||||
};
|
||||
|
||||
|
||||
|
@ -267,6 +268,9 @@ public:
|
|||
if ((v & 0x02) != 0) {
|
||||
return TRIG_EXTERNAL;
|
||||
}
|
||||
if ((v & 0x04) != 0) {
|
||||
return TRIG_EXTERNAL_ONCE;
|
||||
}
|
||||
return TRIG_NONE;
|
||||
}
|
||||
|
||||
|
@ -274,13 +278,16 @@ public:
|
|||
void set_trigger_mode(TriggerMode mode)
|
||||
{
|
||||
uint32_t v = read_reg(REG_TRIGGER_MODE);
|
||||
v &= 0xfc;
|
||||
v &= 0xf0;
|
||||
if (mode == TRIG_AUTO) {
|
||||
v |= 0x01;
|
||||
}
|
||||
if (mode == TRIG_EXTERNAL) {
|
||||
v |= 0x02;
|
||||
}
|
||||
if (mode == TRIG_EXTERNAL_ONCE) {
|
||||
v |= 0x04;
|
||||
}
|
||||
write_reg(REG_TRIGGER_MODE, v);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue