<?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: Encapsulating modules in spite of PE in Classic/Legacy CodeWarrior</title>
    <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Encapsulating-modules-in-spite-of-PE/m-p/170483#M3373</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;You could write your modularized source, gizmo_driver.c, thusly:&lt;BR /&gt;&lt;BR /&gt;// File: gizmo_driver.c&lt;BR /&gt;// Common stuff&lt;BR /&gt;// ...&lt;BR /&gt;#ifdef EXTRACT_EVENT_HANDLER_GIZMO&lt;BR /&gt;// Event handler for the gizmo device ...&lt;BR /&gt;// ...&lt;BR /&gt;#else&lt;BR /&gt;// Code for gizmo device other than event handler&lt;BR /&gt;// ...&lt;BR /&gt;#endif&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;Then, in Events.c, where the particular event handler would&lt;BR /&gt;be placed if modularization was not much of a concern:&lt;BR /&gt;&lt;BR /&gt;#define EXTRACT_EVENT_HANDLER_GIZMO&lt;BR /&gt;#include "gizmo_driver.c"&lt;BR /&gt;#undef EXTRACT_EVENT_HANDLER_GIZMO&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 09 Dec 2007 09:26:50 GMT</pubDate>
    <dc:creator>LarryBr</dc:creator>
    <dc:date>2007-12-09T09:26:50Z</dc:date>
    <item>
      <title>Encapsulating modules in spite of PE</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Encapsulating-modules-in-spite-of-PE/m-p/170482#M3372</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hello,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;While the Processor Expert allows to conveniently initialize and use peripherals, I have a problem with its coding convention. PE doesn't exactly encourage code modularity and encapsulation. For example, suppose that I want to write a higher-level serial communication module that knows how to send and receive blocks of data. To send more than one byte I have to use interrupts, but those appear in Events.c in PE's generated code. This means I have to break my module into two, one part being in Events.c, which at least recognizes the module and directs output to it.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;How is this handled ? Can someone provide tips on writing large scale, modular software, with PE at its base ?&lt;/DIV&gt;&lt;DIV&gt;Thanks in avance&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Dec 2007 19:16:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Encapsulating-modules-in-spite-of-PE/m-p/170482#M3372</guid>
      <dc:creator>eliben</dc:creator>
      <dc:date>2007-12-05T19:16:50Z</dc:date>
    </item>
    <item>
      <title>Re: Encapsulating modules in spite of PE</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Encapsulating-modules-in-spite-of-PE/m-p/170483#M3373</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;You could write your modularized source, gizmo_driver.c, thusly:&lt;BR /&gt;&lt;BR /&gt;// File: gizmo_driver.c&lt;BR /&gt;// Common stuff&lt;BR /&gt;// ...&lt;BR /&gt;#ifdef EXTRACT_EVENT_HANDLER_GIZMO&lt;BR /&gt;// Event handler for the gizmo device ...&lt;BR /&gt;// ...&lt;BR /&gt;#else&lt;BR /&gt;// Code for gizmo device other than event handler&lt;BR /&gt;// ...&lt;BR /&gt;#endif&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;Then, in Events.c, where the particular event handler would&lt;BR /&gt;be placed if modularization was not much of a concern:&lt;BR /&gt;&lt;BR /&gt;#define EXTRACT_EVENT_HANDLER_GIZMO&lt;BR /&gt;#include "gizmo_driver.c"&lt;BR /&gt;#undef EXTRACT_EVENT_HANDLER_GIZMO&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 09 Dec 2007 09:26:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Encapsulating-modules-in-spite-of-PE/m-p/170483#M3373</guid>
      <dc:creator>LarryBr</dc:creator>
      <dc:date>2007-12-09T09:26:50Z</dc:date>
    </item>
    <item>
      <title>Re: Encapsulating modules in spite of PE</title>
      <link>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Encapsulating-modules-in-spite-of-PE/m-p/170484#M3374</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Hello,&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;I do not use PE, and I&amp;nbsp;could quite possibly be missing your point.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;My&amp;nbsp;interpretation of&amp;nbsp;your specific&amp;nbsp;issue is that you wish to&amp;nbsp;keep the code for the&amp;nbsp;MCU derivative specific&amp;nbsp;component completely separate from the serial protocol&amp;nbsp;component.&amp;nbsp; Since circular (FIFO)&amp;nbsp;buffers are commonly used with interrupt driven SCI communications, I might consider that these global&amp;nbsp;buffers would provide a suitable common interface.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;The ISR code would know how to write to the receive buffer and read from the send buffer.&amp;nbsp; Conversely, the serial protocol code would read from the receive buffer, and write to the send buffer.&amp;nbsp; Is this what you mean by "encapsulation"?&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;I guess it depends on whether PE&amp;nbsp;can handle buffered communications using global arrays.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Regards,&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Mac&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 10 Dec 2007 00:59:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Classic-Legacy-CodeWarrior/Encapsulating-modules-in-spite-of-PE/m-p/170484#M3374</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2007-12-10T00:59:51Z</dc:date>
    </item>
  </channel>
</rss>

