• 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 Hardware & Tools Forum » Using the joystick on the SmartRF05 board when a peripheral application
Share
Low Power RF & Wireless Connectivity
  • Forums
  • Announcements
  • Files
  • E2E Wiki
Options
  • Subscribe via RSS

Using the joystick on the SmartRF05 board when a peripheral application

Using the joystick on the SmartRF05 board when a peripheral application

This question is not answered
Timothy Mulrooney
Posted by Timothy Mulrooney
on Mar 23 2012 13:40 PM
Prodigy175 points

Problem
I have the CC2540 development boards. These are working beautifully with all of the examples. so far. I am trying to create a peripheral application that uses the joystick. I have copied the simpleBLEPeripheral application and it is working perfectly as the simple BLE peripheral application. However the joystick seems to operate strangely. I tried to copy the correct setup and initialization from the simpleBLECentral example since it uses the joystick correctly. I have attached the output in the steps to recreate the problem.

summary:

I have added the register for keys in the init function

I have added a print statement in KEY_CHANGE handler

after a reset I get two KEY change events. The first is the correct joystick movement (left, right, etc.) and the second is a KEY_CHANGE event of 0. at this point all joystick touches are ignored except UP. that causes two KEY_CHANGE events. the first being UP event and the second being a 0. The UP position on the joystick will work forever with two change events but no other KEY_CHANGE events are seen.

In addition when I hit the joystick I am disconnected if I have  BLE connection active.

I am sure there is something simple that I overlooked. Any help would be appreciated. I need to simulate a peripheral application where various buttons/switches are toggled.  I want to keep the connections alive and just respond to the joystick in the peripheral application like the central application does.

********* example output ************

shift: 0 keys: 08   <-- after a reset first hit of joystick LEFT (or any other joystick position) causes two KEY_CHANGE events seen here
shift: 0 keys: 00

after this the only KEY_CHANGE event is joystick UP
this causes two KEY_CHANGE events as shown below
all other hits on joystick do not cause a KEY_CHANGE event

shift: 0 keys: 01
shift: 0 keys: 00



***** KEY Handling ****
static void IC2MBLEPeripheral_HandleKeys( uint8 shift, uint8 keys )
{
  VOID shift;  // Intentionally unreferenced parameter

  printf("shift: %d keys: %02X\n",shift,keys);

    if(keys & HAL_KEY_UP)
    {
    }

    if(keys & HAL_KEY_LEFT)
    {
    }

    if(keys & HAL_KEY_RIGHT)
    {
    }

    if(keys & HAL_KEY_DOWN)
    {
    }

    if(keys & HAL_KEY_CENTER)
    {
    }

}

************** added to init function ******
  // Register for all key events - This app will handle all key events
  RegisterForKeys( IC2MBLEPeripheral_TaskID );

Report Abuse
  • Reply
You have posted to a forum that requires a moderator to approve posts before they are publicly available.
All Replies
  • yeol park
    Posted by yeol park
    on Jul 03 2012 23:50 PM
    Prodigy30 points

    I have same problem. Amazingly equal my situation.

    in the disconnect state, it work correctly.

    But when the connect state, problem is occured.

    someone help us would be grateful.

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Igor Sherer
    Posted by Igor Sherer
    on Jul 04 2012 04:13 AM
    Guru21965 points

    Hi Guys,

    I'm not familiar with BLE stack, but I do familiar with smartRF05EB and with cc253x/4x family

    of devices in general. I have one question to you, just out of curiosity, the printf() function, in

    Tymothy's post, have you added it, or it already was there as a part of a BLE sample project?

    My point is, I'm not sure the printf() will work in this case since the output device is LCD, with

    ready API functions (hal_lcd module), moreover, using printf() may result in an unknown, or

    unexplained, behavior.

    Br,

    Igor

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • yeol park
    Posted by yeol park
    on Jul 04 2012 05:15 AM
    Prodigy30 points

    I doesn't use printf() .  Using HAL_LCD API, I plotted joystick's status on LCD.

    here is my code. I can't find my mistake.

    if ( keys & HAL_KEY_UP )
    {
    if ( toggle1 == 1 ){
    toggle1 = 0;
    toggle2 = 0;
    HalLcdWriteStringValue( "STOP 0 ", 0, 10, HAL_LCD_LINE_2 );
    }
    else if ( toggle1 == 0 ){
    toggle1 = 1;
    toggle2 = 0;

    HalLcdWriteStringValue( "SEND 0 :", 1, 10, HAL_LCD_LINE_2 );
    }
    }

    if ( keys & HAL_KEY_LEFT )
    {
    if ( toggle2 == 1 ){
    toggle1 = 0;
    toggle2 = 0;
    HalLcdWriteStringValue( "STOP 1 ", 0, 10, HAL_LCD_LINE_2 );
    }
    else if ( toggle2 == 0 ){
    toggle1 = 0;
    toggle2 = 1;
    HalLcdWriteStringValue( "SEND 1 :", 1, 10, HAL_LCD_LINE_2 );
    }
    }

    Report Abuse
    • Reply
    You have posted to a forum that requires a moderator to approve posts before they are publicly available.
  • Timothy Mulrooney
    Posted by Timothy Mulrooney
    on Jul 04 2012 17:42 PM
    Prodigy175 points

    I have resolved my issue. I had the battery service and the joystick enabled at the same time.

    There was a conflict. printf should work also. I have used them but they do take time and will disconnect if there are many printfs or a long printf.

    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