Skip to content

Main setup() for Energia MT #26

Description

@robertinant

From @rei-vilo on June 15, 2015 8:25

The setup() functions in the Energia MT examples often initiliase the GPIOs, ports and objects as many times as sketches, e.g. Serial.begin(115200);.

This raises two issues.

  • Some GPIOs, ports and objects don't accept to be initialised many times (e.g. Wire).
  • The order the setup() functions in the sketches isn't known, so we don't know in which sketch to initiliase GPIOs, ports and objects.

The idea is to have a specific setup() function names rtosSetup() called before all the other setup() functions of the sketches.

  1. Add in main.cpp
void rtosSetup() __attribute__((weak));

and

    rtosSetup();

just before BIOS_start();

  1. Declare rtosSetup() in the main sketch.

Because rtosSetup() is weak, the declaration of the function rtosSetup() can be omitted.

Copied from original issue: energia/Energia#631

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions