- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Solved! Go to Solution.
- Labels:
-
GPIO
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Did you have a chance to review the below app?
push_button_interrupt_LED
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Are both your LED and button-press on the same gpio P24?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You are right.
I did a forum search and then found it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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