nucho
/
RTno_digitalInOut
RTno/RTno.h@0:b14546a3cfab, 2011-07-29 (annotated)
- Committer:
- nucho
- Date:
- Fri Jul 29 11:23:06 2011 +0000
- Revision:
- 0:b14546a3cfab
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
nucho | 0:b14546a3cfab | 1 | #ifndef RTNO_HEADER_INCLUDED |
nucho | 0:b14546a3cfab | 2 | #define RTNO_HEADER_INCLUDED |
nucho | 0:b14546a3cfab | 3 | |
nucho | 0:b14546a3cfab | 4 | /******************************************* |
nucho | 0:b14546a3cfab | 5 | * RTno.h |
nucho | 0:b14546a3cfab | 6 | * @author Yuki Suga |
nucho | 0:b14546a3cfab | 7 | * @copyright Yuki Suga (ysuga.net) Nov, 10th, 2010. |
nucho | 0:b14546a3cfab | 8 | * @license LGPLv3 |
nucho | 0:b14546a3cfab | 9 | *****************************************/ |
nucho | 0:b14546a3cfab | 10 | |
nucho | 0:b14546a3cfab | 11 | |
nucho | 0:b14546a3cfab | 12 | //#define BAUDRATE 19200 |
nucho | 0:b14546a3cfab | 13 | |
nucho | 0:b14546a3cfab | 14 | #define RTC_OK 0 |
nucho | 0:b14546a3cfab | 15 | #define RTC_ERROR -1 |
nucho | 0:b14546a3cfab | 16 | |
nucho | 0:b14546a3cfab | 17 | #include "BasicDataType.h" |
nucho | 0:b14546a3cfab | 18 | #include "InPort.h" |
nucho | 0:b14546a3cfab | 19 | #include "OutPort.h" |
nucho | 0:b14546a3cfab | 20 | |
nucho | 0:b14546a3cfab | 21 | |
nucho | 0:b14546a3cfab | 22 | extern "C" { |
nucho | 0:b14546a3cfab | 23 | void addInPort(InPortBase& inPort); |
nucho | 0:b14546a3cfab | 24 | void addOutPort(OutPortBase& outPort); |
nucho | 0:b14546a3cfab | 25 | } |
nucho | 0:b14546a3cfab | 26 | |
nucho | 0:b14546a3cfab | 27 | struct config_str { |
nucho | 0:b14546a3cfab | 28 | struct default_str { |
nucho | 0:b14546a3cfab | 29 | long baudrate; |
nucho | 0:b14546a3cfab | 30 | } _default; |
nucho | 0:b14546a3cfab | 31 | }; |
nucho | 0:b14546a3cfab | 32 | |
nucho | 0:b14546a3cfab | 33 | struct exec_cxt_str { |
nucho | 0:b14546a3cfab | 34 | struct periodic_str { |
nucho | 0:b14546a3cfab | 35 | long type; |
nucho | 0:b14546a3cfab | 36 | } periodic; |
nucho | 0:b14546a3cfab | 37 | }; |
nucho | 0:b14546a3cfab | 38 | |
nucho | 0:b14546a3cfab | 39 | #define ProxySynchronousExecutionContext 1 |
nucho | 0:b14546a3cfab | 40 | |
nucho | 0:b14546a3cfab | 41 | extern exec_cxt_str exec_cxt; |
nucho | 0:b14546a3cfab | 42 | |
nucho | 0:b14546a3cfab | 43 | extern config_str conf; |
nucho | 0:b14546a3cfab | 44 | |
nucho | 0:b14546a3cfab | 45 | |
nucho | 0:b14546a3cfab | 46 | extern "C" { |
nucho | 0:b14546a3cfab | 47 | void rtcconf(void); |
nucho | 0:b14546a3cfab | 48 | }; |
nucho | 0:b14546a3cfab | 49 | |
nucho | 0:b14546a3cfab | 50 | namespace RTno { |
nucho | 0:b14546a3cfab | 51 | extern "C" { |
nucho | 0:b14546a3cfab | 52 | // setup function is defined in RTno.cpp |
nucho | 0:b14546a3cfab | 53 | void setup(); |
nucho | 0:b14546a3cfab | 54 | |
nucho | 0:b14546a3cfab | 55 | // loop fuction is defined in RTno.cpp |
nucho | 0:b14546a3cfab | 56 | void loop(); |
nucho | 0:b14546a3cfab | 57 | |
nucho | 0:b14546a3cfab | 58 | // These call-back funcitons should be defined in user program code. |
nucho | 0:b14546a3cfab | 59 | // Use RTno_template.pde to create your own project. |
nucho | 0:b14546a3cfab | 60 | |
nucho | 0:b14546a3cfab | 61 | /** |
nucho | 0:b14546a3cfab | 62 | * onInitialize() |
nucho | 0:b14546a3cfab | 63 | * This function is called when RTno is initialized. |
nucho | 0:b14546a3cfab | 64 | * RTno is usually initialized when the RTno-proxy is launched. |
nucho | 0:b14546a3cfab | 65 | */ |
nucho | 0:b14546a3cfab | 66 | int onInitialize(); |
nucho | 0:b14546a3cfab | 67 | |
nucho | 0:b14546a3cfab | 68 | /** |
nucho | 0:b14546a3cfab | 69 | * onActivated() |
nucho | 0:b14546a3cfab | 70 | * This function is called when RTno is activated. |
nucho | 0:b14546a3cfab | 71 | * RTno is usually activated by RT System Editor or other tools for OpenRTM-aist. |
nucho | 0:b14546a3cfab | 72 | */ |
nucho | 0:b14546a3cfab | 73 | int onActivated(); |
nucho | 0:b14546a3cfab | 74 | |
nucho | 0:b14546a3cfab | 75 | /** |
nucho | 0:b14546a3cfab | 76 | * onExecute() |
nucho | 0:b14546a3cfab | 77 | * This function is periodically called when the RTno-proxy is active. |
nucho | 0:b14546a3cfab | 78 | */ |
nucho | 0:b14546a3cfab | 79 | int onExecute(); |
nucho | 0:b14546a3cfab | 80 | |
nucho | 0:b14546a3cfab | 81 | /** |
nucho | 0:b14546a3cfab | 82 | * onDeactivated() |
nucho | 0:b14546a3cfab | 83 | * This function is called when RTno is deactivated. |
nucho | 0:b14546a3cfab | 84 | * RTno is usually deactivated by RT System Editor or other tools for OpenRTM-aist. |
nucho | 0:b14546a3cfab | 85 | */ |
nucho | 0:b14546a3cfab | 86 | int onDeactivated(); |
nucho | 0:b14546a3cfab | 87 | |
nucho | 0:b14546a3cfab | 88 | /** |
nucho | 0:b14546a3cfab | 89 | * onError |
nucho | 0:b14546a3cfab | 90 | * This function is called when RTno is error. |
nucho | 0:b14546a3cfab | 91 | * [DANGEROUS] This function is periodically called in very short interval. |
nucho | 0:b14546a3cfab | 92 | */ |
nucho | 0:b14546a3cfab | 93 | int onError(); |
nucho | 0:b14546a3cfab | 94 | |
nucho | 0:b14546a3cfab | 95 | /** |
nucho | 0:b14546a3cfab | 96 | * onReset |
nucho | 0:b14546a3cfab | 97 | * This function is called when RTno is reset. |
nucho | 0:b14546a3cfab | 98 | * RTno is usually reset by RT System Editor or other tools for OpenRTM-aist. |
nucho | 0:b14546a3cfab | 99 | */ |
nucho | 0:b14546a3cfab | 100 | int onReset(); |
nucho | 0:b14546a3cfab | 101 | };// extern "C" |
nucho | 0:b14546a3cfab | 102 | }; |
nucho | 0:b14546a3cfab | 103 | |
nucho | 0:b14546a3cfab | 104 | |
nucho | 0:b14546a3cfab | 105 | #endif |
nucho | 0:b14546a3cfab | 106 |