Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Button not work in light-switch Server example for PCA10059

Dear

I have changed light_switch server example of " nrf5_SDK_for_Mesh_v4.0.0_src" from PCA10056 to PCA10059. All function of the code works well except button.

For button, I modified something below:

  1. pca10059.h

// There is only one button for the application

// as the second button is used for a RESET.

#define BUTTONS_NUMBER 4

 #define BUTTON_1       NRF_GPIO_PIN_MAP(1,6)

#define BUTTON_2       NRF_GPIO_PIN_MAP(1,2)

#define BUTTON_3       NRF_GPIO_PIN_MAP(1,5)

#define BUTTON_4       NRF_GPIO_PIN_MAP(1,3)

#define BUTTON_PULL    NRF_GPIO_PIN_PULLUP

 #define BUTTONS_ACTIVE_STATE 0

 #define BUTTONS_LIST { BUTTON_1,BUTTON_2,BUTTON_3,BUTTON_4, }

 #define BSP_BUTTON_0   BUTTON_1

#define BSP_BUTTON_1   BUTTON_2

#define BSP_BUTTON_2   BUTTON_3

#define BSP_BUTTON_3   BUTTON_4

 #define BSP_SELF_PINRESET_PIN NRF_GPIO_PIN_MAP(0,19)

 #define HWFC           true

 

  1. simple_hal.h

/** Boards with user buttons */

#define BUTTON_BOARD (defined(BOARD_PCA10059) || defined(BOARD_PCA10040) || defined(BOARD_PCA10028) || defined(BOARD_PCA10056) || defined(BOARD_PCA10100))

 

Building them was successful, Flashing the code to dongle was successful. When push the button(SW1) on dongle, nothing happened(In PCA10056, Push button1, the led should turn on or turn off)

 Did I miss anything or something wrong I did?

 

Thanks,

 

Di-Sheng

Parents Reply Children
  • Hi Anuprit

    Sorry for the late reply.

    The project light-switch server is for PCA10056. All of the 4 buttons in the board were connect to port0. The Port1 did not be  handled in the project.

    Main.c: The address NRF_GPIO  is point to the P0; change it to P1 in (maybe you need make a new one for P1)

    Simple_hal.h: add : #define BUTTON_BOARD (defined(BOARD_PCA10059) ||.....)

    pca10059.h : BUTTON_1       6     if you make NRF_GPIO or a new one point to P1

     you also can make Button 1-4 point the same pin with you do not change the button_number.

    That should works.

    Thanks,

    B,Rs

    Di-Sheng

Related