- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello everybody
I have wiced sense kit and for example I want to use second button on the kit which is user button and want to get sound from buzzer
I look the kit shematics and learnt that user button is on Pin 4
In the firmware code GPIO_PIN_P4 is used for GPIO interrupt.
So how can I write the code that when user button is pressed make a sound
I tried simply this one ::::
if (GPIO_PIN_P4 == 1){
wiced_sense_short_beep_buzzer(100);
}
But didnt work. Can someone help me abouth that thanks a lot....
Solved! Go to Solution.
- Labels:
-
SDK 2.X
-
WICED Sense
- Tags:
- wiced sense
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It appears to me that pin 4 is the Wake button on the wiced sense. P0 is the pin which you should register the interrupt for.
To utilize the buzzer functions, you must register the buzzer pin in the GPIO configure table. The buzzer is on pin 13 on wiced sense.
Additionally, the easiest way to register an interrupt of a push button is by using the same GPIO configuration table as the buzzer. Your table should look like this:
const BLE_PROFILE_GPIO_CFG wiced_sense_gpio_cfg =
{
/*.gpio_pin =*/
{
GPIO_PIN_WP, // This need to be used to enable/disable NVRAM write protect
GPIO_PIN_BUTTON,
13, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 // other GPIOs are not used
},
/*.gpio_flag =*/
{
GPIO_SETTINGS_WP,
GPIO_SETTINGS_BUTTON,
GPIO_SETTINGS_BUZZER, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
}
};
In addition to registering the button as your interrupt, you also need to define the callback that will fire when the button is pressed.
Put this into your create function:
// register interrupt handler for button inputs.
bleprofile_regIntCb((BLEPROFILE_SINGLE_PARAM_CB) button_interrupt_handler);
And define and declare your function:
static void button_interrupt_handler(UINT8 value);
void button_interrupt_handler(UINT8 value)
{
// On press.
if (value & 1)
{
//call buzzer functionality here
}
}
Jacob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Could someone answer me please...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It appears to me that pin 4 is the Wake button on the wiced sense. P0 is the pin which you should register the interrupt for.
To utilize the buzzer functions, you must register the buzzer pin in the GPIO configure table. The buzzer is on pin 13 on wiced sense.
Additionally, the easiest way to register an interrupt of a push button is by using the same GPIO configuration table as the buzzer. Your table should look like this:
const BLE_PROFILE_GPIO_CFG wiced_sense_gpio_cfg =
{
/*.gpio_pin =*/
{
GPIO_PIN_WP, // This need to be used to enable/disable NVRAM write protect
GPIO_PIN_BUTTON,
13, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 // other GPIOs are not used
},
/*.gpio_flag =*/
{
GPIO_SETTINGS_WP,
GPIO_SETTINGS_BUTTON,
GPIO_SETTINGS_BUZZER, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
}
};
In addition to registering the button as your interrupt, you also need to define the callback that will fire when the button is pressed.
Put this into your create function:
// register interrupt handler for button inputs.
bleprofile_regIntCb((BLEPROFILE_SINGLE_PARAM_CB) button_interrupt_handler);
And define and declare your function:
static void button_interrupt_handler(UINT8 value);
void button_interrupt_handler(UINT8 value)
{
// On press.
if (value & 1)
{
//call buzzer functionality here
}
}
Jacob
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
For clarification...
Button 1: Logical Pin P0 (Firmware based pin) is connected to Physical Pin 28
Button 2: Logical Pin P4 (Firmware based pin) is connected to Physical Pin 32
Buzzer: Logical Pin P13 (Firmware based pin) is connected to Physical Pin 39
Thanks Jacob.