CYW920721 bt_hs_spk_lib button assignments

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

cross mob
Anonymous
Not applicable

I am looking through the bt_hs_spk_lib library, and I was wondering where to go about assigning the different button roles to unique GPIO pins?

0 Likes
1 Solution
Zhengbao_Zhang
Moderator
Moderator
Moderator
250 sign-ins First comment on KBA 10 questions asked

Hi :

please take below steps as a reference.

1.  find headset_pro application sampe in wiced 6.1 release on 20719_b1 .

2.   find below defines in Heaset_button.c

/* Static button configuration */

static wiced_button_configuration_t app_button_configurations[] =

{

#if ( WICED_PLATFORM_BUTTON_COUNT > 0 )

    [ PLAY_PAUSE_BUTTON   ]     = { PLATFORM_BUTTON_1, BUTTON_CLICK_EVENT | BUTTON_LONG_DURATION_EVENT | BUTTON_VERY_LONG_DURATION_EVENT , 0 },

#endif

#if ( WICED_PLATFORM_BUTTON_COUNT > 1 )

    [ VOLUME_UP_BUTTON    ]     = { PLATFORM_BUTTON_2, BUTTON_CLICK_EVENT | BUTTON_LONG_DURATION_EVENT | BUTTON_VERY_LONG_DURATION_EVENT , 0 },

#endif

#if ( WICED_PLATFORM_BUTTON_COUNT > 2 )

    [ VOLUME_DOWN_BUTTON  ]     = { PLATFORM_BUTTON_3, BUTTON_CLICK_EVENT , 0 },

#endif

#if ( WICED_PLATFORM_BUTTON_COUNT > 3 )

    [ FORWARD_BUTTON      ]     = { PLATFORM_BUTTON_4, BUTTON_CLICK_EVENT | BUTTON_LONG_DURATION_EVENT | BUTTON_VERY_LONG_DURATION_EVENT, 0 },

#endif

#if ( WICED_PLATFORM_BUTTON_COUNT > 4 )

    [ BACK_BUTTON         ]     = { PLATFORM_BUTTON_5, BUTTON_CLICK_EVENT | BUTTON_LONG_DURATION_EVENT | BUTTON_VERY_LONG_DURATION_EVENT, 0 },

#endif

#if ( WICED_PLATFORM_BUTTON_COUNT > 5 )

[ MULTI_FUNCTION_BUTTON  ]     = { PLATFORM_BUTTON_6, BUTTON_CLICK_EVENT | BUTTON_LONG_DURATION_EVENT, 0 },

#endif

};

3.  check the real button assignment in platform_rev2.c or platform_rev1.c 

below is the real Pin assignment to the chip.

#define WICED_BUTTON1 (WICED_P00)

#define WICED_BUTTON2 (WICED_P06)

#define WICED_BUTTON3 (WICED_P02)

#define WICED_BUTTON4 (WICED_P10)

#define WICED_BUTTON5 (WICED_P04)

#define WICED_BUTTON6 (WICED_P34)

gpio_button_t platform_gpio_buttons[] =

{

    [PLATFORM_BUTTON_1] =

    {

        .polarity   = WICED_ACTIVE_HIGH,

        .gpio       = WICED_BUTTON1,

        .trigger    = IRQ_TRIGGER_BOTH_EDGES,

    },

    [PLATFORM_BUTTON_2] =

    {

        .polarity   = WICED_ACTIVE_HIGH,

        .gpio       = WICED_BUTTON2,

        .trigger    = IRQ_TRIGGER_BOTH_EDGES,

    },

    [PLATFORM_BUTTON_3] =

    {

        .polarity   = WICED_ACTIVE_HIGH,

        .gpio       = WICED_BUTTON3,

        .trigger    = IRQ_TRIGGER_BOTH_EDGES,

    },

    [PLATFORM_BUTTON_4] =

    {

        .polarity   = WICED_ACTIVE_HIGH,

        .gpio       = WICED_BUTTON4,

        .trigger    = IRQ_TRIGGER_BOTH_EDGES,

    },

    [PLATFORM_BUTTON_5] =

    {

        .polarity   = WICED_ACTIVE_HIGH,

        .gpio       = WICED_BUTTON5,

        .trigger    = IRQ_TRIGGER_BOTH_EDGES,

    },

    [PLATFORM_BUTTON_6] =

    {

        .polarity   = WICED_ACTIVE_HIGH,

        .gpio       = WICED_BUTTON6,

        .trigger    = IRQ_TRIGGER_BOTH_EDGES,

    },

};

