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: EthernetInterface mbed-rtos
Timer1ExecutionContext.cpp@0:5f7bc45bc2e8, 2013-06-24 (annotated)
- Committer:
- ysuga
- Date:
- Mon Jun 24 06:42:11 2013 +0000
- Revision:
- 0:5f7bc45bc2e8
[mbed] converted /RTnoV3/RTnoV3
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ysuga | 0:5f7bc45bc2e8 | 1 | #define RTNO_SUBMODULE_DEFINE |
ysuga | 0:5f7bc45bc2e8 | 2 | |
ysuga | 0:5f7bc45bc2e8 | 3 | #include <stdint.h> |
ysuga | 0:5f7bc45bc2e8 | 4 | #include "RTno.h" |
ysuga | 0:5f7bc45bc2e8 | 5 | #include "Packet.h" |
ysuga | 0:5f7bc45bc2e8 | 6 | #include "Timer1ExecutionContext.h" |
ysuga | 0:5f7bc45bc2e8 | 7 | //#include <avr/io.h> |
ysuga | 0:5f7bc45bc2e8 | 8 | //#include <avr/interrupt.h> |
ysuga | 0:5f7bc45bc2e8 | 9 | |
ysuga | 0:5f7bc45bc2e8 | 10 | static float m_Period; |
ysuga | 0:5f7bc45bc2e8 | 11 | //static uint8_t m_ClockSetting; |
ysuga | 0:5f7bc45bc2e8 | 12 | |
ysuga | 0:5f7bc45bc2e8 | 13 | Ticker *m_pTimer; |
ysuga | 0:5f7bc45bc2e8 | 14 | |
ysuga | 0:5f7bc45bc2e8 | 15 | void Timer1EC_start(); |
ysuga | 0:5f7bc45bc2e8 | 16 | void Timer1EC_suspend(); |
ysuga | 0:5f7bc45bc2e8 | 17 | void Timer1EC_resume(); |
ysuga | 0:5f7bc45bc2e8 | 18 | |
ysuga | 0:5f7bc45bc2e8 | 19 | void tick () { |
ysuga | 0:5f7bc45bc2e8 | 20 | EC_execute(); |
ysuga | 0:5f7bc45bc2e8 | 21 | } |
ysuga | 0:5f7bc45bc2e8 | 22 | |
ysuga | 0:5f7bc45bc2e8 | 23 | |
ysuga | 0:5f7bc45bc2e8 | 24 | void Timer1EC_init(double rate) |
ysuga | 0:5f7bc45bc2e8 | 25 | { |
ysuga | 0:5f7bc45bc2e8 | 26 | EC_init(0x22); |
ysuga | 0:5f7bc45bc2e8 | 27 | m_pTimer = new Ticker(); |
ysuga | 0:5f7bc45bc2e8 | 28 | // Initialize Period |
ysuga | 0:5f7bc45bc2e8 | 29 | m_Period = (1.0 / rate); |
ysuga | 0:5f7bc45bc2e8 | 30 | EC_start = Timer1EC_start; |
ysuga | 0:5f7bc45bc2e8 | 31 | EC_suspend = Timer1EC_suspend; |
ysuga | 0:5f7bc45bc2e8 | 32 | EC_resume = Timer1EC_resume; |
ysuga | 0:5f7bc45bc2e8 | 33 | } |
ysuga | 0:5f7bc45bc2e8 | 34 | |
ysuga | 0:5f7bc45bc2e8 | 35 | void Timer1EC_start() |
ysuga | 0:5f7bc45bc2e8 | 36 | { |
ysuga | 0:5f7bc45bc2e8 | 37 | m_pTimer->attach(tick, m_Period); |
ysuga | 0:5f7bc45bc2e8 | 38 | } |
ysuga | 0:5f7bc45bc2e8 | 39 | |
ysuga | 0:5f7bc45bc2e8 | 40 | void Timer1EC_suspend() |
ysuga | 0:5f7bc45bc2e8 | 41 | { |
ysuga | 0:5f7bc45bc2e8 | 42 | m_pTimer->detach(); |
ysuga | 0:5f7bc45bc2e8 | 43 | } |
ysuga | 0:5f7bc45bc2e8 | 44 | |
ysuga | 0:5f7bc45bc2e8 | 45 | void Timer1EC_resume() |
ysuga | 0:5f7bc45bc2e8 | 46 | { |
ysuga | 0:5f7bc45bc2e8 | 47 | Timer1EC_start(); |
ysuga | 0:5f7bc45bc2e8 | 48 | } |
ysuga | 0:5f7bc45bc2e8 | 49 | |
ysuga | 0:5f7bc45bc2e8 | 50 |