Main.Configurations History
Hide minor edits - Show changes to output
Changed line 94 from:
Nope. That not here. Let's have a look at the includes, for example "includes Led":
to:
Nope. That's not here. Let's have a look at the includes, for example "includes Led":
Changed lines 85-86 from:
"led.led", thus refers to the led declaration inside LedArduino.basically refer to the group you have just declared. So far, so good.
to:
"led.led", thus refers to the led declaration inside LedArduino. So far, so good.
Changed lines 101-102 from:
to:
receives led_on, led_off, led_toggle
}
}
Changed lines 63-108 from:
to:
!!!Why the hell should we write led.led.Led?
The first "led", corresponds to
[@
group led : LedArduino
@]
You basically refer to the group you have just declared. So far, so good.
Now, let's dive into that LedArduino stuff:
[@
configuration fragment LedArduino
{
group io : DigitalOutputArduino
instance led : LedUC
connector led.DigitalOutput => io.digital_output.DigitalOutput
}
@]
"led.led", thus refers to the led declaration inside LedArduino.basically refer to the group you have just declared. So far, so good.
Now, let's dive into that LedUC stuff to find out where does the last "Led" comes from. Note that we are looking for a port (since this "led.led.Led" was defined in a connector:
[@
thing LedUC includes Led, DigitalOutputMsgs
{...}
@]
Nope. That not here. Let's have a look at the includes, for example "includes Led":
[@
thing fragment Led includes LedMsgs
{
provided port Led //the holy grail
{
receives led_on, led_off, led_toggle
}
}
@]
Hell yeah, there's a Led port.
That was... easy?
The first "led", corresponds to
[@
group led : LedArduino
@]
You basically refer to the group you have just declared. So far, so good.
Now, let's dive into that LedArduino stuff:
[@
configuration fragment LedArduino
{
group io : DigitalOutputArduino
instance led : LedUC
connector led.DigitalOutput => io.digital_output.DigitalOutput
}
@]
"led.led", thus refers to the led declaration inside LedArduino.basically refer to the group you have just declared. So far, so good.
Now, let's dive into that LedUC stuff to find out where does the last "Led" comes from. Note that we are looking for a port (since this "led.led.Led" was defined in a connector:
[@
thing LedUC includes Led, DigitalOutputMsgs
{...}
@]
Nope. That not here. Let's have a look at the includes, for example "includes Led":
[@
thing fragment Led includes LedMsgs
{
provided port Led //the holy grail
{
receives led_on, led_off, led_toggle
}
}
@]
Hell yeah, there's a Led port.
That was... easy?
Changed lines 61-63 from:
@]
to:
@]
!!!Why the hell should we write led.led.Led?
!!!Why the hell should we write led.led.Led?
Changed lines 36-40 from:
* already defined.
to:
* already defined.
* To access an instance in a group,
* a sub-group in a group or a property of an instance,
* we use a classic dotted notation eg:
* groupName.subGroupName.instanceName.propertyName
* To access an instance in a group,
* a sub-group in a group or a property of an instance,
* we use a classic dotted notation eg:
* groupName.subGroupName.instanceName.propertyName
Added lines 42-44:
//Led group: defines a LED and connection to Arduino board
//realized within the group. You just need to set the PIN
//of the LED using the set primitive.
//realized within the group. You just need to set the PIN
//of the LED using the set primitive.
Added line 47:
Added line 50:
Added lines 55-57:
/*
* Step3.2: Define connectors between instances
*/
* Step3.2: Define connectors between instances
*/
Changed lines 3-5 from:
The examples used on this page use the things defined here:
to:
To build an executable ThingML program, you need to instantiate things and connect them together. A ThingML configuration defines a set of instances and connectors between their ports. A ThingML configuration is similar to, for example, a Java main operation.
This example reuses basic components provided by the ThingML framework to blink a LED:
/*
* Step1: Import the ThingML application you want to run.
* Applications are usually defined at a PIM level
*/
import "../blink.thingml"
/*
* Step2: Import PSM things that would need to instantiate
* to properly run the application.
* Here: LED and Timer for the Arduino platform
*/
import "../../hardware/bricks/_arduino/led.thingml"
import "../../core/_arduino/timer.thingml"
/*
* Step3: Define the configuration
*/
configuration BlinkArduino
{
/*
* Step3.1: Define instances
* ThingML provides two instantiation policies:
* - simple instanciation, for example timer.
* This is rather similar to a new in Java
* - group instanciation, for example led.
* This allow to instantiate a pre-defined
* configuration, with some instances and connectors
* already defined.
*/
group led : LedArduino
set led.io.digital_output.pin = DigitalPin:PIN_13
// The timer
instance timer : TimerArduino
// The blink application
instance app : Blink
connector app.HW => led.led.Led
connector app.HW => timer.timer
}
This example reuses basic components provided by the ThingML framework to blink a LED:
/*
* Step1: Import the ThingML application you want to run.
* Applications are usually defined at a PIM level
*/
import "../blink.thingml"
/*
* Step2: Import PSM things that would need to instantiate
* to properly run the application.
* Here: LED and Timer for the Arduino platform
*/
import "../../hardware/bricks/_arduino/led.thingml"
import "../../core/_arduino/timer.thingml"
/*
* Step3: Define the configuration
*/
configuration BlinkArduino
{
/*
* Step3.1: Define instances
* ThingML provides two instantiation policies:
* - simple instanciation, for example timer.
* This is rather similar to a new in Java
* - group instanciation, for example led.
* This allow to instantiate a pre-defined
* configuration, with some instances and connectors
* already defined.
*/
group led : LedArduino
set led.io.digital_output.pin = DigitalPin:PIN_13
// The timer
instance timer : TimerArduino
// The blink application
instance app : Blink
connector app.HW => led.led.Led
connector app.HW => timer.timer
}
Changed lines 1-5 from:
!! Configurations, Instances and Connectors
to:
!! Configurations, Instances and Connectors
To build an executable system things need to be instantiated and connected together. A ThingML configuration defines a set of instances and connectors between their ports.
The examples used on this page use the things defined here:
To build an executable system things need to be instantiated and connected together. A ThingML configuration defines a set of instances and connectors between their ports.
The examples used on this page use the things defined here: