g0orx / pihpsdr

Raspberry Pi standalone code for HPSDR (Protocol 1 and Protocol 2)
GNU General Public License v2.0
110 stars 73 forks source link

Enable controlling toolbar buttons with MIDI #132

Open markusgrosser opened 3 years ago

markusgrosser commented 3 years ago

This also moves parts of toolbar control from gpio.c to ext.{c,h}, so that it can be used by midi3.c without duplicating everything.

dl1ycf commented 3 years ago

DL1YCF's comment: This looks useful, although I generally do not prefer calling callback functions from outside. But avoiding this would imply a major re-write of toolbar.c (creating separate functions, callable from outside, for doing the work, and calling them from the callbacks).

Unifying the MIDI and GPIO code is desirable in any case, but this would also imply a major re-write, since the code is compiled with MIDI but without GPIO on many machines. So GPIO alerts and the "real work done" must be separated to have the "real work" also done via MIDI. Just to give one example, vfoFunctionAlert() must remain in gpio.c, but vfo_function_pressed must be moved elsewhere in this case.

This is, in short, the reason why many of the GPIO functions have no counterpart in MIDI.