MapleCoOS library for Maple platform to implement realtime CoOS.
Also need change systick.c and systick.h in hardware\leaflabs\cores\maple folder
Blink example
#include <MapleCoOS.h>
/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.
* LED connected from digital pin 13 to ground.
*/
int ledPin = 13; // LED connected to digital pin 13
#define LCD_BLINK_PRI 3 /* Priority of 'lcd_blink' task. */
#define UART_PRINT_PRI 4 /* Priority of 'tart_print' task. */
OS_STK task_init_Stack[TASK_STK_SIZE]; /* Stack of 'task_init' task. */
OS_STK led_display_Stack[TASK_STK_SIZE]; /* Stack of 'led_display' task. */
OS_STK uart_print_Stack[TASK_STK_SIZE]; /* Stack of 'uart_print' task. */
OS_MutexID mut_uart; /* Save id of mutex. */
byte char_uart = 0;
//
// This task use to blink led.
//
void led_blink(void *pdata)
{
char i;
for (;;)
{
for (i = 0; i < 19; i++)
{
digitalWrite(ledPin, !digitalRead(ledPin)); // toggle the LED
CoTickDelay (1000);
}
}
}
//
// This task print value by UART.
//
void uart_print(void *pdata)
{
for (;;)
{
CoEnterMutexSection(mut_uart); /* Enter mutex area. */
SerialUSB.write('.');
CoLeaveMutexSection(mut_uart); /* Leave mutex area. */
CoTickDelay(1000);
}
}
//
// This task is called to initial hardware and created tasks.
//
void task_init(void *pdata)
{
CoCreateTask(led_blink, (void *)0, LCD_BLINK_PRI, &led_display_Stack[TASK_STK_SIZE - 1], TASK_STK_SIZE );
CoCreateTask(uart_print, (void *)0, UART_PRINT_PRI, &uart_print_Stack[TASK_STK_SIZE - 1], TASK_STK_SIZE );
CoExitTask(); /*!< Delete 'task_init' task. */
}
// The setup() method runs once, when the sketch starts
void setup() {
// initialize the digital pin as an output:
pinMode(ledPin, OUTPUT);
CoInitOS();
CoCreateTask(task_init, (void *)0, 10, &task_init_Stack[TASK_STK_SIZE-1], TASK_STK_SIZE);
CoStartOS ();
}
// the loop() method runs over and over again
void loop()
{
}


1 comment(s) so far
Hi X893,
I posted this comment under the wrong OS few hours ago. Sorry for that. Should be her under CoOS for Maple
With maple ide v0.0.12 get error
Settings\Admin\Desktop\maple-ide-0.0.12-windowsxp32\hardware\leaflabs\cores\maple\/systick.h:52: error: '__read' was not declared in this scope
Can not find where __read function is coming from. Have you seen this error X893 ?