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
RTnoProfile.cpp
- Committer:
- ysuga
- Date:
- 2013-08-29
- Revision:
- 7:6c7af1d50fb3
- Parent:
- 0:5f7bc45bc2e8
File content as of revision 7:6c7af1d50fb3:
#define RTNO_SUBMODULE_DEFINE
#include "mbed.h"
#include "RTnoProfile.h"
static PortBase *m_ppInPort[MAX_PORT];
static PortBase *m_ppOutPort[MAX_PORT];
void RTnoProfile_init()
{
}
int RTnoProfile_addInPort(PortBase* port)
{
int index = RTnoProfile_getNumInPort();
if(index == MAX_PORT) return -1;
m_ppInPort[index] = port;
return index;
}
int RTnoProfile_addOutPort(PortBase* port)
{
int index = RTnoProfile_getNumOutPort();
if(index == MAX_PORT) return -1;
m_ppOutPort[index] = port;
return index;
}
int RTnoProfile_getNumInPort() {
for(int i = 0;i < MAX_PORT;i++) {
if(m_ppInPort[i] == NULL) {
return i;
}
}
return MAX_PORT;
}
int RTnoProfile_getNumOutPort() {
for(int i = 0;i < MAX_PORT;i++) {
if(m_ppOutPort[i] == NULL) {
return i;
}
}
return MAX_PORT;
}
PortBase* RTnoProfile_getInPort(const char* name, uint8_t nameLen)
{
for(uint8_t i = 0;i < MAX_PORT;i++) {
if(m_ppInPort[i] == NULL) return NULL;
if(strncmp(name, m_ppInPort[i]->pName, nameLen) == 0) {
return m_ppInPort[i];
}
}
return NULL;
}
PortBase* RTnoProfile_getOutPort(const char* name, uint8_t nameLen)
{
for(uint8_t i = 0;i < MAX_PORT;i++) {
if(m_ppOutPort[i] == NULL) return NULL;
if(strncmp(name, m_ppOutPort[i]->pName, nameLen) == 0) {
return m_ppOutPort[i];
}
}
return NULL;
}
PortBase* RTnoProfile_getInPortByIndex(const uint8_t i)
{
return m_ppInPort[i];
}
PortBase* RTnoProfile_getOutPortByIndex(const uint8_t i)
{
return m_ppOutPort[i];
}
Yuki Suga