Quote:
The library to use is called DebounceIn. It looks strangely like something that SHOULD BE IN THE CORE LIBRARY!!!
Lots of stuff you could debate about if it should be in the core library. One of strong points of mbed are the easy to import user libraries. Now if only the mbed staff would realise that, and give a crap about the community, that would be great.
Quote:
I should not have to look for a 3rd-party library for an internal pull-up resistor
You don't need 3rd party lib for that, official mbed lib can do it fine.
Quote:
At $150/hr, it took me over $1000 to write my algorithm because I require faster response time so I can shut off this really strong electromagnet before someone gets electrocuted or something really expensive breaks. I CAN'T JUST POLL THE SWITCH OR SOMEONE COULD DIE!!! 20ms IS A REALLY LONG TIME!!! The DebounceIn library will work for a prototype, but my machine cannot be UL listed without a robust DebounchIn class or spending money (i.e. my profits) on a hardware debounce circuit.
Debouncein uses a default of 1ms, not 20ms, and you can easily change it. It shouldn't have taken you 7 hours to find the set_debounce_us function.
Also obviously I don't know your exact use case, but you do realise debouncing is only required when you toggle/increment/etc something on the press of a button? Lets say you have a big red emergency button, then there is no need to debounce it. Just connect an interrupt to it, and if that is fired, immediatly disable the circuit which can eletrocute people.
Also what you describe sounds like a low volume, high margin device. Now as IC designer I know that customers get really happy if they have to use one less capacitor. However that is for high volume, low margin stuff. I would expect that with equipemnt with strong eletromagnets that can eletrocute people you could afford a few passives in your circuit. (Which you are going to need anyway for reliability).
Also on a side note: For 700 dollar I write you a debounce lib exactly according to your specs.
Quote:
Other buttons are low-priority and we can let the switch stop bouncing before processing the event.
On most MCUs this is not possible with the generic port interrupts. I would advice you to use for example if you use a Freescale MCU to use the NMI instead for your emergency switch. And don't debounce it, seriously. First shut off your life threatening device.
Hi,
As a re-entrant in the field of MBedded hardware after 20 odd years i was adviced by some friends to switch to the MBED platform. I'm glad they did, since its a wonderfull board to work with :)
The first project i'm using MBED for, uses 14 switches. And as we all know there are some really crappy switches out there, so I searched for a debounce setting in the DigitalIn LIB, and was surprised something as basic as that is not part of the MBED / NXP LIB's.
Why not add it to the LIB? It would even more simplify projects :)
Keep up the good work guys, i'm loving this board to death :)
Theo (nl)