ΣSigmaStudio Ask AI Русский Log in

Dual Function momentary push button for short and long press

SigmaDSP & SigmaStudio DaveThib Sep 3, 2024 00:00 1 replies Original on forum ↗
Subscribe
DaveThib Question
Sep 3, 2024 00:00

Hello SigmaDSP Community

I was asked to solve a problem last week and I do not think the solution is anywhere on the forum. There is one post that is close but not exact.

The problem is this:

Have a momentary pushbutton work in two different ways depending on how long it is pressed.

For a short press it will latch on. and then another short press it will latch off. So a short press is a toggle function.

For a long press, it will be on as long as it is held down but then when released the signal will shut off.

Basically, this is for an intercom or similar function. The person who asked me wanted it for a recording studio type of application where you want to talk to someone in the other room. A quick press and you can talk as long as you want and then another quick press closes the connection.

However, if you press and hold it you can talk but when you release the button it will shut off the connection.

Two different behaviors based on how long you hold the button.

Dave T

Audio Signal Processors

software

SigmaStudio Rev 4.7

SigmaDSP Audio Processors

adau1701

DaveThib Reply
Sep 3, 2024 00:00

Here is the solution.

Note that this solution will work for pretty much all the SigmaDSP cores. It will have to be built from a blank project but the blocks are all standard.

I had set the hold time to two seconds which is a little long, I think 1.5 seconds might be better. It is easy to change. Just change the number of samples it counts to.

This was a little tricky to write but it works. There might be other solutions and with the Sigma300 core there are a few more tricks that could be done to simplify this.

Have a look:

ADAU1701 GPIO momentary to Latch long press for mom-2.dspproj

Dave T