OpenEL  3.0.0
openEL_NXT.h
Go to the documentation of this file.
1 
12 /*
13 
14 Copyright (c) 2017,2018 Japan Embedded Systems Technology Association(JASA)
15 All rights reserved.
16 
17 Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
18 
19  Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
20  Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
21  Neither the name of the Association nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
22 
23 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25 
26 #ifndef OPENEL_NXT_H_
27 #define OPENEL_NXT_H_
28 
29 #define EL_NXT_PORT_A 0
30 #define EL_NXT_PORT_B 1
31 #define EL_NXT_PORT_C 2
32 #define EL_NXT_PORT_S1 3
33 #define EL_NXT_PORT_S2 4
34 #define EL_NXT_PORT_S3 5
35 #define EL_NXT_PORT_S4 6
36 #define EL_NXT_PORT_BATTERY 7
37 #define EL_NXT_PORT_SPEAKER 8
38 #define EL_NXT_PORT_BLUETOOTH 9
39 #define EL_NXT_PORT_NO_USE 65535
40 
41 
42 #define EL_NXT_PHYSICAL_PORT_A (EL_NXT_PHYSICAL_ID_MOTOR | 0x00)
43 #define EL_NXT_PHYSICAL_PORT_B (EL_NXT_PHYSICAL_ID_MOTOR | 0x01)
44 #define EL_NXT_PHYSICAL_PORT_C (EL_NXT_PHYSICAL_ID_MOTOR | 0x02)
45 #define EL_NXT_PHYSICAL_PORT_S1 (EL_NXT_PHYSICAL_ID_SENSOR | 0x00)
46 #define EL_NXT_PHYSICAL_PORT_S2 (EL_NXT_PHYSICAL_ID_SENSOR | 0x01)
47 #define EL_NXT_PHYSICAL_PORT_S3 (EL_NXT_PHYSICAL_ID_SENSOR | 0x02)
48 #define EL_NXT_PHYSICAL_PORT_S4 (EL_NXT_PHYSICAL_ID_SENSOR | 0x03)
49 #define EL_NXT_PHYSICAL_PORT_BATTERY (EL_NXT_PHYSICAL_ID_BATTERY | 0x00)
50 #define EL_NXT_PHYSICAL_PORT_SPEAKER (EL_NXT_PHYSICAL_ID_SPEAKER | 0x00)
51 #define EL_NXT_PHYSICAL_PORT_BLUETOOTH (EL_NXT_PHYSICAL_ID_BLUETOOTH | 0x00)
52 
53 #define EL_BT_NO_INIT 4
54 #define EL_BT_INITIALIZED 5
55 #define EL_BT_CONNECTED 6
56 #define EL_BT_STREAM 7
57 
58 /* struct/union definition */
60  /* 0x00 */ ELInt32 (*pFncMotorInit)(ELUInt32 portid);
61  /* 0x01 */ ELInt32 (*pFncGetCtlMode)(ELUInt32 portid, ELInt32 *pMode);
62  /* 0x02 */ ELInt32 (*pFncSetCtlMode)(ELUInt32 portid, ELInt32 *pMode);
63  /* 0x03 */ ELInt32 (*pFncGetAngle)(ELUInt32 portid, ELUInt32 sw, ELFloat64 *pAngle);
64  /* 0x04 */ ELInt32 (*pFncSetAngle)(ELUInt32 portid, ELFloat64 angle, ELFloat64 speed);
65  /* 0x05 */ ELInt32 (*pFncResetEncoder)(ELUInt32 portid);
66  /* 0x06 */ ELInt32 (*pFncGetSpeed)(ELUInt32 portid, ELInt32 idx, ELFloat64 *pOutSpeed);
67  /* 0x07 */ ELInt32 (*pFncSetSpeed)(ELUInt32 portid, ELFloat64 speed);
68  /* 0x08 */ ELInt32 (*pFncGetBrake)(ELUInt32 portid, ELBool *pFlagBrake);
69  /* 0x09 */ ELInt32 (*pFncSetBrake)(ELUInt32 portid, ELBool *pFlagBrake);
70 };
72 
74  /* 0x00 */ ELInt32 (*pFncSensorInit)(ELUInt32 portid);
75  /* 0x01 */ ELInt32 (*pFncGyroGetValue)(ELUInt32 portid, ELUInt16 *pValue);
76  /* 0x02 */ ELInt32 (*pFncGyroGetOffset)(ELUInt32 portid, ELUInt16 *pValue);
77  /* 0x03 */ ELInt32 (*pFncGyroSetOffset)(ELUInt32 portid, ELUInt16 offset);
78  /* 0x04 */ ELInt32 (*pFncLightGetValue)(ELUInt32 portid, ELUInt16 *pValue);
79  /* 0x05 */ ELInt32 (*pFncLightGetLED)(ELUInt32 portid, ELBool *pStatus);
80  /* 0x06 */ ELInt32 (*pFncLightSetLED)(ELUInt32 portid, ELBool light);
81  /* 0x07 */ ELInt32 (*pFncTouchGetState)(ELUInt32 portid, ELBool *pStatus);
82  /* 0x08 */ ELInt32 (*pFncSonarInitialize)(ELUInt32 portid);
83  /* 0x09 */ ELInt32 (*pFncSonarTerminate)(ELUInt32 portid);
84  /* 0x0A */ ELInt32 (*pFncSonarGetValue)(ELUInt32 portid, ELInt32 *pValue);
85 };
87 
89  /* 0x00 */ ELInt32 (*pFncBatteryInit)(ELUInt32 portid);
90  /* 0x01 */ ELInt32 (*pFncGetVoltage)(ELUInt32 portid, ELUInt16 *pVoltage);
91 };
93 
95  /* 0x00 */ ELInt32 (*pFncSpeakerInit)(ELUInt32 portid);
96  /* 0x01 */ ELInt32 (*pFncOutput)(ELUInt32 portid, ELUInt32 freq, ELUInt32 mx, ELUInt32 vol);
97 };
99 
101  /* 0x00 */ ELInt32 (*pFncBluetoothInit)(ELUInt32 portid);
102  /* 0x01 */ ELInt32 (*pFncInitializeMaster)(ELUInt32 portid, const ELUChar *addr, const ELChar *pPin);
103  /* 0x02 */ ELInt32 (*pFncInitializeSlave)(ELUInt32 portid, const ELChar *pPin);
104  /* 0x03 */ ELInt32 (*pFncTerminate)(ELUInt32 portid);
105  /* 0x04 */ ELInt32 (*pFncSendData)(ELUInt32 portid, const ELUInt8 *buf, ELUInt32 offset, ELUInt32 len, ELUInt32 *outsize);
106  /* 0x05 */ ELInt32 (*pFncReceiveData)(ELUInt32 portid, ELUInt8 *buf, ELUInt32 offset, ELUInt32 len, ELUInt32 *outsize);
107  /* 0x06 */ ELInt32 (*pFncGetDeviceName)(ELUInt32 portid, ELChar *pName);
108  /* 0x07 */ ELInt32 (*pFncSetDeviceName)(ELUInt32 portid, const ELChar *pName);
109  /* 0x08 */ ELInt32 (*pFncGetStatus)(ELUInt32 portid, ELInt32 *pStatus);
110  /* 0x09 */ ELInt32 (*pFncGetSignalStrength)(ELUInt32 portid, ELInt32 *pStrength);
111 };
113 
114 
115 
116 #endif /* OPENEL_NXT_H_ */
ELInt32(* pFncSpeakerInit)(ELUInt32 portid)
Definition: openEL_NXT.h:95
ELInt32(* pFncSetBrake)(ELUInt32 portid, ELBool *pFlagBrake)
Definition: openEL_NXT.h:69
ELInt32(* pFncGetBrake)(ELUInt32 portid, ELBool *pFlagBrake)
Definition: openEL_NXT.h:68
ELInt32(* pFncSonarTerminate)(ELUInt32 portid)
Definition: openEL_NXT.h:83
ELInt32(* pFncSetSpeed)(ELUInt32 portid, ELFloat64 speed)
Definition: openEL_NXT.h:67
ELInt32(* pFncGetAngle)(ELUInt32 portid, ELUInt32 sw, ELFloat64 *pAngle)
Definition: openEL_NXT.h:63
ELInt32(* pFncReceiveData)(ELUInt32 portid, ELUInt8 *buf, ELUInt32 offset, ELUInt32 len, ELUInt32 *outsize)
Definition: openEL_NXT.h:106
ELInt32(* pFncSendData)(ELUInt32 portid, const ELUInt8 *buf, ELUInt32 offset, ELUInt32 len, ELUInt32 *outsize)
Definition: openEL_NXT.h:105
ELInt32(* pFncSetAngle)(ELUInt32 portid, ELFloat64 angle, ELFloat64 speed)
Definition: openEL_NXT.h:64
ELInt32(* pFncGetDeviceName)(ELUInt32 portid, ELChar *pName)
Definition: openEL_NXT.h:107
ELInt32(* pFncGyroSetOffset)(ELUInt32 portid, ELUInt16 offset)
Definition: openEL_NXT.h:77
ELInt32(* pFncSetDeviceName)(ELUInt32 portid, const ELChar *pName)
Definition: openEL_NXT.h:108
ELInt32(* pFncMotorInit)(ELUInt32 portid)
Definition: openEL_NXT.h:60
ELInt32(* pFncSonarGetValue)(ELUInt32 portid, ELInt32 *pValue)
Definition: openEL_NXT.h:84
ELInt32(* pFncTouchGetState)(ELUInt32 portid, ELBool *pStatus)
Definition: openEL_NXT.h:81
ELInt32(* pFncSonarInitialize)(ELUInt32 portid)
Definition: openEL_NXT.h:82
ELInt32(* pFncLightGetValue)(ELUInt32 portid, ELUInt16 *pValue)
Definition: openEL_NXT.h:78
ELInt32(* pFncLightSetLED)(ELUInt32 portid, ELBool light)
Definition: openEL_NXT.h:80
ELInt32(* pFncInitializeMaster)(ELUInt32 portid, const ELUChar *addr, const ELChar *pPin)
Definition: openEL_NXT.h:102
ELInt32(* pFncResetEncoder)(ELUInt32 portid)
Definition: openEL_NXT.h:65
ELInt32(* pFncGetSpeed)(ELUInt32 portid, ELInt32 idx, ELFloat64 *pOutSpeed)
Definition: openEL_NXT.h:66
ELInt32(* pFncTerminate)(ELUInt32 portid)
Definition: openEL_NXT.h:104
ELInt32(* pFncGetVoltage)(ELUInt32 portid, ELUInt16 *pVoltage)
Definition: openEL_NXT.h:90
ELInt32(* pFncGetCtlMode)(ELUInt32 portid, ELInt32 *pMode)
Definition: openEL_NXT.h:61
ELInt32(* pFncBluetoothInit)(ELUInt32 portid)
Definition: openEL_NXT.h:101
ELInt32(* pFncGetStatus)(ELUInt32 portid, ELInt32 *pStatus)
Definition: openEL_NXT.h:109
ELInt32(* pFncInitializeSlave)(ELUInt32 portid, const ELChar *pPin)
Definition: openEL_NXT.h:103
ELInt32(* pFncLightGetLED)(ELUInt32 portid, ELBool *pStatus)
Definition: openEL_NXT.h:79
ELInt32(* pFncGyroGetValue)(ELUInt32 portid, ELUInt16 *pValue)
Definition: openEL_NXT.h:75
ELInt32(* pFncOutput)(ELUInt32 portid, ELUInt32 freq, ELUInt32 mx, ELUInt32 vol)
Definition: openEL_NXT.h:96
ELInt32(* pFncBatteryInit)(ELUInt32 portid)
Definition: openEL_NXT.h:89
ELInt32(* pFncGyroGetOffset)(ELUInt32 portid, ELUInt16 *pValue)
Definition: openEL_NXT.h:76
ELInt32(* pFncSensorInit)(ELUInt32 portid)
Definition: openEL_NXT.h:74
ELInt32(* pFncGetSignalStrength)(ELUInt32 portid, ELInt32 *pStrength)
Definition: openEL_NXT.h:110
ELInt32(* pFncSetCtlMode)(ELUInt32 portid, ELInt32 *pMode)
Definition: openEL_NXT.h:62