Button on the custom board

Good Day!

I am trying to adapt the example from lesson number 4 (Data exchange in BLE, exercise 2) for use on my custom board.

The example uses the library "dk_buttons_and_leds". At the moment I don't understand how the program determines which button state should be sent via bluetooth to the smartphone. 

There is one button on my board (connected to pin 30) whose state I want to send to my smartphone. 

buttons {
		compatible = "gpio-keys";
		button0: button_0 {
			gpios = <&gpio0 30 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
			label = "Button 0";
		};
	};
	
	/* These aliases are provided for compatibility with samples */
	aliases {
	
		button0 = &button0;
	};

In the program code, the button is defined as:

#define USER_BUTTON DK_BTN1_MSK

I originally thought that DK_BTN1_MSK meant Button0 (DK_BTN2_MSK = Button1, DK_BTN3_MSK = Button2 ...) in the device tree, but as it turns out I was wrong. Because after changing button0 to button3 in the device tree -->

buttons {
		compatible = "gpio-keys";
		button3: button_3 {
			gpios = <&gpio0 30 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
			label = "Button 3";
		};
	};
	
	/* These aliases are provided for compatibility with samples */
	aliases {
		
		button3 = &button3;
	};

I didn't see any changes. The board still kept transmitting the value of my button to the phone. 

Please explain to me how to correctly define the button whose value I want to receive via bluetooth.

Thank you. 

Parents Reply Children
No Data
Related