Common code features

This is the version V1.0 of the document accompanying each demo code

Project structure

Each of the Copperduino demo project presented here are architectured following a similar scheme.

In MPLAB, the source code files are located in "Source Files" and "Header Files".
In both folders, you will find a set of subfolders:

  • Application: contains files related to the application logic. Some of these are present is each project, but with a dedicated content.
    • CLC_Customization.h (header file): this can be used to enable/disable individual CHAILink Client features.
      It might be useful to reduce the CHAILink Client footprint removing unused code. The CHAILink Client configuration is dynamic, so dead code stripping may be unefficient. Code reduction is desirable if you intend to migrate to a commercial product and want the smallest flash size possible in order to reduce the chip cost.
    • AppCallbacksMapping: this file is used to map callback functions depending on the application needs.
      It might seem complicated due to the set of "#if defined", but the callback mapping structures definition depends on features enabled in CLC_Customization.h. You might find it easier to enable all the defines in CLC_Customization.h and remove all "#if" in AppCallbacksMapping.
    • AppCallbacks: this is the usual place where to implement callbacks. In some demos, it is the sole callback location. In more complex examples, such as those handling multiple inputs, this file implements code that switches between the dedicated notification handlers located in other files. For instance, the DMX application exposes three inputs, each one being handled by code located in "Input*" source files. There is only one CLC callback for a given feature, but a calling argument allows the AppCallbacks code to reconcile it with the appropriate notification handler.
    • AppDataConfig: this is where working and settings data is managed.
    • AppEngine: contains the application main logic. It is where the CopperLan objects are created at application startup.
    • user.c: the file hosting the initialization and doprocess code. It is also there that you can choose between USB or Ethernet communication.
  • CHAILinkClient: contains the CHAILink Client source code. It must remain strictly unmodified, except in case of official file upgrade provided by CopperLan.
  • Firmware: platform specific code.
    • ArduinoMapper: this code offers a set of Arduino-like functions to ease the usage of I/Os and Analog interfacing. It will evolve according to the fortcoming demos needs.
    • HAL: this is the Hardware Abstraction Layer, complementary to the ArduinoMapper.
    • main.c: no comments ;-)
    • PerfCounter: PIC32 implementation of a 1ms system timer.
  • UARTTransport: contains the Transport source code used when the CopperLan chip (Ethernet communication) is selected. It must remains unchanged, except in case of file upgrade provided by the CopperLan team.
  • USB Stack: contains the USB stack provided by Microchip. Do not modify.
  • USBTransport: contains the Transport source code used when USB communication is selected. It must remain unchanged, except in case of official file upgrade provided by CopperLan.

Depending on the shield used, some projects also include a folder that contains a shield-dedicated driver code.



Disclaimer

The source code is provided as is. The way it is coded and the documentation may evolve depending on the users feedback/requirements. Support is provided through the forum, Copperduino section, in order to benefit to the whole community.
Do not hesitate to post questions, issue reporting, suggestions, and anything that could help us to make it going easier to understand and to use.


Legal aspects

All you need to know about Copperduino Legal aspects

Install CopperLan

Visit our forum

Give us your feedback and share your knowledge with the community