fossasia / pslab-firmware

Firmware for PSLab Open Hardware Platform https://pslab.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Logic analyzer: Cannot trigger on ID1 in single channel mode

bessman opened this issue · comments

In single channel logic analyzer mode, the trigger is configured via two values:

  • trigger_channel selects which channel to trigger on. It is 0 for ID1, 1 for ID2, 2 for ID3, etc.
  • trigger_mode selects the type of logic event to trigger on. 0 disables the trigger, 1 triggers on falling edge, 2 triggers on rising edge.
    These values are sent to the device packed into a single byte, as ((trigger channel << 4) | trigger mode).

However, due to a bug in the firmware code, it is currently not possible to trigger on ID1:

if (location & 7) {

((trigger_channel << 4) | trigger_mode) & 7 is 0 for trigger_channel == 0. Since the integer referring to ID1 is 0, the above line will evaluate as False if ID1 is selected as trigger channel.

My bad, got my bit operators confused. ((trigger_channel << 4) | trigger_mode) & 7 > 0 if trigger_mode > 0.