Add Code and Header Files

To add a file,

  • Call the menu File > New > New File... or press Cmd+N.

  • Select the macOS option.

  • Scroll down and look for the embedXcode or embedXcode+ group.

  • Select one of the options proposed, one per framework.

The Task Energia MT is described in the next section.

Add a C++ Code File or Library

Based on the options selected during the installation, the embedXcode group of templates include different options.

The C++ Code provides a standard C++ file and optionally, adds a header file and creates a library.

The C++ code file and library is available for two frameworks, the Wiring / Arduino framework and the mbed framework.

embedXcode+ provides more options for the C++ File Cosa, C++ File Edison Yocto and C File Edison MCU, based on the options selected during the installation

The second window asks for the name and the option for a header file.

  • Enter the Name of the C++ code file.

As a general rule and as for the standard IDEs,

  • Avoid space and special characters in the files Name field.

However, embedXcode manages the entered name and transforms it into a legal C-style name. The header file comes with the #include pre-processing statements.

Optionally on embedXcode+,

Provide a Description of the file.

On all versions,

  • Optionally, check the box Include a header file to create an associated header file and obtain a library.

  • Click Next.

  • Proceed to Save the New File.

Add a Header File

The Header File option is a standard file.

The second window asks for the name and the optional header file.



  • Enter the Name of the header file.

As a general rule and as for the standard IDEs,

  • Avoid space and special characters in the files Name field.

Optionally on embedXcode+,

  • Provide a Description of the header.

On all versions, the header can be adapted to the framework.

  • Select Default for all the boards running on the Wiring / Arduino framework.

On embedXcode+,

  • Select Edison Yocto for the Intel Edison board running on Yocto.

  • Select Edison MCU for the Intel Edison board running on the MCU.

  • Click Next.

  • Proceed to Save the New File.

The header file comes with the #include pre-processing statements for the selected platform.

Below, the header file for the Wiring / Arduino framework.

///
/// @file       newHeader.h
/// @brief      Header
/// @details    Description of the file
/// @n
/// @n @b       Project embed1
/// @n @a       Developed with [embedXcode+](https://embedxcode.weebly.com)
///
/// @author     Rei Vilo
/// @author     http://embeddedcomputing.weebly.com
///
/// @date       sept. 30, 2017 11:07
/// @version    <#version#>
///
/// @copyright  (c) Rei Vilo, 2017
/// @copyright  <#licence#>
///
/// @see        ReadMe.txt for references
///

// Core library for code-sense - IDE-based
#if defined(WIRING) // Wiring specific
#include "Wiring.h"
#elif defined(MAPLE_IDE) // Maple specific
#include "WProgram.h"
#elif defined(ROBOTIS) // Robotis specific
#include "libpandora_types.h"
#include "pandora.h"
#elif defined(MPIDE) // chipKIT specific
#include "WProgram.h"
#elif defined(DIGISPARK) // Digispark specific
#include "Arduino.h"
#elif defined(ENERGIA) // LaunchPad specific
#include "Energia.h"
#elif defined(LITTLEROBOTFRIENDS) // LittleRobotFriends specific
#include "LRF.h"
#elif defined(MICRODUINO) // Microduino specific
#include "Arduino.h"
#elif defined(TEENSYDUINO) // Teensy specific
#include "Arduino.h"
#elif defined(REDBEARLAB) // RedBearLab specific
#include "Arduino.h"
#elif defined(RFDUINO) // RFduino specific
#include "Arduino.h"
#elif defined(SPARK) // Spark specific
#include "application.h"
#elif defined(ARDUINO) // Arduino 1.0 and 1.5 specific
#include "Arduino.h"
#else // error
#error Platform not defined
#endif // end IDE

#ifndef newHeader_h
///
/// @brief  Release
///
#define newHeader_h

#endif // newHeader_h

Save the New File

  • Select the folder or create a New Folder.

The folder is where the file is going to be saved on the disk. You can access this file at that location with the Finder.

  • Define to which group the file belongs to by selecting the Group in the pull-down list.

The group is where the file is going to be displayed on the project, on the left side.

  • On the Targets list, check the Index to ensure code-sense.

  • Click on Create.