Main Content

target.AddOn class

Package: target

Describe add-on properties for target feature class

Description

Use the target.AddOn class to capture custom properties that you can associate with these types of objects:

  • target.CommunicationChannel

  • target.CommunicationProtocolStack

  • target.Board

  • target.Processor

  • target.ConnectionProperties

To extend the objects, assign the target.AddOn object to the AddOns property.

To create a target.AddOn object, use the target.create function.

Properties

expand all

Name of the reusable add-on object.

Example: arduinoAddOn.Name = 'ArduinoBoardProperties';

Attributes:

GetAccess
public
SetAccess
public

Methods

expand all

Examples

collapse all

Add device-specific properties to a target.Board definition. Add information about the Arduino® part number and programmer to an Arduino board definition.

Create a board for Arduino Mega 2560.

mega = target.create('Board', ...
                     'Manufacturer', 'Arduino', ...
                     'Name', 'Mega 2560');

Create a target.AddOn object that specifies the Arduino board part number and programmer.

arduinoAddOn = target.create('AddOn');
arduinoAddOn.Name = 'ArduinoBoardProperties';
arduinoAddOn.addProperty('ArduinoPartNumber', 'String');
arduinoAddOn.addProperty('ArduinoProgrammer', 'String');
mega.AddOns = arduinoAddOn; 

Specify the part number and programmer values.

mega.set('ArduinoPartNumber', 'm2560');
mega.set('ArduinoProgrammer', 'wiring');

You can parameterize the avrdude command for the deployment of an Arduino application.

command= target.create('Command');
command.String = 'avrdude';
command.Arguments = ('-p$(BOARD.Processor.ArduinoPartNumber)' ...
                     '-c$(PROCESSOR.ArduinoProgrammer)' ...
                     '-Uflash:w:$(EXE):i');
mega.Tools.DeployTools(1).Commands = [command];

Introduced in R2020b