Davi Souza
/
pymite
python
Fork of pymite by
platform/mbed/main_nat.cpp@2:a2bea117e22e, 2013-03-12 (annotated)
- Committer:
- va009039
- Date:
- Tue Mar 12 11:40:41 2013 +0000
- Revision:
- 2:a2bea117e22e
- Parent:
- 1:28afb064a41c
- Child:
- 3:559c4bd38111
add NativeClassInterface, update mbed.py
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
va009039 | 0:65f1469d6bfb | 1 | #undef __FILE_ID__ |
va009039 | 0:65f1469d6bfb | 2 | #define __FILE_ID__ 0x0A |
va009039 | 0:65f1469d6bfb | 3 | /** |
va009039 | 0:65f1469d6bfb | 4 | * PyMite usr native function file |
va009039 | 0:65f1469d6bfb | 5 | * |
va009039 | 0:65f1469d6bfb | 6 | * automatically created by pmImgCreator.py |
va009039 | 2:a2bea117e22e | 7 | * on Tue Mar 12 20:23:40 2013 |
va009039 | 0:65f1469d6bfb | 8 | * |
va009039 | 0:65f1469d6bfb | 9 | * DO NOT EDIT THIS FILE. |
va009039 | 0:65f1469d6bfb | 10 | * ANY CHANGES WILL BE LOST. |
va009039 | 0:65f1469d6bfb | 11 | * |
va009039 | 0:65f1469d6bfb | 12 | * @file main_nat.cpp |
va009039 | 0:65f1469d6bfb | 13 | */ |
va009039 | 0:65f1469d6bfb | 14 | |
va009039 | 0:65f1469d6bfb | 15 | #define __IN_LIBNATIVE_C__ |
va009039 | 0:65f1469d6bfb | 16 | #include "pm.h" |
va009039 | 0:65f1469d6bfb | 17 | |
va009039 | 0:65f1469d6bfb | 18 | /* From: mbed.py */ |
va009039 | 0:65f1469d6bfb | 19 | #include "mbed.h" |
va009039 | 2:a2bea117e22e | 20 | #include "NativeClassInterface.h" |
va009039 | 0:65f1469d6bfb | 21 | |
va009039 | 0:65f1469d6bfb | 22 | PmReturn_t |
va009039 | 0:65f1469d6bfb | 23 | nat_placeholder_func(pPmFrame_t *ppframe) |
va009039 | 0:65f1469d6bfb | 24 | { |
va009039 | 0:65f1469d6bfb | 25 | |
va009039 | 0:65f1469d6bfb | 26 | /* |
va009039 | 0:65f1469d6bfb | 27 | * Use placeholder because an index |
va009039 | 0:65f1469d6bfb | 28 | * value of zero denotes the stdlib. |
va009039 | 0:65f1469d6bfb | 29 | * This function should not be called. |
va009039 | 0:65f1469d6bfb | 30 | */ |
va009039 | 0:65f1469d6bfb | 31 | PmReturn_t retval; |
va009039 | 0:65f1469d6bfb | 32 | PM_RAISE(retval, PM_RET_EX_SYS); |
va009039 | 0:65f1469d6bfb | 33 | return retval; |
va009039 | 0:65f1469d6bfb | 34 | |
va009039 | 0:65f1469d6bfb | 35 | } |
va009039 | 0:65f1469d6bfb | 36 | |
va009039 | 0:65f1469d6bfb | 37 | PmReturn_t |
va009039 | 0:65f1469d6bfb | 38 | nat_01_mbed___init__(pPmFrame_t *ppframe) |
va009039 | 0:65f1469d6bfb | 39 | { |
va009039 | 0:65f1469d6bfb | 40 | |
va009039 | 2:a2bea117e22e | 41 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 42 | return nci.init<DigitalOut,PinName>(OBJ_TYPE_INT); |
va009039 | 1:28afb064a41c | 43 | |
va009039 | 1:28afb064a41c | 44 | } |
va009039 | 1:28afb064a41c | 45 | |
va009039 | 1:28afb064a41c | 46 | PmReturn_t |
va009039 | 1:28afb064a41c | 47 | nat_02_mbed_write(pPmFrame_t *ppframe) |
va009039 | 1:28afb064a41c | 48 | { |
va009039 | 1:28afb064a41c | 49 | |
va009039 | 2:a2bea117e22e | 50 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 51 | return nci.method<DigitalOut,int,&DigitalOut::write>(OBJ_TYPE_NON, OBJ_TYPE_INT); |
va009039 | 1:28afb064a41c | 52 | |
va009039 | 1:28afb064a41c | 53 | } |
va009039 | 1:28afb064a41c | 54 | |
va009039 | 1:28afb064a41c | 55 | PmReturn_t |
va009039 | 1:28afb064a41c | 56 | nat_03_mbed_read(pPmFrame_t *ppframe) |
va009039 | 1:28afb064a41c | 57 | { |
va009039 | 1:28afb064a41c | 58 | |
va009039 | 2:a2bea117e22e | 59 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 60 | return nci.method<int,DigitalOut,&DigitalOut::read>(OBJ_TYPE_INT); |
va009039 | 1:28afb064a41c | 61 | |
va009039 | 1:28afb064a41c | 62 | } |
va009039 | 1:28afb064a41c | 63 | |
va009039 | 1:28afb064a41c | 64 | PmReturn_t |
va009039 | 1:28afb064a41c | 65 | nat_04_mbed___init__(pPmFrame_t *ppframe) |
va009039 | 1:28afb064a41c | 66 | { |
va009039 | 1:28afb064a41c | 67 | |
va009039 | 2:a2bea117e22e | 68 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 69 | return nci.init<DigitalIn,PinName>(OBJ_TYPE_INT); |
va009039 | 1:28afb064a41c | 70 | |
va009039 | 1:28afb064a41c | 71 | } |
va009039 | 1:28afb064a41c | 72 | |
va009039 | 1:28afb064a41c | 73 | PmReturn_t |
va009039 | 1:28afb064a41c | 74 | nat_05_mbed_read(pPmFrame_t *ppframe) |
va009039 | 1:28afb064a41c | 75 | { |
va009039 | 1:28afb064a41c | 76 | |
va009039 | 2:a2bea117e22e | 77 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 78 | return nci.method<int,DigitalIn,&DigitalIn::read>(OBJ_TYPE_INT); |
va009039 | 1:28afb064a41c | 79 | |
va009039 | 1:28afb064a41c | 80 | } |
va009039 | 1:28afb064a41c | 81 | |
va009039 | 1:28afb064a41c | 82 | PmReturn_t |
va009039 | 1:28afb064a41c | 83 | nat_06_mbed___init__(pPmFrame_t *ppframe) |
va009039 | 1:28afb064a41c | 84 | { |
va009039 | 1:28afb064a41c | 85 | |
va009039 | 2:a2bea117e22e | 86 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 87 | return nci.init<DigitalInOut,PinName>(OBJ_TYPE_INT); |
va009039 | 2:a2bea117e22e | 88 | |
va009039 | 2:a2bea117e22e | 89 | } |
va009039 | 0:65f1469d6bfb | 90 | |
va009039 | 2:a2bea117e22e | 91 | PmReturn_t |
va009039 | 2:a2bea117e22e | 92 | nat_07_mbed_read(pPmFrame_t *ppframe) |
va009039 | 2:a2bea117e22e | 93 | { |
va009039 | 0:65f1469d6bfb | 94 | |
va009039 | 2:a2bea117e22e | 95 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 96 | return nci.method<int,DigitalInOut,&DigitalInOut::read>(OBJ_TYPE_INT); |
va009039 | 0:65f1469d6bfb | 97 | |
va009039 | 0:65f1469d6bfb | 98 | } |
va009039 | 0:65f1469d6bfb | 99 | |
va009039 | 0:65f1469d6bfb | 100 | PmReturn_t |
va009039 | 2:a2bea117e22e | 101 | nat_08_mbed_write(pPmFrame_t *ppframe) |
va009039 | 0:65f1469d6bfb | 102 | { |
va009039 | 0:65f1469d6bfb | 103 | |
va009039 | 2:a2bea117e22e | 104 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 105 | return nci.method<DigitalInOut,int,&DigitalInOut::write>(OBJ_TYPE_NON, OBJ_TYPE_INT); |
va009039 | 0:65f1469d6bfb | 106 | |
va009039 | 0:65f1469d6bfb | 107 | } |
va009039 | 0:65f1469d6bfb | 108 | |
va009039 | 0:65f1469d6bfb | 109 | PmReturn_t |
va009039 | 2:a2bea117e22e | 110 | nat_09_mbed_input(pPmFrame_t *ppframe) |
va009039 | 0:65f1469d6bfb | 111 | { |
va009039 | 0:65f1469d6bfb | 112 | |
va009039 | 2:a2bea117e22e | 113 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 114 | return nci.method<DigitalInOut,&DigitalInOut::input>(OBJ_TYPE_NON); |
va009039 | 2:a2bea117e22e | 115 | |
va009039 | 2:a2bea117e22e | 116 | } |
va009039 | 0:65f1469d6bfb | 117 | |
va009039 | 2:a2bea117e22e | 118 | PmReturn_t |
va009039 | 2:a2bea117e22e | 119 | nat_10_mbed_output(pPmFrame_t *ppframe) |
va009039 | 2:a2bea117e22e | 120 | { |
va009039 | 0:65f1469d6bfb | 121 | |
va009039 | 2:a2bea117e22e | 122 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 123 | return nci.method<DigitalInOut,&DigitalInOut::output>(OBJ_TYPE_NON); |
va009039 | 0:65f1469d6bfb | 124 | |
va009039 | 0:65f1469d6bfb | 125 | } |
va009039 | 0:65f1469d6bfb | 126 | |
va009039 | 0:65f1469d6bfb | 127 | PmReturn_t |
va009039 | 2:a2bea117e22e | 128 | nat_11_mbed___init__(pPmFrame_t *ppframe) |
va009039 | 0:65f1469d6bfb | 129 | { |
va009039 | 0:65f1469d6bfb | 130 | |
va009039 | 2:a2bea117e22e | 131 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 132 | return nci.init<AnalogIn,PinName>(OBJ_TYPE_INT); |
va009039 | 2:a2bea117e22e | 133 | |
va009039 | 2:a2bea117e22e | 134 | } |
va009039 | 0:65f1469d6bfb | 135 | |
va009039 | 2:a2bea117e22e | 136 | PmReturn_t |
va009039 | 2:a2bea117e22e | 137 | nat_12_mbed_read_u16(pPmFrame_t *ppframe) |
va009039 | 2:a2bea117e22e | 138 | { |
va009039 | 0:65f1469d6bfb | 139 | |
va009039 | 2:a2bea117e22e | 140 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 141 | return nci.method<uint16_t,AnalogIn,&AnalogIn::read_u16>(OBJ_TYPE_INT); |
va009039 | 0:65f1469d6bfb | 142 | |
va009039 | 0:65f1469d6bfb | 143 | } |
va009039 | 0:65f1469d6bfb | 144 | |
va009039 | 0:65f1469d6bfb | 145 | PmReturn_t |
va009039 | 2:a2bea117e22e | 146 | nat_13_mbed_read(pPmFrame_t *ppframe) |
va009039 | 0:65f1469d6bfb | 147 | { |
va009039 | 0:65f1469d6bfb | 148 | |
va009039 | 2:a2bea117e22e | 149 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 150 | return nci.method<float,AnalogIn,&AnalogIn::read>(OBJ_TYPE_FLT); |
va009039 | 0:65f1469d6bfb | 151 | |
va009039 | 0:65f1469d6bfb | 152 | } |
va009039 | 0:65f1469d6bfb | 153 | |
va009039 | 0:65f1469d6bfb | 154 | PmReturn_t |
va009039 | 2:a2bea117e22e | 155 | nat_14_mbed___init__(pPmFrame_t *ppframe) |
va009039 | 2:a2bea117e22e | 156 | { |
va009039 | 2:a2bea117e22e | 157 | |
va009039 | 2:a2bea117e22e | 158 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 159 | return nci.init<AnalogOut,PinName>(OBJ_TYPE_INT); |
va009039 | 2:a2bea117e22e | 160 | |
va009039 | 2:a2bea117e22e | 161 | } |
va009039 | 2:a2bea117e22e | 162 | |
va009039 | 2:a2bea117e22e | 163 | PmReturn_t |
va009039 | 2:a2bea117e22e | 164 | nat_15_mbed_write_u16(pPmFrame_t *ppframe) |
va009039 | 0:65f1469d6bfb | 165 | { |
va009039 | 0:65f1469d6bfb | 166 | |
va009039 | 2:a2bea117e22e | 167 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 168 | return nci.method<AnalogOut,uint16_t,&AnalogOut::write_u16>(OBJ_TYPE_NON, OBJ_TYPE_INT); |
va009039 | 2:a2bea117e22e | 169 | |
va009039 | 2:a2bea117e22e | 170 | } |
va009039 | 0:65f1469d6bfb | 171 | |
va009039 | 2:a2bea117e22e | 172 | PmReturn_t |
va009039 | 2:a2bea117e22e | 173 | nat_16_mbed_write(pPmFrame_t *ppframe) |
va009039 | 2:a2bea117e22e | 174 | { |
va009039 | 0:65f1469d6bfb | 175 | |
va009039 | 2:a2bea117e22e | 176 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 177 | return nci.method<AnalogOut,float,&AnalogOut::write>(OBJ_TYPE_NON, OBJ_TYPE_FLT); |
va009039 | 0:65f1469d6bfb | 178 | |
va009039 | 0:65f1469d6bfb | 179 | } |
va009039 | 0:65f1469d6bfb | 180 | |
va009039 | 0:65f1469d6bfb | 181 | PmReturn_t |
va009039 | 2:a2bea117e22e | 182 | nat_17_mbed_read(pPmFrame_t *ppframe) |
va009039 | 0:65f1469d6bfb | 183 | { |
va009039 | 0:65f1469d6bfb | 184 | |
va009039 | 2:a2bea117e22e | 185 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 186 | return nci.method<float,AnalogOut,&AnalogOut::read>(OBJ_TYPE_FLT); |
va009039 | 2:a2bea117e22e | 187 | |
va009039 | 2:a2bea117e22e | 188 | } |
va009039 | 0:65f1469d6bfb | 189 | |
va009039 | 2:a2bea117e22e | 190 | PmReturn_t |
va009039 | 2:a2bea117e22e | 191 | nat_18_mbed___init__(pPmFrame_t *ppframe) |
va009039 | 2:a2bea117e22e | 192 | { |
va009039 | 0:65f1469d6bfb | 193 | |
va009039 | 2:a2bea117e22e | 194 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 195 | return nci.init<PwmOut,PinName>(OBJ_TYPE_INT); |
va009039 | 0:65f1469d6bfb | 196 | |
va009039 | 0:65f1469d6bfb | 197 | } |
va009039 | 0:65f1469d6bfb | 198 | |
va009039 | 0:65f1469d6bfb | 199 | PmReturn_t |
va009039 | 2:a2bea117e22e | 200 | nat_19_mbed_write(pPmFrame_t *ppframe) |
va009039 | 0:65f1469d6bfb | 201 | { |
va009039 | 0:65f1469d6bfb | 202 | |
va009039 | 2:a2bea117e22e | 203 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 204 | return nci.method<PwmOut,float,&PwmOut::write>(OBJ_TYPE_NON, OBJ_TYPE_FLT); |
va009039 | 0:65f1469d6bfb | 205 | |
va009039 | 0:65f1469d6bfb | 206 | } |
va009039 | 0:65f1469d6bfb | 207 | |
va009039 | 0:65f1469d6bfb | 208 | PmReturn_t |
va009039 | 2:a2bea117e22e | 209 | nat_20_mbed_read(pPmFrame_t *ppframe) |
va009039 | 1:28afb064a41c | 210 | { |
va009039 | 1:28afb064a41c | 211 | |
va009039 | 2:a2bea117e22e | 212 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 213 | return nci.method<float,PwmOut,&PwmOut::read>(OBJ_TYPE_FLT); |
va009039 | 1:28afb064a41c | 214 | |
va009039 | 1:28afb064a41c | 215 | } |
va009039 | 1:28afb064a41c | 216 | |
va009039 | 1:28afb064a41c | 217 | PmReturn_t |
va009039 | 2:a2bea117e22e | 218 | nat_21_mbed_period(pPmFrame_t *ppframe) |
va009039 | 0:65f1469d6bfb | 219 | { |
va009039 | 0:65f1469d6bfb | 220 | |
va009039 | 2:a2bea117e22e | 221 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 222 | return nci.method<PwmOut,float,&PwmOut::period>(OBJ_TYPE_NON, OBJ_TYPE_FLT); |
va009039 | 0:65f1469d6bfb | 223 | |
va009039 | 0:65f1469d6bfb | 224 | } |
va009039 | 0:65f1469d6bfb | 225 | |
va009039 | 0:65f1469d6bfb | 226 | PmReturn_t |
va009039 | 2:a2bea117e22e | 227 | nat_22_mbed_period_ms(pPmFrame_t *ppframe) |
va009039 | 0:65f1469d6bfb | 228 | { |
va009039 | 0:65f1469d6bfb | 229 | |
va009039 | 2:a2bea117e22e | 230 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 231 | return nci.method<PwmOut,int,&PwmOut::period_ms>(OBJ_TYPE_NON, OBJ_TYPE_INT); |
va009039 | 0:65f1469d6bfb | 232 | |
va009039 | 0:65f1469d6bfb | 233 | } |
va009039 | 0:65f1469d6bfb | 234 | |
va009039 | 0:65f1469d6bfb | 235 | PmReturn_t |
va009039 | 2:a2bea117e22e | 236 | nat_23_mbed_period_us(pPmFrame_t *ppframe) |
va009039 | 0:65f1469d6bfb | 237 | { |
va009039 | 0:65f1469d6bfb | 238 | |
va009039 | 2:a2bea117e22e | 239 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 240 | return nci.method<PwmOut,int,&PwmOut::period_us>(OBJ_TYPE_NON, OBJ_TYPE_INT); |
va009039 | 0:65f1469d6bfb | 241 | |
va009039 | 0:65f1469d6bfb | 242 | } |
va009039 | 0:65f1469d6bfb | 243 | |
va009039 | 0:65f1469d6bfb | 244 | PmReturn_t |
va009039 | 2:a2bea117e22e | 245 | nat_24_mbed_pulsewidth(pPmFrame_t *ppframe) |
va009039 | 0:65f1469d6bfb | 246 | { |
va009039 | 0:65f1469d6bfb | 247 | |
va009039 | 2:a2bea117e22e | 248 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 249 | return nci.method<PwmOut,float,&PwmOut::pulsewidth>(OBJ_TYPE_NON, OBJ_TYPE_FLT); |
va009039 | 0:65f1469d6bfb | 250 | |
va009039 | 0:65f1469d6bfb | 251 | } |
va009039 | 0:65f1469d6bfb | 252 | |
va009039 | 0:65f1469d6bfb | 253 | PmReturn_t |
va009039 | 2:a2bea117e22e | 254 | nat_25_mbed_pulsewidth_ms(pPmFrame_t *ppframe) |
va009039 | 2:a2bea117e22e | 255 | { |
va009039 | 2:a2bea117e22e | 256 | |
va009039 | 2:a2bea117e22e | 257 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 258 | return nci.method<PwmOut,int,&PwmOut::pulsewidth_ms>(OBJ_TYPE_NON, OBJ_TYPE_INT); |
va009039 | 2:a2bea117e22e | 259 | |
va009039 | 2:a2bea117e22e | 260 | } |
va009039 | 2:a2bea117e22e | 261 | |
va009039 | 2:a2bea117e22e | 262 | PmReturn_t |
va009039 | 2:a2bea117e22e | 263 | nat_26_mbed_pulsewidth_us(pPmFrame_t *ppframe) |
va009039 | 0:65f1469d6bfb | 264 | { |
va009039 | 0:65f1469d6bfb | 265 | |
va009039 | 2:a2bea117e22e | 266 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 267 | return nci.method<PwmOut,int,&PwmOut::pulsewidth_us>(OBJ_TYPE_NON, OBJ_TYPE_INT); |
va009039 | 2:a2bea117e22e | 268 | |
va009039 | 2:a2bea117e22e | 269 | } |
va009039 | 0:65f1469d6bfb | 270 | |
va009039 | 2:a2bea117e22e | 271 | PmReturn_t |
va009039 | 2:a2bea117e22e | 272 | nat_27_mbed___init__(pPmFrame_t *ppframe) |
va009039 | 2:a2bea117e22e | 273 | { |
va009039 | 0:65f1469d6bfb | 274 | |
va009039 | 2:a2bea117e22e | 275 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 276 | return nci.init<Serial,PinName,PinName>(OBJ_TYPE_INT, OBJ_TYPE_INT); |
va009039 | 0:65f1469d6bfb | 277 | |
va009039 | 0:65f1469d6bfb | 278 | } |
va009039 | 0:65f1469d6bfb | 279 | |
va009039 | 0:65f1469d6bfb | 280 | PmReturn_t |
va009039 | 2:a2bea117e22e | 281 | nat_28_mbed_baud(pPmFrame_t *ppframe) |
va009039 | 0:65f1469d6bfb | 282 | { |
va009039 | 0:65f1469d6bfb | 283 | |
va009039 | 2:a2bea117e22e | 284 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 285 | return nci.method<Serial,int,&Serial::baud>(OBJ_TYPE_NON, OBJ_TYPE_INT); |
va009039 | 2:a2bea117e22e | 286 | |
va009039 | 2:a2bea117e22e | 287 | } |
va009039 | 0:65f1469d6bfb | 288 | |
va009039 | 2:a2bea117e22e | 289 | PmReturn_t |
va009039 | 2:a2bea117e22e | 290 | nat_29_mbed_readable(pPmFrame_t *ppframe) |
va009039 | 2:a2bea117e22e | 291 | { |
va009039 | 0:65f1469d6bfb | 292 | |
va009039 | 2:a2bea117e22e | 293 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 294 | return nci.method<int,Serial,&Serial::readable>(OBJ_TYPE_INT); |
va009039 | 0:65f1469d6bfb | 295 | |
va009039 | 0:65f1469d6bfb | 296 | } |
va009039 | 0:65f1469d6bfb | 297 | |
va009039 | 0:65f1469d6bfb | 298 | PmReturn_t |
va009039 | 2:a2bea117e22e | 299 | nat_30_mbed_writeable(pPmFrame_t *ppframe) |
va009039 | 0:65f1469d6bfb | 300 | { |
va009039 | 0:65f1469d6bfb | 301 | |
va009039 | 2:a2bea117e22e | 302 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 303 | return nci.method<int,Serial,&Serial::writeable>(OBJ_TYPE_INT); |
va009039 | 0:65f1469d6bfb | 304 | |
va009039 | 0:65f1469d6bfb | 305 | } |
va009039 | 0:65f1469d6bfb | 306 | |
va009039 | 0:65f1469d6bfb | 307 | PmReturn_t |
va009039 | 2:a2bea117e22e | 308 | nat_31_mbed_putc(pPmFrame_t *ppframe) |
va009039 | 0:65f1469d6bfb | 309 | { |
va009039 | 0:65f1469d6bfb | 310 | |
va009039 | 2:a2bea117e22e | 311 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 312 | Serial* obj; |
va009039 | 2:a2bea117e22e | 313 | nci._load_obj<Serial>(&obj); |
va009039 | 2:a2bea117e22e | 314 | int r = obj->putc(nci.argv<int>(1)); |
va009039 | 2:a2bea117e22e | 315 | return nci.set_return_value<int>(OBJ_TYPE_INT, r); |
va009039 | 2:a2bea117e22e | 316 | //return nci.method<int,Serial,int,&Serial::putc>(OBJ_TYPE_INT, OBJ_TYPE_STR); |
va009039 | 0:65f1469d6bfb | 317 | |
va009039 | 0:65f1469d6bfb | 318 | } |
va009039 | 0:65f1469d6bfb | 319 | |
va009039 | 0:65f1469d6bfb | 320 | PmReturn_t |
va009039 | 2:a2bea117e22e | 321 | nat_32_mbed_puts(pPmFrame_t *ppframe) |
va009039 | 0:65f1469d6bfb | 322 | { |
va009039 | 0:65f1469d6bfb | 323 | |
va009039 | 2:a2bea117e22e | 324 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 325 | Serial* obj; |
va009039 | 2:a2bea117e22e | 326 | nci._load_obj<Serial>(&obj); |
va009039 | 2:a2bea117e22e | 327 | int r = obj->puts(nci.argv<const char*>(1)); |
va009039 | 2:a2bea117e22e | 328 | return nci.set_return_value<int>(OBJ_TYPE_INT, r); |
va009039 | 2:a2bea117e22e | 329 | //return nci.method<int,Serial,char*,&Serial::puts>(OBJ_TYPE_INT, OBJ_TYPE_STR); |
va009039 | 0:65f1469d6bfb | 330 | |
va009039 | 0:65f1469d6bfb | 331 | } |
va009039 | 0:65f1469d6bfb | 332 | |
va009039 | 0:65f1469d6bfb | 333 | PmReturn_t |
va009039 | 2:a2bea117e22e | 334 | nat_33_mbed_getc(pPmFrame_t *ppframe) |
va009039 | 0:65f1469d6bfb | 335 | { |
va009039 | 0:65f1469d6bfb | 336 | |
va009039 | 2:a2bea117e22e | 337 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 338 | Serial* obj; |
va009039 | 2:a2bea117e22e | 339 | nci._load_obj<Serial>(&obj); |
va009039 | 2:a2bea117e22e | 340 | int r = obj->getc(); |
va009039 | 2:a2bea117e22e | 341 | return nci.set_return_value<int>(OBJ_TYPE_STR, r); |
va009039 | 2:a2bea117e22e | 342 | //return nci.method<int,Serial,&Serial::getc>(OBJ_TYPE_STR); |
va009039 | 0:65f1469d6bfb | 343 | |
va009039 | 0:65f1469d6bfb | 344 | } |
va009039 | 0:65f1469d6bfb | 345 | |
va009039 | 0:65f1469d6bfb | 346 | PmReturn_t |
va009039 | 2:a2bea117e22e | 347 | nat_34_mbed___init__(pPmFrame_t *ppframe) |
va009039 | 2:a2bea117e22e | 348 | { |
va009039 | 2:a2bea117e22e | 349 | |
va009039 | 2:a2bea117e22e | 350 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 351 | return nci.init<SPI,PinName,PinName,PinName>(OBJ_TYPE_INT, OBJ_TYPE_INT, OBJ_TYPE_INT); |
va009039 | 2:a2bea117e22e | 352 | |
va009039 | 2:a2bea117e22e | 353 | } |
va009039 | 2:a2bea117e22e | 354 | |
va009039 | 2:a2bea117e22e | 355 | PmReturn_t |
va009039 | 2:a2bea117e22e | 356 | nat_35_mbed_format(pPmFrame_t *ppframe) |
va009039 | 0:65f1469d6bfb | 357 | { |
va009039 | 0:65f1469d6bfb | 358 | |
va009039 | 2:a2bea117e22e | 359 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 360 | return nci.method<SPI,int,int,&SPI::format>(OBJ_TYPE_NON, OBJ_TYPE_INT, OBJ_TYPE_INT); |
va009039 | 2:a2bea117e22e | 361 | |
va009039 | 2:a2bea117e22e | 362 | } |
va009039 | 0:65f1469d6bfb | 363 | |
va009039 | 2:a2bea117e22e | 364 | PmReturn_t |
va009039 | 2:a2bea117e22e | 365 | nat_36_mbed_frequency(pPmFrame_t *ppframe) |
va009039 | 2:a2bea117e22e | 366 | { |
va009039 | 0:65f1469d6bfb | 367 | |
va009039 | 2:a2bea117e22e | 368 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 369 | return nci.method<SPI,int,&SPI::frequency>(OBJ_TYPE_NON, OBJ_TYPE_INT); |
va009039 | 0:65f1469d6bfb | 370 | |
va009039 | 0:65f1469d6bfb | 371 | } |
va009039 | 0:65f1469d6bfb | 372 | |
va009039 | 0:65f1469d6bfb | 373 | PmReturn_t |
va009039 | 2:a2bea117e22e | 374 | nat_37_mbed_write(pPmFrame_t *ppframe) |
va009039 | 0:65f1469d6bfb | 375 | { |
va009039 | 0:65f1469d6bfb | 376 | |
va009039 | 2:a2bea117e22e | 377 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 378 | return nci.method<int,SPI,int,&SPI::write>(OBJ_TYPE_INT, OBJ_TYPE_INT); |
va009039 | 2:a2bea117e22e | 379 | |
va009039 | 2:a2bea117e22e | 380 | } |
va009039 | 0:65f1469d6bfb | 381 | |
va009039 | 2:a2bea117e22e | 382 | PmReturn_t |
va009039 | 2:a2bea117e22e | 383 | nat_38_mbed___init__(pPmFrame_t *ppframe) |
va009039 | 2:a2bea117e22e | 384 | { |
va009039 | 0:65f1469d6bfb | 385 | |
va009039 | 2:a2bea117e22e | 386 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 387 | return nci.init<I2C,PinName,PinName>(OBJ_TYPE_INT, OBJ_TYPE_INT); |
va009039 | 0:65f1469d6bfb | 388 | |
va009039 | 0:65f1469d6bfb | 389 | } |
va009039 | 0:65f1469d6bfb | 390 | |
va009039 | 0:65f1469d6bfb | 391 | PmReturn_t |
va009039 | 2:a2bea117e22e | 392 | nat_39_mbed_frequency(pPmFrame_t *ppframe) |
va009039 | 0:65f1469d6bfb | 393 | { |
va009039 | 0:65f1469d6bfb | 394 | |
va009039 | 2:a2bea117e22e | 395 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 396 | return nci.method<I2C,int,&I2C::frequency>(OBJ_TYPE_NON, OBJ_TYPE_INT); |
va009039 | 0:65f1469d6bfb | 397 | |
va009039 | 0:65f1469d6bfb | 398 | } |
va009039 | 0:65f1469d6bfb | 399 | |
va009039 | 0:65f1469d6bfb | 400 | PmReturn_t |
va009039 | 2:a2bea117e22e | 401 | nat_40_mbed_read(pPmFrame_t *ppframe) |
va009039 | 0:65f1469d6bfb | 402 | { |
va009039 | 0:65f1469d6bfb | 403 | |
va009039 | 2:a2bea117e22e | 404 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 405 | return nci.method<int,I2C,int,char*,int,bool,&I2C::read>(OBJ_TYPE_INT, |
va009039 | 2:a2bea117e22e | 406 | OBJ_TYPE_INT, OBJ_TYPE_STR, OBJ_TYPE_INT, OBJ_TYPE_INT); |
va009039 | 2:a2bea117e22e | 407 | |
va009039 | 2:a2bea117e22e | 408 | } |
va009039 | 0:65f1469d6bfb | 409 | |
va009039 | 2:a2bea117e22e | 410 | PmReturn_t |
va009039 | 2:a2bea117e22e | 411 | nat_41_mbed_write(pPmFrame_t *ppframe) |
va009039 | 2:a2bea117e22e | 412 | { |
va009039 | 0:65f1469d6bfb | 413 | |
va009039 | 2:a2bea117e22e | 414 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 415 | return nci.method<int,I2C,int,const char*,int,bool,&I2C::write>(OBJ_TYPE_INT, |
va009039 | 2:a2bea117e22e | 416 | OBJ_TYPE_INT, OBJ_TYPE_STR, OBJ_TYPE_INT, OBJ_TYPE_INT); |
va009039 | 0:65f1469d6bfb | 417 | |
va009039 | 0:65f1469d6bfb | 418 | } |
va009039 | 0:65f1469d6bfb | 419 | |
va009039 | 0:65f1469d6bfb | 420 | PmReturn_t |
va009039 | 2:a2bea117e22e | 421 | nat_42_mbed___init__(pPmFrame_t *ppframe) |
va009039 | 0:65f1469d6bfb | 422 | { |
va009039 | 0:65f1469d6bfb | 423 | |
va009039 | 2:a2bea117e22e | 424 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 425 | return nci.init<Timer>(); |
va009039 | 0:65f1469d6bfb | 426 | |
va009039 | 0:65f1469d6bfb | 427 | } |
va009039 | 0:65f1469d6bfb | 428 | |
va009039 | 0:65f1469d6bfb | 429 | PmReturn_t |
va009039 | 2:a2bea117e22e | 430 | nat_43_mbed_start(pPmFrame_t *ppframe) |
va009039 | 0:65f1469d6bfb | 431 | { |
va009039 | 0:65f1469d6bfb | 432 | |
va009039 | 2:a2bea117e22e | 433 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 434 | return nci.method<Timer,&Timer::start>(OBJ_TYPE_NON); |
va009039 | 2:a2bea117e22e | 435 | |
va009039 | 2:a2bea117e22e | 436 | } |
va009039 | 0:65f1469d6bfb | 437 | |
va009039 | 2:a2bea117e22e | 438 | PmReturn_t |
va009039 | 2:a2bea117e22e | 439 | nat_44_mbed_stop(pPmFrame_t *ppframe) |
va009039 | 2:a2bea117e22e | 440 | { |
va009039 | 0:65f1469d6bfb | 441 | |
va009039 | 2:a2bea117e22e | 442 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 443 | return nci.method<Timer,&Timer::stop>(OBJ_TYPE_NON); |
va009039 | 0:65f1469d6bfb | 444 | |
va009039 | 0:65f1469d6bfb | 445 | } |
va009039 | 0:65f1469d6bfb | 446 | |
va009039 | 0:65f1469d6bfb | 447 | PmReturn_t |
va009039 | 2:a2bea117e22e | 448 | nat_45_mbed_reset(pPmFrame_t *ppframe) |
va009039 | 0:65f1469d6bfb | 449 | { |
va009039 | 0:65f1469d6bfb | 450 | |
va009039 | 2:a2bea117e22e | 451 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 452 | return nci.method<Timer,&Timer::reset>(OBJ_TYPE_NON); |
va009039 | 0:65f1469d6bfb | 453 | |
va009039 | 0:65f1469d6bfb | 454 | } |
va009039 | 0:65f1469d6bfb | 455 | |
va009039 | 0:65f1469d6bfb | 456 | PmReturn_t |
va009039 | 2:a2bea117e22e | 457 | nat_46_mbed_read(pPmFrame_t *ppframe) |
va009039 | 2:a2bea117e22e | 458 | { |
va009039 | 2:a2bea117e22e | 459 | |
va009039 | 2:a2bea117e22e | 460 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 461 | return nci.method<float,Timer,&Timer::read>(OBJ_TYPE_FLT); |
va009039 | 2:a2bea117e22e | 462 | |
va009039 | 2:a2bea117e22e | 463 | } |
va009039 | 2:a2bea117e22e | 464 | |
va009039 | 2:a2bea117e22e | 465 | PmReturn_t |
va009039 | 2:a2bea117e22e | 466 | nat_47_mbed_read_ms(pPmFrame_t *ppframe) |
va009039 | 0:65f1469d6bfb | 467 | { |
va009039 | 0:65f1469d6bfb | 468 | |
va009039 | 2:a2bea117e22e | 469 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 470 | return nci.method<int,Timer,&Timer::read_ms>(OBJ_TYPE_INT); |
va009039 | 2:a2bea117e22e | 471 | |
va009039 | 2:a2bea117e22e | 472 | } |
va009039 | 0:65f1469d6bfb | 473 | |
va009039 | 2:a2bea117e22e | 474 | PmReturn_t |
va009039 | 2:a2bea117e22e | 475 | nat_48_mbed_read_us(pPmFrame_t *ppframe) |
va009039 | 2:a2bea117e22e | 476 | { |
va009039 | 0:65f1469d6bfb | 477 | |
va009039 | 2:a2bea117e22e | 478 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 479 | return nci.method<int,Timer,&Timer::read_us>(OBJ_TYPE_INT); |
va009039 | 0:65f1469d6bfb | 480 | |
va009039 | 0:65f1469d6bfb | 481 | } |
va009039 | 0:65f1469d6bfb | 482 | |
va009039 | 0:65f1469d6bfb | 483 | /* Native function lookup table */ |
va009039 | 0:65f1469d6bfb | 484 | pPmNativeFxn_t const usr_nat_fxn_table[] = |
va009039 | 0:65f1469d6bfb | 485 | { |
va009039 | 0:65f1469d6bfb | 486 | nat_placeholder_func, |
va009039 | 0:65f1469d6bfb | 487 | nat_01_mbed___init__, |
va009039 | 1:28afb064a41c | 488 | nat_02_mbed_write, |
va009039 | 0:65f1469d6bfb | 489 | nat_03_mbed_read, |
va009039 | 0:65f1469d6bfb | 490 | nat_04_mbed___init__, |
va009039 | 1:28afb064a41c | 491 | nat_05_mbed_read, |
va009039 | 1:28afb064a41c | 492 | nat_06_mbed___init__, |
va009039 | 2:a2bea117e22e | 493 | nat_07_mbed_read, |
va009039 | 2:a2bea117e22e | 494 | nat_08_mbed_write, |
va009039 | 2:a2bea117e22e | 495 | nat_09_mbed_input, |
va009039 | 2:a2bea117e22e | 496 | nat_10_mbed_output, |
va009039 | 2:a2bea117e22e | 497 | nat_11_mbed___init__, |
va009039 | 2:a2bea117e22e | 498 | nat_12_mbed_read_u16, |
va009039 | 2:a2bea117e22e | 499 | nat_13_mbed_read, |
va009039 | 2:a2bea117e22e | 500 | nat_14_mbed___init__, |
va009039 | 2:a2bea117e22e | 501 | nat_15_mbed_write_u16, |
va009039 | 2:a2bea117e22e | 502 | nat_16_mbed_write, |
va009039 | 2:a2bea117e22e | 503 | nat_17_mbed_read, |
va009039 | 2:a2bea117e22e | 504 | nat_18_mbed___init__, |
va009039 | 2:a2bea117e22e | 505 | nat_19_mbed_write, |
va009039 | 2:a2bea117e22e | 506 | nat_20_mbed_read, |
va009039 | 2:a2bea117e22e | 507 | nat_21_mbed_period, |
va009039 | 2:a2bea117e22e | 508 | nat_22_mbed_period_ms, |
va009039 | 2:a2bea117e22e | 509 | nat_23_mbed_period_us, |
va009039 | 2:a2bea117e22e | 510 | nat_24_mbed_pulsewidth, |
va009039 | 2:a2bea117e22e | 511 | nat_25_mbed_pulsewidth_ms, |
va009039 | 2:a2bea117e22e | 512 | nat_26_mbed_pulsewidth_us, |
va009039 | 2:a2bea117e22e | 513 | nat_27_mbed___init__, |
va009039 | 2:a2bea117e22e | 514 | nat_28_mbed_baud, |
va009039 | 2:a2bea117e22e | 515 | nat_29_mbed_readable, |
va009039 | 2:a2bea117e22e | 516 | nat_30_mbed_writeable, |
va009039 | 2:a2bea117e22e | 517 | nat_31_mbed_putc, |
va009039 | 2:a2bea117e22e | 518 | nat_32_mbed_puts, |
va009039 | 2:a2bea117e22e | 519 | nat_33_mbed_getc, |
va009039 | 2:a2bea117e22e | 520 | nat_34_mbed___init__, |
va009039 | 2:a2bea117e22e | 521 | nat_35_mbed_format, |
va009039 | 2:a2bea117e22e | 522 | nat_36_mbed_frequency, |
va009039 | 2:a2bea117e22e | 523 | nat_37_mbed_write, |
va009039 | 2:a2bea117e22e | 524 | nat_38_mbed___init__, |
va009039 | 2:a2bea117e22e | 525 | nat_39_mbed_frequency, |
va009039 | 2:a2bea117e22e | 526 | nat_40_mbed_read, |
va009039 | 2:a2bea117e22e | 527 | nat_41_mbed_write, |
va009039 | 2:a2bea117e22e | 528 | nat_42_mbed___init__, |
va009039 | 2:a2bea117e22e | 529 | nat_43_mbed_start, |
va009039 | 2:a2bea117e22e | 530 | nat_44_mbed_stop, |
va009039 | 2:a2bea117e22e | 531 | nat_45_mbed_reset, |
va009039 | 2:a2bea117e22e | 532 | nat_46_mbed_read, |
va009039 | 2:a2bea117e22e | 533 | nat_47_mbed_read_ms, |
va009039 | 2:a2bea117e22e | 534 | nat_48_mbed_read_us, |
va009039 | 0:65f1469d6bfb | 535 | }; |