Ivo van Poorten / Mbed 2 deprecated opus-una

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers timer-mbed.c Source File

timer-mbed.c

00001 /* Opus Una - A Small Cooperative Multitasking Kernel in C
00002  *
00003  * Copyright (C) 2011 by Ivo van Poorten <ivop@euronet.nl>
00004  * This file is licensed under the terms of the GNU Lesser
00005  * General Public License, version 3.
00006  */
00007 
00008 #include "timer.h"
00009 #include "kernel.h"
00010 #include "fastlib/systick.h"
00011 
00012 extern "C" void SysTick_Handler(void) __irq {
00013     ou_ticks++;
00014     ou_update_tasks();
00015 }
00016 
00017 void ou_start_timer(void) {
00018     fl_systick_set_reload_value((96000000/100)-1);          // 1/100th of a second (10ms)
00019     fl_systick_control(FL_ENABLE, FL_ENABLE, FL_ENABLE);    // timer, irq, use cclk 
00020 }
00021 
00022 void ou_idle(void) {
00023     // save power/cpu time/et cetera...
00024 }