RTno is communicating library and framework which allows you to make your embedded device capable of communicating with RT-middleware world. RT-middleware is a platform software to realize Robotic system. In RTM, robots are developed by constructing robotics technologies\' elements (components) named RT-component. Therefore, the RTno helps you to create your own RT-component with your mbed and arduino. To know how to use your RTno device, visit here: http://ysuga.net/robot_e/rtm_e/rtc_e/1065?lang=en To know about RT-middleware and RT-component, visit http://www.openrtm.org

Dependencies:   EthernetNetIf

Dependents:   RTnoV3_LED RTnoV3_Template RTnoV3_ADC RTnoV3_Timer ... more

Committer:
ysuga
Date:
Thu Feb 09 02:33:10 2012 +0000
Revision:
0:9fac71a0bff3
RTno Version 3: RTno is a software library and tool to connect embedded devices like arduino and mbed to RT-middleware world.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ysuga 0:9fac71a0bff3 1 #define RTNO_SUBMODULE_DEFINE
ysuga 0:9fac71a0bff3 2
ysuga 0:9fac71a0bff3 3 #include <stdint.h>
ysuga 0:9fac71a0bff3 4 #include "RTno.h"
ysuga 0:9fac71a0bff3 5 #include "Packet.h"
ysuga 0:9fac71a0bff3 6 #include "Timer1ExecutionContext.h"
ysuga 0:9fac71a0bff3 7 //#include <avr/io.h>
ysuga 0:9fac71a0bff3 8 //#include <avr/interrupt.h>
ysuga 0:9fac71a0bff3 9
ysuga 0:9fac71a0bff3 10 static float m_Period;
ysuga 0:9fac71a0bff3 11 //static uint8_t m_ClockSetting;
ysuga 0:9fac71a0bff3 12
ysuga 0:9fac71a0bff3 13 Ticker *m_pTimer;
ysuga 0:9fac71a0bff3 14
ysuga 0:9fac71a0bff3 15 void Timer1EC_start();
ysuga 0:9fac71a0bff3 16 void Timer1EC_suspend();
ysuga 0:9fac71a0bff3 17 void Timer1EC_resume();
ysuga 0:9fac71a0bff3 18
ysuga 0:9fac71a0bff3 19 void tick () {
ysuga 0:9fac71a0bff3 20 EC_execute();
ysuga 0:9fac71a0bff3 21 }
ysuga 0:9fac71a0bff3 22
ysuga 0:9fac71a0bff3 23
ysuga 0:9fac71a0bff3 24 void Timer1EC_init(double rate)
ysuga 0:9fac71a0bff3 25 {
ysuga 0:9fac71a0bff3 26 EC_init(0x22);
ysuga 0:9fac71a0bff3 27 m_pTimer = new Ticker();
ysuga 0:9fac71a0bff3 28 // Initialize Period
ysuga 0:9fac71a0bff3 29 m_Period = (1.0 / rate);
ysuga 0:9fac71a0bff3 30 EC_start = Timer1EC_start;
ysuga 0:9fac71a0bff3 31 EC_suspend = Timer1EC_suspend;
ysuga 0:9fac71a0bff3 32 EC_resume = Timer1EC_resume;
ysuga 0:9fac71a0bff3 33 }
ysuga 0:9fac71a0bff3 34
ysuga 0:9fac71a0bff3 35 void Timer1EC_start()
ysuga 0:9fac71a0bff3 36 {
ysuga 0:9fac71a0bff3 37 m_pTimer->attach(tick, m_Period);
ysuga 0:9fac71a0bff3 38 }
ysuga 0:9fac71a0bff3 39
ysuga 0:9fac71a0bff3 40 void Timer1EC_suspend()
ysuga 0:9fac71a0bff3 41 {
ysuga 0:9fac71a0bff3 42 m_pTimer->detach();
ysuga 0:9fac71a0bff3 43 }
ysuga 0:9fac71a0bff3 44
ysuga 0:9fac71a0bff3 45 void Timer1EC_resume()
ysuga 0:9fac71a0bff3 46 {
ysuga 0:9fac71a0bff3 47 Timer1EC_start();
ysuga 0:9fac71a0bff3 48 }
ysuga 0:9fac71a0bff3 49
ysuga 0:9fac71a0bff3 50