View solution in original post

0 Likes
2 Replies
Zhengbao_Zhang
Moderator
Moderator
Moderator
250 sign-ins First comment on KBA 10 questions asked

Hi :

please take below steps as a reference.

1.  find headset_pro application sampe in wiced 6.1 release on 20719_b1 .

2.   find below defines in Heaset_button.c

/* Static button configuration */

static wiced_button_configuration_t app_button_configurations[] =

{

#if ( WICED_PLATFORM_BUTTON_COUNT > 0 )

    [ PLAY_PAUSE_BUTTON   ]     = { PLATFORM_BUTTON_1, BUTTON_CLICK_EVENT | BUTTON_LONG_DURATION_EVENT | BUTTON_VERY_LONG_DURATION_EVENT , 0 },

#endif

#if ( WICED_PLATFORM_BUTTON_COUNT > 1 )

    [ VOLUME_UP_BUTTON    ]     = { PLATFORM_BUTTON_2, BUTTON_CLICK_EVENT | BUTTON_LONG_DURATION_EVENT | BUTTON_VERY_LONG_DURATION_EVENT , 0 },

#endif

#if ( WICED_PLATFORM_BUTTON_COUNT > 2 )

    [ VOLUME_DOWN_BUTTON  ]     = { PLATFORM_BUTTON_3, BUTTON_CLICK_EVENT , 0 },

#endif

#if ( WICED_PLATFORM_BUTTON_COUNT > 3 )

    [ FORWARD_BUTTON      ]     = { PLATFORM_BUTTON_4, BUTTON_CLICK_EVENT | BUTTON_LONG_DURATION_EVENT | BUTTON_VERY_LONG_DURATION_EVENT, 0 },

#endif

#if ( WICED_PLATFORM_BUTTON_COUNT > 4 )

    [ BACK_BUTTON         ]     = { PLATFORM_BUTTON_5, BUTTON_CLICK_EVENT | BUTTON_LONG_DURATION_EVENT | BUTTON_VERY_LONG_DURATION_EVENT, 0 },

#endif

#if ( WICED_PLATFORM_BUTTON_COUNT > 5 )

[ MULTI_FUNCTION_BUTTON  ]     = { PLATFORM_BUTTON_6, BUTTON_CLICK_EVENT | BUTTON_LONG_DURATION_EVENT, 0 },

#endif

};

3.  check the real button assignment in platform_rev2.c or platform_rev1.c 

below is the real Pin assignment to the chip.

#define WICED_BUTTON1 (WICED_P00)

#define WICED_BUTTON2 (WICED_P06)

#define WICED_BUTTON3 (WICED_P02)

#define WICED_BUTTON4 (WICED_P10)

#define WICED_BUTTON5 (WICED_P04)

#define WICED_BUTTON6 (WICED_P34)

gpio_button_t platform_gpio_buttons[] =

{

    [PLATFORM_BUTTON_1] =

    {

        .polarity   = WICED_ACTIVE_HIGH,

        .gpio       = WICED_BUTTON1,

        .trigger    = IRQ_TRIGGER_BOTH_EDGES,

    },

    [PLATFORM_BUTTON_2] =

    {

        .polarity   = WICED_ACTIVE_HIGH,

        .gpio       = WICED_BUTTON2,

        .trigger    = IRQ_TRIGGER_BOTH_EDGES,

    },

    [PLATFORM_BUTTON_3] =

    {

        .polarity   = WICED_ACTIVE_HIGH,

        .gpio       = WICED_BUTTON3,

        .trigger    = IRQ_TRIGGER_BOTH_EDGES,

    },

    [PLATFORM_BUTTON_4] =

    {

        .polarity   = WICED_ACTIVE_HIGH,

        .gpio       = WICED_BUTTON4,

        .trigger    = IRQ_TRIGGER_BOTH_EDGES,

    },

    [PLATFORM_BUTTON_5] =

    {

        .polarity   = WICED_ACTIVE_HIGH,

        .gpio       = WICED_BUTTON5,

        .trigger    = IRQ_TRIGGER_BOTH_EDGES,

    },

    [PLATFORM_BUTTON_6] =

    {

        .polarity   = WICED_ACTIVE_HIGH,

        .gpio       = WICED_BUTTON6,

        .trigger    = IRQ_TRIGGER_BOTH_EDGES,

    },

};

0 Likes
DilliS_01
Employee
Employee
100 sign-ins 50 questions asked 50 sign-ins

Hi Alejandro - I will message you directly on this question.

Thanks,
Dilli

0 Likes