This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2530: how can i access gpio in cc2530?

Part Number: CC2530

hi 

i have this circuit

i connect a reed relay to pin 1.5 and puled it up with 1K resistor

now i want read it when it will trigger

what library should i include to do that?

what function?

  • You can refer to hal_key.c to know how to setup GPI interrupt service and send key event to application.
  • /* Interrupt option - Enable or disable */
    #define HAL_KEY_INTERRUPT_DISABLE    0x00
    #define HAL_KEY_INTERRUPT_ENABLE     0x01
    
    /* Key state - shift or nornal */
    #define HAL_KEY_STATE_NORMAL          0x00
    #define HAL_KEY_STATE_SHIFT           0x01
    
    #define HAL_KEY_SW_1 0x01  // Joystick up
    #define HAL_KEY_SW_2 0x02  // Joystick right
    #define HAL_KEY_SW_5 0x04  // Joystick center
    #define HAL_KEY_SW_4 0x08  // Joystick left
    #define HAL_KEY_SW_3 0x10  // Joystick down
    
    #define HAL_KEY_SW_6 0x20  // Button S1 if available
    #define HAL_KEY_SW_7 0x40  // Button S2 if available
    
    /* Joystick */
    #define HAL_KEY_UP     0x01  // Joystick up
    #define HAL_KEY_RIGHT  0x02  // Joystick right
    #define HAL_KEY_CENTER 0x04  // Joystick center
    #define HAL_KEY_LEFT   0x08  // Joystick left
    #define HAL_KEY_DOWN   0x10  // Joystick down
    
    /* Buttons */  
    #define HAL_PUSH_BUTTON_RIGHT  0x01  // Button right
    #define HAL_PUSH_BUTTON_LEFT   0x02  // Button left
    #define HAL_PUSH_BUTTON_SELECT 0x04  // Button select
    #define HAL_KEY_BUTTON_UP      0x40  // Button up
    #define HAL_KEY_BUTTON_DOWN    0x80  // Button down

    it is for some board that have joystick and button and etc

    they don't comment it to know which pin they r configured as like HAL_PUSH_BUTTON_RIGHT

    just see the codes that ridiculous .

    where is the port where is an individual pin? how can i know what pin they r talking about in this code

  • You can study SW6 related code.
  • its so confusing so so so confusing