<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>AN36 button state</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/933/an36-button-state</link><description>As far as I can see buttons_init() initializes GPIO and sets up button_event_handler().
button_event_handler() calls ble_lbs_on_button_change() and always set static uint8_t set_push to 1, which
is written to params.p_data and transferred to sd_ble_gatts_hvx</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 22 Nov 2013 11:52:29 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/933/an36-button-state" /><item><title>RE: AN36 button state</title><link>https://devzone.nordicsemi.com/thread/4490?ContentTypeID=1</link><pubDate>Fri, 22 Nov 2013 11:52:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9595d59a-5a1a-4d5c-94ad-11757a8e55d2</guid><dc:creator>Ole Morten</dc:creator><description>&lt;p&gt;I&amp;#39;m not sure I understand what you mean. The original question talks about the button_event_handler, which has not been mentioned anywhere before section 4.4.5. The service code itself makes no assumptions about anything, it just sends whatever value it got in.&lt;/p&gt;
&lt;p&gt;As I note in my answer, you&amp;#39;re correct that the application code makes an assumption, which as far as I can see is explained where the assumption is actually made in the document.&lt;/p&gt;
&lt;p&gt;In case either you or someone else stumbling upon this wanted different behavior, I thought it would be useful to include a quick note on how that could be achieved.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: AN36 button state</title><link>https://devzone.nordicsemi.com/thread/4489?ContentTypeID=1</link><pubDate>Wed, 20 Nov 2013 15:44:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a2e2fa9e-5484-4e75-9d8f-dce14f6ea734</guid><dc:creator>michurin</dc:creator><description>&lt;p&gt;&amp;quot;If you want to modify this to toggle at each edge of the button...&amp;quot;
No, I don&amp;#39;t. I did underscore the word assumption which is the root of my question and because I didn&amp;#39;t get to app_button() this discussion has to wait until that time.
Thank you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: AN36 button state</title><link>https://devzone.nordicsemi.com/thread/4488?ContentTypeID=1</link><pubDate>Wed, 20 Nov 2013 15:41:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fc96e22d-92f8-43d1-a54b-01c729c49a6d</guid><dc:creator>michurin</dc:creator><description>&lt;p&gt;Didn&amp;#39;t get to this(4.4.5) point yet...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: AN36 button state</title><link>https://devzone.nordicsemi.com/thread/4487?ContentTypeID=1</link><pubDate>Wed, 20 Nov 2013 15:40:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:927b3e96-b0f7-463b-84e6-591ba45ec8c5</guid><dc:creator>michurin</dc:creator><description>&lt;p&gt;Referring to the section 4.4.5  in the section 4.3.5 would be helpful&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: AN36 button state</title><link>https://devzone.nordicsemi.com/thread/4486?ContentTypeID=1</link><pubDate>Wed, 20 Nov 2013 14:27:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:66fe09c2-82f2-4899-9e72-62fb68b78271</guid><dc:creator>Ole Morten</dc:creator><description>&lt;p&gt;You&amp;#39;re correct that this will just toggle the state on every button press. This was a simplification that was done since app_button doesn&amp;#39;t give you an event on both edges of a press in the current SDK versions. It&amp;#39;s also noted in the text, right at the start of section 4.4.5:
&amp;quot;To finish the application, you need to define how to handle button presses. Use the app_button module that is part of the SDK for this. This module will give a callback each time the button is pressed, essentially making the characteristic toggle its state for each press.&amp;quot;&lt;/p&gt;
&lt;p&gt;If you want to modify this to toggle at each edge of the button press, the easiest way is to use app_gpiote instead of app_button, but this was deemed too much extra complexity for the application note, compared to the benefit it gives.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>