Post by obirobkenobi on Aug 13, 2020 14:33:17 GMT -5
For some of my builds I find it more convenient to have pulldown resistors on my buttons vs the default pullup resistors of the ProffieOS.
Reading up on capabilities of the Teensy and Proffieboard STM, this is perfectly do-able and would only require an alteration to the button.h file. Adding an extra argument with default declaration would make it backward compatible with all current code.
To use it the button definition in the config file would look something like this;
#ifdef CONFIG_BUTTONS Button PowerButton(BUTTON_POWER, powerButtonPin, "pow", false); // this has pulldown resistor Button AuxButton(BUTTON_AUX, auxPin, "aux", true); // this has pull up resistor Button Aux2Button(BUTTON_AUX2, aux2Pin, "aux2"); // this has pull up resistor by default when the argument is not given
#endif For my own branch of ProffieOS this works perfect. I will do a pull request to see if you are willing to incorporate this into the main branch..
In the current wiring diagram 1 side of your switches are connected to ground while the other side go to the Proffieboard inputs.
Sometimes it is more convenient to have the switches connected to 3.3V (or even Vbat), saving some wiring.
A switch is normally open, if the Proffie input would not pullup or pulldown, the input becomes floating (there are floating buttons defined in the OS, but you loose some of the functionality I believe). A floating input will read high or low randomly, and will trigger some strange behavior in your saber.
Having a Pullup on your input means it will read high when you do not press a button. When a button is pressed, you apply gnd to that input, and therefore it will read low. For inputs with pulldown, you have to apply 3.3v in order to make it read High. On Teensy's the inputs are 5V tolerant, so you could even use Vbat for the switches in that case. (On Proffieboard V2 all pins are 5V tolerant except for Data3 / blade3pin.)
vargose: Verso $45, Sabercore $30, DIYino $30, Golden Harvest $60, Proffie $45, CFX $85. Do you remember when the days when the Crystal focus was $150? Gotta love the sheer availability of options now.
May 17, 2021 9:31:59 GMT -5