Is LED-port defineable?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Can the LED-port be defined (for 20737) when using bleprofile_LEDBlink() ?

Our board has the LED connected to P27.

The same question arrises for the button port.

0 Likes
1 Solution

You can do your LED declaration in the app_gpio_cfg as below (I extracted it from hello_sensor app):

/*.gpio_pin =*/

    {

    GPIO_PIN_WP,      // This need to be used to enable/disable NVRAM write protect

    GPIO_PIN_BUTTON,  // Button GPIO is configured to trigger either direction of interrupt

    GPIO_PIN_LED,     // LED GPIO, optional to provide visual effects

    GPIO_PIN_BATTERY, // Battery monitoring GPIO. When it is lower than particular level, it will give notification to the application

    GPIO_PIN_BUZZER,  // Buzzer GPIO, optional to provide audio effects

    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 // other GPIOs are not used

    },

Then you may use bleprofile_LEDBlink() in your app_create.

You can refer to the push_button_interrupt_LED or hello_sensor for reference.

View solution in original post

9 Replies
BoonT_56
Employee
Employee
500 likes received 250 likes received 100 likes received

Did you have a chance to review the below app?

push_button_interrupt_LED

Anonymous
Not applicable

No, I wasn't aware of that.

Now it works indeed. Thanks.

Unfortunately our LED is connected to ground. Is there way to invert the port logic?

I also tried to assign the button-port to P24, but that does not work. P24 is not set to input (pull-up)

0 Likes

You can try something like the below:

For LED

gpio_configurePin(27/16, 27%16, GPIO_OUTPUT_ENABLE, 1)

For button

{

UINT16 masks[3] = {0, (1<<11) , 0};

gpio_registerForInterrupt(masks, interrupt_handler, 0);

}

gpio_configurePin( 24/16, 24%16, GPIO_EN_INT_RISING_EDGE, GPIO_PIN_OUTPUT_LOW);

0 Likes
Anonymous
Not applicable

These both have no effect:

gpio_configurePin(27/16, 27%16, GPIO_OUTPUT_ENABLE, 1)

gpio_configurePin(27/16, 27%16, GPIO_OUTPUT_ENABLE, 0)

Your button example does work, thanks!

0 Likes

Are both your LED and button-press on the same gpio P24?

0 Likes
BoonT_56
Employee
Employee
500 likes received 250 likes received 100 likes received

I realized that you may not have access to the push_button_interrupt_LED app as it was not

included in the SDK. Let me know if the below blog helps.

How to Register for an Interrupt, Project 2 Wrap-Up

Anonymous
Not applicable

You are right.

I did a forum search and then found it.

0 Likes

You can do your LED declaration in the app_gpio_cfg as below (I extracted it from hello_sensor app):

/*.gpio_pin =*/

    {

    GPIO_PIN_WP,      // This need to be used to enable/disable NVRAM write protect

    GPIO_PIN_BUTTON,  // Button GPIO is configured to trigger either direction of interrupt

    GPIO_PIN_LED,     // LED GPIO, optional to provide visual effects

    GPIO_PIN_BATTERY, // Battery monitoring GPIO. When it is lower than particular level, it will give notification to the application

    GPIO_PIN_BUZZER,  // Buzzer GPIO, optional to provide audio effects

    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 // other GPIOs are not used

    },

Then you may use bleprofile_LEDBlink() in your app_create.

You can refer to the push_button_interrupt_LED or hello_sensor for reference.

Anonymous
Not applicable

Are both your LED and button-press on the same gpio P24?

No !

LED is P28

Button is P4

When using your LED suggestion, I see the system updating the LED port

frequently.

For a test I called this 2 seconds after startup:

gpio_configurePin(28/16, 28%16, GPIO_OUTPUT_ENABLE, 0)

And it then gets "corrected" by the system to 1 (LED lights up)

Note:

I want to use bleprofile_LEDBlink() and have it defined in gpio_cfg

0 Likes