8 Replies Latest reply on Jul 17, 2015 12:14 PM by kwang Branched to a new discussion.

    access_tag_interrupt_handler

    userc_19002

      Hi

       

      I am trying to make a firmware for the WICED sense tag that only adv. when one of the buttons on the side is pressed. I have used the wizard to generate code that supports 'button' only. However the method 'access_tag_interrupt_handler' is only called when pressing the button and not when the button is depressed. Another thing is that the method is only called when pressing the lower button (named 'App Button') and not the top button (named 'Wake Button').

       

      This bring me down to the two questions:

      1. How can I get the app to react separately on both buttons?

      2. How can I get the app to react when one of the buttons is depressed?

        • 1. Re: access_tag_interrupt_handler
          jota_1939431

          Hello Thomas,

           

          Please use the hello_sensor.c as the appropriate app to start your development.

          Some functions of the Smart Designer did not produce code for the buttons

           

          1.  The first button is a Wake Button as the WICED Sense kit explains

          2.  The second button can be used as an Application button

          3.  Please see the WICED Sense Kit BLOG for further questions.

           

          The Schematics for WICED Sense Kit are located here: WICED Sense Reference Design Schematic (PDF)

           

          Hope this helps

          Thanks

          JT

          • 2. Re: access_tag_interrupt_handler
            userc_19002

            Hi JT,

             

            Thank you for your swift reply.

             

            I have now build and downloaded the 'hello sensor' and enabled the trace functionality. However I still cannot get the message for when the 'App Button' is DEpressed?

             

            Here is what I get when the app button is pressed:

             

            17:12:10 - hello_sensor_timeout(INT)But1:1 But2:0 But3:0

             

            17:12:10 - 48 65 6c 6c 6f 20 33 xcheck retCode = 00ADV start high: 000000000000

             

            17:12:10 - XH*handlerj0e 04 01 0a 20 00

             

            17:12:10 - blecm evt handlerj0e 04 01 06 20 00

             

            17:12:10 - blecm evt handler:*04 01 0a 20 00

             

            17:12:11 AppTimer(adv, conn) stopped: 1

             

            17:12:11 BLE_high_un_adv:timer(0)

             

            - nothing happens when I release the button, - just like I saw it in the Smart Designer generated code?

             

            Thanks,

            Thomas

            • 3. Re: access_tag_interrupt_handler
              BoonT_56

              I checked out the hello_sensor.c  on my tag3 and I was able to see the below when the sw1 is pressed once:

               

              11:53:00 - hello_sensor_timeout:381

              11:53:01 -

              11:53:01 - hello_sensor_timeout:382

              11:53:01 -

              11:53:01 - (INT)But1:1 But2:0 But3:0

              11:53:01 -

              11:53:01 - 48656c6c6f2031

              11:53:01 -

              11:53:01 -  permission check retCode = 00

              11:53:01 - ADV start high: 000000000000

              11:53:01 -

              11:53:01 -

              11:53:01 - blecm evt handler:

              11:53:01 - 0e04010a2000

              11:53:01 -

              11:53:01 - blecm evt handler:

              11:53:01 - 0e0401062000

              11:53:01 -

              11:53:01 - blecm evt handler:

              11:53:01 - 0e04010a2000

              11:53:01   AppTimer(adv, conn) stopped: 1

              11:53:01   BLE_high_un_adv:timer(0)

              11:53:02 - hello_sensor_timeout:383

              11:53:03 -

              11:53:03 - hello_sensor_timeout:384

              11:53:04 -

              11:53:04 - hello_sensor_timeout:385

               

               

              Can you try this out on a tag?

              • 4. Re: access_tag_interrupt_handler
                BoonT_56

                Any luck with your Sense kit?

                • 5. Re: access_tag_interrupt_handler
                  userc_19002

                  Hi Boont,

                   

                  The posted trace messages in my previous response outlines what happens when I press the 'App Button' using the 'hello sensor' source code.

                  I was of the understanding that I should get a call back to the 'hello_sensor_interrupt_handler method', when i am releasing the 'App Button'. however that might not be the case?

                   

                  reg.

                  TB

                  • 6. Re: access_tag_interrupt_handler
                    BoonT_56

                    Are you doing the above on a tag3 or sense board? I know some folks reported here that they can get tracing from the sense board, but it is not officially supported actually.

                    • 7. Re: access_tag_interrupt_handler
                      BoonT_56

                      So have you got a chance to try out on a tag3?

                       

                      userc_19002

                      • 8. Re: access_tag_interrupt_handler
                        kwang

                        Hi userc_19002,

                         

                        Don't know if you still have this problem but I have just created a short demo on using interrupts with with the WICED Sense.  In my video you can see that when I press the bottom button, the LED will flash, once from when I press the button and once for when I release.  In my code as you will see, I put for both both edges.  Similarly, you can register two difference interrupt handlers, one for rising one for falling.  Then in my video, I use the top button to beep the buzzer, again once for pressed and once for depress.

                         

                        Hope this helps,

                        Kevin

                         

                        void ble_tx_create(void){

                          bleprofile_GPIOInit(bleprofile_gpio_p_cfg);

                            bleprofile_Init(bleprofile_p_cfg);

                            gpio_configurePin(0, 0, GPIO_EN_INT_BOTH_EDGE, GPIO_PIN_OUTPUT_LOW);

                            gpio_configurePin(0, 4, GPIO_EN_INT_BOTH_EDGE, GPIO_PIN_OUTPUT_LOW);

                            //register for interrupts on pins 0 and 4 (push button)

                            {

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

                                 gpio_registerForInterrupt(masks1, interrupt_handler1, 0);

                                 UINT16 masks2[3] = {(1 << 4), 0 , 0};

                                 gpio_registerForInterrupt(masks2, interrupt_handler2, 0);

                            }

                        }

                         

                        void interrupt_handler1(void* parameter, UINT8 arg) {

                               bleprofile_LEDBlink (50, 50, 3);

                        }

                        void interrupt_handler2(void* parameter, UINT8 arg) {

                               bleprofile_BUZBeep(100);

                        }