• Join
  • Sign In with my.TI Login
Texas Instruments
  • Products
  • Applications
  • Tools & Software
  • Support & Community
  • Sample & Buy
  • About TI
Sample & Purchase Cart Sample & Purchase Cart
  • Search
  • Advanced
TI E2E™ Community
  • Support Forums
  • Blogs
  • Groups
  • Videos
  • 简体中文
  • More ...
TI Home » TI E2E Community » Support Forums » Low Power RF & Wireless Connectivity » Low Power RF Bluetooth® Low Energy & ANT Forum » Keyfob press & hold
Share
Low Power RF & Wireless Connectivity
  • Forums
  • Announcements
  • Files
  • E2E Wiki
Options
  • Subscribe via RSS

Keyfob press & hold

Keyfob press & hold

This question is answered
1960865
Posted by 1960865
on Feb 22 2012 07:05 AM
Intellectual775 points

Hello

Is there a how to implement keyfob press & hold for some time to cause an event.  Example, user press & hold the left button for 5 sec to do something.  I am using the keyfob application demo. I am looking for a practical design or approach. Please avoid philosophical answers that helps no one.  

I am aware that I need to start some timer when key pressed and stop timer when key is released, though not sure how to do using with OSAL architecture.

thanks in advance

~LD

Report Abuse
  • Reply
You have posted to a forum that requires a moderator to approve posts before they are publicly available.
All Replies
  • Willis1
    Posted by Willis1
    on Feb 24 2012 12:59 PM
    Verified Answer
    Verified by 1960865
    Expert8185 points

    The key to doing this will be to set an OSAL event in keyfobapp_HandleKeys using osal_start_timerEx for five seconds in the future after the left button is pressed. If the key is released (which you would also know because keyfobapp_HandleKeys would get called) then you would stop the timer using osal_stop_timerEx. If the OSAL event gets triggered five seconds after it started, that means that the key was never released. You can then trigger the action that you want.

    Sorry if this is too much of a "philosophical answer", but unfortunately I don't really have the time to write the code for you, but I believe that all the information needed to implement this can be found in the SW developer's guide.

    Maybe someone else who has written something similar can share their code?

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • kazola
    Posted by kazola
    on Feb 24 2012 16:08 PM
    Guru10665 points

    Hi,

    I do not think people is wishing to share the code when someone is asking for this that rude.

    Anyway, it can be done in less than 5 lines of code.



    Please click the     Verify Answer     button on a post if it answers your question! :)

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • 1960865
    Posted by 1960865
    on Feb 27 2012 15:44 PM
    Intellectual775 points

    Wills Thanks for your reply. I was not looking for code snippet or freebies. I was merely asking for design (code is an implementation of a design).  That said, what you have indicated is good start; though is not good design as if I press and hold the key, then I insert the battery inside the keyfob then release the key; the entire logic will be inverted as these events are not based on input level state (ie iput is High or Low).  I did some reverse engineer of Hal code to see if I can get the input state (that caused the event) but was not able to see where/how.  This is where I am looking for help but I guess it was not as clear in my original question.

    I want to start the timer when on falling edge, and release timer on rising edge <inverse if input is active high> . The way to do this is get the edge of the input state and compare to previous state >>> logic is easy...

    PS, I did not intend to offend anyone by my remarks of "philosophical answer". I was looking for practical approach on how to design/function call for what I needed to do. The reason for this remarks was due from previous posts/forums where I was being asked to verify an ans people where replying with academic answers as oppose to how-to.

    thanks

    ~LD

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • kazola
    Posted by kazola
    on Feb 27 2012 16:36 PM
    Guru10665 points

    Wednesday I have a demo for which I need the CC2540MiniDK. After this, if your issue is not solved we can try to go through this together :)

    It is not a difficult thing.



    Please click the     Verify Answer     button on a post if it answers your question! :)

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • 1960865
    Posted by 1960865
    on Feb 28 2012 13:06 PM
    Intellectual775 points

    Kazola / Willis

    I got it.. I will post the code for others to use once I clean up few things.

    thanks
    ~LD 

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • kazola
    Posted by kazola
    on Feb 28 2012 16:37 PM
    Guru10665 points

    :)

    That's nice. You can even add a wiki entry like "first steps" or "first example program" in CC2540, cannot you?



    Please click the     Verify Answer     button on a post if it answers your question! :)

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Fred Visticot
    Posted by Fred Visticot
    on Mar 09 2012 04:02 AM
    Intellectual670 points

    Can you please share the code, it could be very helpful !

    -Fred

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • 1960865
    Posted by 1960865
    on Mar 12 2012 09:26 AM
    Intellectual775 points

    Fred

    Checkout my profile and see files: http://e2e.ti.com/members/1960865/files/default.aspx

    ~LD

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • 1960865
    Posted by 1960865
    on Mar 23 2012 07:25 AM
    Intellectual775 points

    did the code worked out for you? Verify if so....

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
TI E2E™ Community
  • Support Forums
  • Blogs
  • Videos
  • Groups
  • Site Support & Feedback
  • Settings
TI E2E™ Community Groups
  • TI University Program
  • Make the Switch
  • Microcontroller Projects
  • Motor Drive & Control
Other Communities
  • Deyisupport
  • Designsomething.org
  • beagleboard.org
  • TI on Element 14
  • TI on TechXchangeSM
Other Technical & Support Resources
  • WEBENCH® Design Center
  • Product Information Centers
  • Technical Documents
  • TI Design Network
  • TI Technical Articles
  • TI Training

All content and materials on this site are provided "as is". TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with regard to these materials, including but not limited to all implied warranties and conditions of merchantability, fitness for a particular purpose, title and non-infringement of any third party intellectual property right. TI and its respective suppliers and providers of content make no representations about the suitability of these materials for any purpose and disclaim all warranties and conditions with respect to these materials. No license, either express or implied, by estoppel or otherwise, is granted by TI. Use of the information on this site may require a license from a third party, or a license from TI.

Content on this site may contain or be subject to specific guidelines or limitations on use. All postings and use of the content on this site are subject to the Terms of Use of the site; third parties using this content agree to abide by any limitations or guidelines and to comply with the Terms of Use of this site. TI, its suppliers and providers of content reserve the right to make corrections, deletions, modifications, enhancements, improvements and other changes to the content and materials, its products, programs and services at any time or to move or discontinue any content, products, programs, or services without notice.

Follow Us Texas Instruments on Facebook Texas Instruments on Twitter Texas Instruments on LinkedIn Texas Instruments on Google+
TI Worldwide | Contact Us | my.TI Login | Site Map | Corporate Citizenship | mobile m.ti.com (Mobile Version)

TI is a global semiconductor design and manufacturing company. Innovate with 100,000+ analog ICs and
embedded processors, along with software, tools and the industry’s largest sales/support staff.

© Copyright 1995-2013 Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy Policy | Terms of Use