gillham / logic_analyzer

Implementation of a SUMP compatible logic analyzer for the Arduino
Other
458 stars 99 forks source link

Allow to enable internal pullups at runtime #47

Open Harvie opened 5 years ago

Harvie commented 5 years ago

Allow to enable internal pullups at runtime... It's simple to do this by modyfiing code eg.: from pinMode(CHAN0, INPUT); to pinMode(CHAN0, INPUT_PULLUP);

I've done this and it works perfectly, but it requires recompiling and flashing. I think we might prepare some SUMP protocol extension with sigrok guys to be able to controll this at runtime from pulseview GUI!

gillham commented 2 years ago

So you're saying based on a SUMP protocol extension that would say "I want to capture with input pulls enabled" we could call "pinMode(CHANx, INPUT_PULLUP)" on all channels prior to sampling or triggering? Or I guess if we don't have the SUMP extension we will call normal "pinMode(CHANx, INPUT)", if we do have the extension requesting, we call with INPUT_PULLUP instead? So instead of doing the pinMode() calls in setup(), we would be doing them in loop() in our "switch (cmdByte)" calls based on an extension?

Or would we keep the current setup() and if requested we enable INPUT_PULLUP? I guess if Sigrok would have some pullup or not toggle, we would need to be able to turn it back off also. So something like: setup() ... pinmode = INPUT; ... case SUMP_PULLUP_CONFIG: .... pinmode = INPUT_PULLUP;

case SUMP_ARM: pinMode(CHAN0, pinmode); ...

I guess we would need to think about how to disable/enable pullup mode during a session.