I was having trouble following the magic numbers in AR488_GPIBbus.cpp, so I rewrote the setGpibState() calls as simpler, easier to read inputCtrl(), outputCtrl(), assertCtrl() and clearCtrl() calls with defined foo_BIT values OR'd as indicated in the translated setGpibState() calls. I also noted where the values didn't make sense with a WHUT? comment. Setting a value for INPUTs might make sense to activate/disable pullups, but setting the pin as INPUT_PULLUP ought to do that already? More egregious and possibly indicating a logic error is where the bits to set were not including in the mask. Those cases should probably be looked at to confirm they are correct. For now, the new functions just call special cases of the setGpibState(), but could be re-implemented in a microcontroller/board specific way. E.g. the Teensy 3.1 I am working with has special registers available for setting/clearing bits for the various PORTs atomically.
I am interested in feedback on the approach, and any feedback on the apparent logic errors.
Request For Comment:
I was having trouble following the magic numbers in AR488_GPIBbus.cpp, so I rewrote the setGpibState() calls as simpler, easier to read inputCtrl(), outputCtrl(), assertCtrl() and clearCtrl() calls with defined foo_BIT values OR'd as indicated in the translated setGpibState() calls. I also noted where the values didn't make sense with a WHUT? comment. Setting a value for INPUTs might make sense to activate/disable pullups, but setting the pin as INPUT_PULLUP ought to do that already? More egregious and possibly indicating a logic error is where the bits to set were not including in the mask. Those cases should probably be looked at to confirm they are correct. For now, the new functions just call special cases of the setGpibState(), but could be re-implemented in a microcontroller/board specific way. E.g. the Teensy 3.1 I am working with has special registers available for setting/clearing bits for the various PORTs atomically.
I am interested in feedback on the approach, and any feedback on the apparent logic errors.