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