Main Content

target.AddOn Class

Namespace: target

Describe add-on properties for target type

Since R2020b

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.ArduinoPartNumber)' ...
                     '-c$(BOARD.ArduinoProgrammer)' ...
                     '-Uflash:w:$(EXE):i'};

mega.Tools.ExecutionTools(1) = target.create('SystemCommandExecutionTool', ...
                                             'Name', 'avrdude execution', ...
                                             'StartCommand', command);

Version History

Introduced in R2020b