cancel
Showing results for 
Search instead for 
Did you mean: 

WICED Smart Bluetooth

Anonymous
Not applicable

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....

0 Likes
Reply
1 Solution
Employee

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

View solution in original post

5 Replies
Anonymous
Not applicable

Could someone answer me please...

0 Likes
Reply
Employee

Is this still an issue?

raseyns

0 Likes
Reply
Anonymous
Not applicable

No this is allready fixed my problem.

Thanks for asking.

boont

Employee

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

View solution in original post

Moderator
Moderator

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.