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

Timer1ExecutionContext.cpp

Committer:
ysuga
Date:
2012-02-09
Revision:
0:9fac71a0bff3

File content as of revision 0:9fac71a0bff3:

#define RTNO_SUBMODULE_DEFINE

#include <stdint.h>
#include "RTno.h"
#include "Packet.h"
#include "Timer1ExecutionContext.h"
//#include <avr/io.h>
//#include <avr/interrupt.h>

static float m_Period;
//static uint8_t m_ClockSetting;

Ticker *m_pTimer;

void Timer1EC_start();
void Timer1EC_suspend();
void Timer1EC_resume();

void tick () {
    EC_execute();
}


void Timer1EC_init(double rate)
{
  EC_init(0x22);
  m_pTimer = new Ticker();
  // Initialize Period
  m_Period = (1.0 / rate);
  EC_start = Timer1EC_start;
  EC_suspend = Timer1EC_suspend;
  EC_resume = Timer1EC_resume;
}

void Timer1EC_start()
{
    m_pTimer->attach(tick, m_Period);
}

void Timer1EC_suspend()
{
    m_pTimer->detach();
}

void Timer1EC_resume()
{
    Timer1EC_start();
}