Jump to content
43oh

Changing the main.cpp


Recommended Posts

I like Energia, particularly that it gives me a working mspgcc on the Mac - but the Arduino style of coding (setup + loop) seems incongruous in relation to the MSP430 chip - I'd prefer to be using sleeping and interrupts.

 

So... Is it OK to just change the main.cpp so it doesn't loop?

 

 

In the above code (presuming it gists properly) I mean take out the loop.

 

edit: ok so gist doesn't work? 

 

 


#include <Energia.h>

int main(void)

{

  init();

  setup();

  for (; ;-) {

    loop();

    if (serialEventRun) serialEventRun();

  }
 

  return 0;

}
Link to post
Share on other sites
  • 4 years later...

When including "main.c" as follows, can I include functions from another tab into main.c?

image.png.0d4fb9ce692ee02444a4c0ec76475efe.png

In my example, I would like to use a function from LED.output.h before the main setup file

In main.c

#include <Energia.h>
#include "LEDoutput.h"

int main(void)
{
  led_init(); // my function from LEDoutput.h
  init();
  setup();
  while (1) {
    loop();
  }

  return 0;
}

However I am getting the following error: main.c:(.init9+0x2): undefined reference to `led_init'.

Is my path to my custom library incorrect?

Thank you!

Edited by bluehash
[ADMIN] Added code tags.
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...