<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Is there an example that shows an interrupt event striggering a background task? in MQX Software Solutions</title>
    <link>https://community.nxp.com/t5/MQX-Software-Solutions/Is-there-an-example-that-shows-an-interrupt-event-striggering-a/m-p/415075#M13846</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi David:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please check the following demo&lt;/P&gt;&lt;P&gt;C:\Freescale\KSDK_1.2.0\rtos\mqx\mqx\examples\event&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The event example code shows how a task waits for a event. This event can be set by any other process or interrupt in the system. The example simulates an IAR event using another simple task&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 29 Sep 2015 05:56:56 GMT</pubDate>
    <dc:creator>danielchen</dc:creator>
    <dc:date>2015-09-29T05:56:56Z</dc:date>
    <item>
      <title>Is there an example that shows an interrupt event striggering a background task?</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Is-there-an-example-that-shows-an-interrupt-event-striggering-a/m-p/415074#M13845</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am building a project that uses the KSDK with MQX on a FRDM-K22F platform. In this project there is an external interrupt that is to trigger a background task &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was wondering if there is an example that might show this specific arrangement.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've looked at the example in C:\Freescale\KSDK_1.2.0\rtos\mqx\mqx\examples\demo where Event A task uses an event flag to trigger the Event B task. This is fairly clear in that Event A just uses the MQX service time to kick it off. In my case, I need to be able to have the event flag be "visible" to the hardware interrupt routine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the pointers.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Sep 2015 18:59:22 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Is-there-an-example-that-shows-an-interrupt-event-striggering-a/m-p/415074#M13845</guid>
      <dc:creator>davepfaltzgraff</dc:creator>
      <dc:date>2015-09-28T18:59:22Z</dc:date>
    </item>
    <item>
      <title>Re: Is there an example that shows an interrupt event striggering a background task?</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Is-there-an-example-that-shows-an-interrupt-event-striggering-a/m-p/415075#M13846</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi David:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please check the following demo&lt;/P&gt;&lt;P&gt;C:\Freescale\KSDK_1.2.0\rtos\mqx\mqx\examples\event&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The event example code shows how a task waits for a event. This event can be set by any other process or interrupt in the system. The example simulates an IAR event using another simple task&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Sep 2015 05:56:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Is-there-an-example-that-shows-an-interrupt-event-striggering-a/m-p/415075#M13846</guid>
      <dc:creator>danielchen</dc:creator>
      <dc:date>2015-09-29T05:56:56Z</dc:date>
    </item>
    <item>
      <title>Re: Is there an example that shows an interrupt event striggering a background task?</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Is-there-an-example-that-shows-an-interrupt-event-striggering-a/m-p/415076#M13847</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Daniel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you read my third paragraph, you'll see that's where I started. The problem with this as an example is that the variable Event1_handle in the EventA code is defined locally and thus is not available anywhere else. In the case of an interrupt service routine, you do not want to be making a connection to the event every time there's an interrupt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I worked at this and came up with the attached code which is based on the Freescale MMA8453 accelerometer. I have placed all of the I2C code in a separate module, but this module shows the essence of what I wanted. The Motion_Handler() routine is a task that's kicked off in the main code. This calls a routine that initializes the MMA8453 into the state that I need - namely interrupt when motion over a certain amount is detected. This calls MotionInit() which sets up the event queue. Note that Motion_Handle is defined globally. This makes it accessible to the interrupt routine. After that's set up, then the Motion_Handler connects to the event with it's own handle and just waits. Since this handle is defined locally, this allows the Motion_Handler() routine itself to be moved to another module if necessary.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The interrupt routine at the top, PORTB_IRQ_Handler(), acknowledges the interrupt and then queues up the event. Note that the main-line program turns on/off the interrupt enable for this as required by the application.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The key point to the application is that Motion_Handle, which is set up by MotionInit() and used by PORTB_IRQ_Handler() must be defined so that both have access to this variable. Note: For better coding, it should be declared static to this module.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Sep 2015 15:46:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Is-there-an-example-that-shows-an-interrupt-event-striggering-a/m-p/415076#M13847</guid>
      <dc:creator>davepfaltzgraff</dc:creator>
      <dc:date>2015-09-29T15:46:25Z</dc:date>
    </item>
  </channel>
</rss>

