Multiple blade detect, for crossguard hilts

Could 3 discrete pins trigger detection?
Would something like this (probably not like this exactly) in ProffieOS be feasible without stepping on each other somewhere else?

#ifdef BLADE1_DETECT_PIN
LatchingButtonTemplate<FloatingButtonBase<BLADE1_DETECT_PIN>>
    BladeDetect(BUTTON_BLADE_DETECT, BLADE1_DETECT_PIN, "blade_detect");
#endif

#ifdef BLADE2_DETECT_PIN
LatchingButtonTemplate<FloatingButtonBase<BLADE2_DETECT_PIN>>
    BladeDetect(BUTTON_BLADE_DETECT, BLADE2_DETECT_PIN, "blade_detect");
#endif

#ifdef BLADE3_DETECT_PIN
LatchingButtonTemplate<FloatingButtonBase<BLADE3_DETECT_PIN>>
    BladeDetect(BUTTON_BLADE_DETECT, BLADE3_DETECT_PIN, "blade_detect");
#endif
1 Like

First of all, you’ll get a syntax error if you don’t change the names of the objects. (BladeDetect)
If they were called BladeDetect1, BladeDetect2 & BladeDetect3, it would compile.

However, the NO_BLADE thingy isn’t going to work unless you define BLADE_DETECT_PIN, which has some code elsewhere.

Also, the NO_BLADE thingy is going to be kind of confused if all your blade-detect-butons all sends BUTTON_BLADE_DETECT events. However, you could make the other two blades sends some different button, which your prop could then react to in some different way.

I got this working with pins 8,9,22 (RX,TX,BTN3), had a question about what pins could be used for blade detect if I’m also using bluetooth. Could SWDCLK/IO be repurposed for this? They don’t have pin numbers listed on the board layout, and I know they are typically reserved for debugging with a ST-LINK device.

While not impossible, the current arduino-proffieboard plugin does not support using the SWD* pins for anything but debugging. Generally, all the data pins, buttons pins and rx/tx can be used.
On the V3 board, SWDIO, SWDCLK and RESET have been moved to the bottom of the board to make more for other, more useful, pads.