I'm trying to access the library in my own library. I've tried everything to get it to compile without warnings. I'm including <Scheduler.h> as my second preprocessor directive (<Arduino.h> being my first). I've also externally defined the instance of SchedulerClass Scheduler into my header and .cpp files. For some reason, the compiler is throwing a warning "warning: undefined reference to `wait(int)" or "'wait' was not declared in this scope" if I don't externally reference the function. Since I don't have a Due yet, I can't actually see if the warnings will affect anything. yield() still links fine, though. This is where I'm confused. I can't find the wait() function in the Scheduler library. Is there another place it could be, and if so, does anybody know where it would be? I've attached my source as it relates to the Scheduler.
//
// MusicalRobots.h
//
//
// Created by on 11/1/12.
//
//
#ifndef ____MusicalRobots__
#define ____MusicalRobots__
#include <Arduino.h>
#include <Scheduler.h>
#include "MR_IO.h"
#include "MR_Solenoid.h"
#include "MR_Stepper.h"
#include "MR_Motor.h"
#include "MIDI.h"
#include "MR_MIDI.h"
extern bool DISPLAY_MENU;
extern MIDI_Class MIDI;
extern SchedulerClass Scheduler;
void INIT();
void THREAD_MIDI_HANDLING();
void THREAD_GENERIC_IO();
void THREAD_UPDATE_GRAPHICS();
void THREAD_DISPLAY_DRIVER();
void THREAD_ROBOT_DRIVER();
#endif /* defined(____MusicalRobots__) */
//
// MusicalRobots.cpp
//
//
// Created by on 11/1/12.
//
//
#include "MusicalRobots.h"
//external variables
extern bool DISPLAY_MENU; //menu resource semaphore/mutex
extern SchedulerClass Scheduler;
//extern void wait(int);
void INIT() {
//setup our I/O Pins
IOInitializePins();
//begin serial communication with LCD
IOSetupLCD();
//begin MIDI on the default channel
InitializeMIDI(MR_MIDI_DEFAULT_CHANNEL);
//initialize our thread functions as actual threads
Scheduler.startLoop(THREAD_MIDI_HANDLING);
Scheduler.startLoop(THREAD_GENERIC_IO);
Scheduler.startLoop(THREAD_UPDATE_GRAPHICS);
Scheduler.startLoop(THREAD_DISPLAY_DRIVER);
Scheduler.startLoop(THREAD_ROBOT_DRIVER);
}
//setup our OS threads
//handles MIDI I/O
void THREAD_MIDI_HANDLING() {
//parse the MIDI data
MIDIBuffer();
yield();
}
//handles buttons and encoders
void THREAD_GENERIC_IO() {
//impliment debouncing Finite State Machine for toggling menues
//parse quadrature encoders
wait(20);
yield();
}
//handles updating screen text
void THREAD_UPDATE_GRAPHICS() {
if (DISPLAY_MENU) DisplayMenu();
else DisplayRealTimeStatus();
wait(200);
yield();
}
//actually drives serial display
void THREAD_DISPLAY_DRIVER() {
//write serial data to the display every 200 uS
//update display
//wait for .4 s
wait(400);
yield(); //this takes a while to do, and can be interrupted
}
//drives motors and other output
void THREAD_ROBOT_DRIVER() {
wait(20);
}
//we'll update settings in the regular loop()
//save something for system idle process
void setup() {
INIT();
}
void loop() {
yield();
}
Any thoughts?