Davi Souza
/
pymite
python
Fork of pymite by
platform/mbed/main_nat.cpp@4:23becb24acb8, 2013-03-16 (annotated)
- Committer:
- va009039
- Date:
- Sat Mar 16 13:29:02 2013 +0000
- Revision:
- 4:23becb24acb8
- Parent:
- 3:559c4bd38111
- Child:
- 5:19bd98307341
add TSI for KL25Z
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 | 2:a2bea117e22e | 288 | return nci.method<Serial,int,&Serial::baud>(OBJ_TYPE_NON, OBJ_TYPE_INT); |
va009039 | 2:a2bea117e22e | 289 | |
va009039 | 2:a2bea117e22e | 290 | } |
va009039 | 0:65f1469d6bfb | 291 | |
va009039 | 2:a2bea117e22e | 292 | PmReturn_t |
va009039 | 2:a2bea117e22e | 293 | nat_29_mbed_readable(pPmFrame_t *ppframe) |
va009039 | 2:a2bea117e22e | 294 | { |
va009039 | 0:65f1469d6bfb | 295 | |
va009039 | 2:a2bea117e22e | 296 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 297 | return nci.method<int,Serial,&Serial::readable>(OBJ_TYPE_INT); |
va009039 | 0:65f1469d6bfb | 298 | |
va009039 | 0:65f1469d6bfb | 299 | } |
va009039 | 0:65f1469d6bfb | 300 | |
va009039 | 0:65f1469d6bfb | 301 | PmReturn_t |
va009039 | 2:a2bea117e22e | 302 | nat_30_mbed_writeable(pPmFrame_t *ppframe) |
va009039 | 0:65f1469d6bfb | 303 | { |
va009039 | 0:65f1469d6bfb | 304 | |
va009039 | 2:a2bea117e22e | 305 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 306 | return nci.method<int,Serial,&Serial::writeable>(OBJ_TYPE_INT); |
va009039 | 0:65f1469d6bfb | 307 | |
va009039 | 0:65f1469d6bfb | 308 | } |
va009039 | 0:65f1469d6bfb | 309 | |
va009039 | 0:65f1469d6bfb | 310 | PmReturn_t |
va009039 | 2:a2bea117e22e | 311 | nat_31_mbed_putc(pPmFrame_t *ppframe) |
va009039 | 0:65f1469d6bfb | 312 | { |
va009039 | 0:65f1469d6bfb | 313 | |
va009039 | 2:a2bea117e22e | 314 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 315 | Serial* obj; |
va009039 | 2:a2bea117e22e | 316 | nci._load_obj<Serial>(&obj); |
va009039 | 2:a2bea117e22e | 317 | int r = obj->putc(nci.argv<int>(1)); |
va009039 | 2:a2bea117e22e | 318 | return nci.set_return_value<int>(OBJ_TYPE_INT, r); |
va009039 | 2:a2bea117e22e | 319 | //return nci.method<int,Serial,int,&Serial::putc>(OBJ_TYPE_INT, OBJ_TYPE_STR); |
va009039 | 0:65f1469d6bfb | 320 | |
va009039 | 0:65f1469d6bfb | 321 | } |
va009039 | 0:65f1469d6bfb | 322 | |
va009039 | 0:65f1469d6bfb | 323 | PmReturn_t |
va009039 | 2:a2bea117e22e | 324 | nat_32_mbed_puts(pPmFrame_t *ppframe) |
va009039 | 0:65f1469d6bfb | 325 | { |
va009039 | 0:65f1469d6bfb | 326 | |
va009039 | 2:a2bea117e22e | 327 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 328 | Serial* obj; |
va009039 | 2:a2bea117e22e | 329 | nci._load_obj<Serial>(&obj); |
va009039 | 2:a2bea117e22e | 330 | int r = obj->puts(nci.argv<const char*>(1)); |
va009039 | 2:a2bea117e22e | 331 | return nci.set_return_value<int>(OBJ_TYPE_INT, r); |
va009039 | 2:a2bea117e22e | 332 | //return nci.method<int,Serial,char*,&Serial::puts>(OBJ_TYPE_INT, OBJ_TYPE_STR); |
va009039 | 0:65f1469d6bfb | 333 | |
va009039 | 0:65f1469d6bfb | 334 | } |
va009039 | 0:65f1469d6bfb | 335 | |
va009039 | 0:65f1469d6bfb | 336 | PmReturn_t |
va009039 | 2:a2bea117e22e | 337 | nat_33_mbed_getc(pPmFrame_t *ppframe) |
va009039 | 0:65f1469d6bfb | 338 | { |
va009039 | 0:65f1469d6bfb | 339 | |
va009039 | 2:a2bea117e22e | 340 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 341 | Serial* obj; |
va009039 | 2:a2bea117e22e | 342 | nci._load_obj<Serial>(&obj); |
va009039 | 2:a2bea117e22e | 343 | int r = obj->getc(); |
va009039 | 2:a2bea117e22e | 344 | return nci.set_return_value<int>(OBJ_TYPE_STR, r); |
va009039 | 2:a2bea117e22e | 345 | //return nci.method<int,Serial,&Serial::getc>(OBJ_TYPE_STR); |
va009039 | 0:65f1469d6bfb | 346 | |
va009039 | 0:65f1469d6bfb | 347 | } |
va009039 | 0:65f1469d6bfb | 348 | |
va009039 | 0:65f1469d6bfb | 349 | PmReturn_t |
va009039 | 2:a2bea117e22e | 350 | nat_34_mbed___init__(pPmFrame_t *ppframe) |
va009039 | 2:a2bea117e22e | 351 | { |
va009039 | 2:a2bea117e22e | 352 | |
va009039 | 2:a2bea117e22e | 353 | NativeClassInterface nci; |
va009039 | 3:559c4bd38111 | 354 | return nci.init<SPI,PinName,PinName,PinName>(OBJ_TYPE_STR, OBJ_TYPE_STR, OBJ_TYPE_STR); |
va009039 | 2:a2bea117e22e | 355 | |
va009039 | 2:a2bea117e22e | 356 | } |
va009039 | 2:a2bea117e22e | 357 | |
va009039 | 2:a2bea117e22e | 358 | PmReturn_t |
va009039 | 2:a2bea117e22e | 359 | nat_35_mbed_format(pPmFrame_t *ppframe) |
va009039 | 0:65f1469d6bfb | 360 | { |
va009039 | 0:65f1469d6bfb | 361 | |
va009039 | 2:a2bea117e22e | 362 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 363 | return nci.method<SPI,int,int,&SPI::format>(OBJ_TYPE_NON, OBJ_TYPE_INT, OBJ_TYPE_INT); |
va009039 | 2:a2bea117e22e | 364 | |
va009039 | 2:a2bea117e22e | 365 | } |
va009039 | 0:65f1469d6bfb | 366 | |
va009039 | 2:a2bea117e22e | 367 | PmReturn_t |
va009039 | 2:a2bea117e22e | 368 | nat_36_mbed_frequency(pPmFrame_t *ppframe) |
va009039 | 2:a2bea117e22e | 369 | { |
va009039 | 0:65f1469d6bfb | 370 | |
va009039 | 2:a2bea117e22e | 371 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 372 | return nci.method<SPI,int,&SPI::frequency>(OBJ_TYPE_NON, OBJ_TYPE_INT); |
va009039 | 0:65f1469d6bfb | 373 | |
va009039 | 0:65f1469d6bfb | 374 | } |
va009039 | 0:65f1469d6bfb | 375 | |
va009039 | 0:65f1469d6bfb | 376 | PmReturn_t |
va009039 | 2:a2bea117e22e | 377 | nat_37_mbed_write(pPmFrame_t *ppframe) |
va009039 | 0:65f1469d6bfb | 378 | { |
va009039 | 0:65f1469d6bfb | 379 | |
va009039 | 2:a2bea117e22e | 380 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 381 | return nci.method<int,SPI,int,&SPI::write>(OBJ_TYPE_INT, OBJ_TYPE_INT); |
va009039 | 2:a2bea117e22e | 382 | |
va009039 | 2:a2bea117e22e | 383 | } |
va009039 | 0:65f1469d6bfb | 384 | |
va009039 | 2:a2bea117e22e | 385 | PmReturn_t |
va009039 | 2:a2bea117e22e | 386 | nat_38_mbed___init__(pPmFrame_t *ppframe) |
va009039 | 2:a2bea117e22e | 387 | { |
va009039 | 0:65f1469d6bfb | 388 | |
va009039 | 2:a2bea117e22e | 389 | NativeClassInterface nci; |
va009039 | 3:559c4bd38111 | 390 | return nci.init<I2C,PinName,PinName>(OBJ_TYPE_STR, OBJ_TYPE_STR); |
va009039 | 0:65f1469d6bfb | 391 | |
va009039 | 0:65f1469d6bfb | 392 | } |
va009039 | 0:65f1469d6bfb | 393 | |
va009039 | 0:65f1469d6bfb | 394 | PmReturn_t |
va009039 | 2:a2bea117e22e | 395 | nat_39_mbed_frequency(pPmFrame_t *ppframe) |
va009039 | 0:65f1469d6bfb | 396 | { |
va009039 | 0:65f1469d6bfb | 397 | |
va009039 | 2:a2bea117e22e | 398 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 399 | return nci.method<I2C,int,&I2C::frequency>(OBJ_TYPE_NON, OBJ_TYPE_INT); |
va009039 | 0:65f1469d6bfb | 400 | |
va009039 | 0:65f1469d6bfb | 401 | } |
va009039 | 0:65f1469d6bfb | 402 | |
va009039 | 0:65f1469d6bfb | 403 | PmReturn_t |
va009039 | 2:a2bea117e22e | 404 | nat_40_mbed_read(pPmFrame_t *ppframe) |
va009039 | 0:65f1469d6bfb | 405 | { |
va009039 | 0:65f1469d6bfb | 406 | |
va009039 | 2:a2bea117e22e | 407 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 408 | return nci.method<int,I2C,int,char*,int,bool,&I2C::read>(OBJ_TYPE_INT, |
va009039 | 2:a2bea117e22e | 409 | OBJ_TYPE_INT, OBJ_TYPE_STR, OBJ_TYPE_INT, OBJ_TYPE_INT); |
va009039 | 2:a2bea117e22e | 410 | |
va009039 | 2:a2bea117e22e | 411 | } |
va009039 | 0:65f1469d6bfb | 412 | |
va009039 | 2:a2bea117e22e | 413 | PmReturn_t |
va009039 | 2:a2bea117e22e | 414 | nat_41_mbed_write(pPmFrame_t *ppframe) |
va009039 | 2:a2bea117e22e | 415 | { |
va009039 | 0:65f1469d6bfb | 416 | |
va009039 | 2:a2bea117e22e | 417 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 418 | return nci.method<int,I2C,int,const char*,int,bool,&I2C::write>(OBJ_TYPE_INT, |
va009039 | 2:a2bea117e22e | 419 | OBJ_TYPE_INT, OBJ_TYPE_STR, OBJ_TYPE_INT, OBJ_TYPE_INT); |
va009039 | 0:65f1469d6bfb | 420 | |
va009039 | 0:65f1469d6bfb | 421 | } |
va009039 | 0:65f1469d6bfb | 422 | |
va009039 | 0:65f1469d6bfb | 423 | PmReturn_t |
va009039 | 2:a2bea117e22e | 424 | nat_42_mbed___init__(pPmFrame_t *ppframe) |
va009039 | 0:65f1469d6bfb | 425 | { |
va009039 | 0:65f1469d6bfb | 426 | |
va009039 | 2:a2bea117e22e | 427 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 428 | return nci.init<Timer>(); |
va009039 | 0:65f1469d6bfb | 429 | |
va009039 | 0:65f1469d6bfb | 430 | } |
va009039 | 0:65f1469d6bfb | 431 | |
va009039 | 0:65f1469d6bfb | 432 | PmReturn_t |
va009039 | 2:a2bea117e22e | 433 | nat_43_mbed_start(pPmFrame_t *ppframe) |
va009039 | 0:65f1469d6bfb | 434 | { |
va009039 | 0:65f1469d6bfb | 435 | |
va009039 | 2:a2bea117e22e | 436 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 437 | return nci.method<Timer,&Timer::start>(OBJ_TYPE_NON); |
va009039 | 2:a2bea117e22e | 438 | |
va009039 | 2:a2bea117e22e | 439 | } |
va009039 | 0:65f1469d6bfb | 440 | |
va009039 | 2:a2bea117e22e | 441 | PmReturn_t |
va009039 | 2:a2bea117e22e | 442 | nat_44_mbed_stop(pPmFrame_t *ppframe) |
va009039 | 2:a2bea117e22e | 443 | { |
va009039 | 0:65f1469d6bfb | 444 | |
va009039 | 2:a2bea117e22e | 445 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 446 | return nci.method<Timer,&Timer::stop>(OBJ_TYPE_NON); |
va009039 | 0:65f1469d6bfb | 447 | |
va009039 | 0:65f1469d6bfb | 448 | } |
va009039 | 0:65f1469d6bfb | 449 | |
va009039 | 0:65f1469d6bfb | 450 | PmReturn_t |
va009039 | 2:a2bea117e22e | 451 | nat_45_mbed_reset(pPmFrame_t *ppframe) |
va009039 | 0:65f1469d6bfb | 452 | { |
va009039 | 0:65f1469d6bfb | 453 | |
va009039 | 2:a2bea117e22e | 454 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 455 | return nci.method<Timer,&Timer::reset>(OBJ_TYPE_NON); |
va009039 | 0:65f1469d6bfb | 456 | |
va009039 | 0:65f1469d6bfb | 457 | } |
va009039 | 0:65f1469d6bfb | 458 | |
va009039 | 0:65f1469d6bfb | 459 | PmReturn_t |
va009039 | 2:a2bea117e22e | 460 | nat_46_mbed_read(pPmFrame_t *ppframe) |
va009039 | 2:a2bea117e22e | 461 | { |
va009039 | 2:a2bea117e22e | 462 | |
va009039 | 2:a2bea117e22e | 463 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 464 | return nci.method<float,Timer,&Timer::read>(OBJ_TYPE_FLT); |
va009039 | 2:a2bea117e22e | 465 | |
va009039 | 2:a2bea117e22e | 466 | } |
va009039 | 2:a2bea117e22e | 467 | |
va009039 | 2:a2bea117e22e | 468 | PmReturn_t |
va009039 | 2:a2bea117e22e | 469 | nat_47_mbed_read_ms(pPmFrame_t *ppframe) |
va009039 | 0:65f1469d6bfb | 470 | { |
va009039 | 0:65f1469d6bfb | 471 | |
va009039 | 2:a2bea117e22e | 472 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 473 | return nci.method<int,Timer,&Timer::read_ms>(OBJ_TYPE_INT); |
va009039 | 2:a2bea117e22e | 474 | |
va009039 | 2:a2bea117e22e | 475 | } |
va009039 | 0:65f1469d6bfb | 476 | |
va009039 | 2:a2bea117e22e | 477 | PmReturn_t |
va009039 | 2:a2bea117e22e | 478 | nat_48_mbed_read_us(pPmFrame_t *ppframe) |
va009039 | 2:a2bea117e22e | 479 | { |
va009039 | 0:65f1469d6bfb | 480 | |
va009039 | 2:a2bea117e22e | 481 | NativeClassInterface nci; |
va009039 | 2:a2bea117e22e | 482 | return nci.method<int,Timer,&Timer::read_us>(OBJ_TYPE_INT); |
va009039 | 0:65f1469d6bfb | 483 | |
va009039 | 0:65f1469d6bfb | 484 | } |
va009039 | 0:65f1469d6bfb | 485 | |
va009039 | 4:23becb24acb8 | 486 | PmReturn_t |
va009039 | 4:23becb24acb8 | 487 | nat_49_mbed___init__(pPmFrame_t *ppframe) |
va009039 | 4:23becb24acb8 | 488 | { |
va009039 | 4:23becb24acb8 | 489 | |
va009039 | 4:23becb24acb8 | 490 | #if defined(TARGET_KL25Z) |
va009039 | 4:23becb24acb8 | 491 | NativeClassInterface nci; |
va009039 | 4:23becb24acb8 | 492 | return nci.init<TSISensor>(); |
va009039 | 4:23becb24acb8 | 493 | #endif |
va009039 | 4:23becb24acb8 | 494 | |
va009039 | 4:23becb24acb8 | 495 | } |
va009039 | 4:23becb24acb8 | 496 | |
va009039 | 4:23becb24acb8 | 497 | PmReturn_t |
va009039 | 4:23becb24acb8 | 498 | nat_50_mbed_readPercentage(pPmFrame_t *ppframe) |
va009039 | 4:23becb24acb8 | 499 | { |
va009039 | 4:23becb24acb8 | 500 | |
va009039 | 4:23becb24acb8 | 501 | #if defined(TARGET_KL25Z) |
va009039 | 4:23becb24acb8 | 502 | NativeClassInterface nci; |
va009039 | 4:23becb24acb8 | 503 | return nci.method<float,TSISensor,&TSISensor::readPercentage>(OBJ_TYPE_FLT); |
va009039 | 4:23becb24acb8 | 504 | #endif |
va009039 | 4:23becb24acb8 | 505 | |
va009039 | 4:23becb24acb8 | 506 | } |
va009039 | 4:23becb24acb8 | 507 | |
va009039 | 4:23becb24acb8 | 508 | PmReturn_t |
va009039 | 4:23becb24acb8 | 509 | nat_51_mbed_readDistance(pPmFrame_t *ppframe) |
va009039 | 4:23becb24acb8 | 510 | { |
va009039 | 4:23becb24acb8 | 511 | |
va009039 | 4:23becb24acb8 | 512 | #if defined(TARGET_KL25Z) |
va009039 | 4:23becb24acb8 | 513 | NativeClassInterface nci; |
va009039 | 4:23becb24acb8 | 514 | return nci.method<uint8_t,TSISensor,&TSISensor::readDistance>(OBJ_TYPE_INT); |
va009039 | 4:23becb24acb8 | 515 | #endif |
va009039 | 4:23becb24acb8 | 516 | |
va009039 | 4:23becb24acb8 | 517 | } |
va009039 | 4:23becb24acb8 | 518 | |
va009039 | 0:65f1469d6bfb | 519 | /* Native function lookup table */ |
va009039 | 0:65f1469d6bfb | 520 | pPmNativeFxn_t const usr_nat_fxn_table[] = |
va009039 | 0:65f1469d6bfb | 521 | { |
va009039 | 0:65f1469d6bfb | 522 | nat_placeholder_func, |
va009039 | 0:65f1469d6bfb | 523 | nat_01_mbed___init__, |
va009039 | 1:28afb064a41c | 524 | nat_02_mbed_write, |
va009039 | 0:65f1469d6bfb | 525 | nat_03_mbed_read, |
va009039 | 0:65f1469d6bfb | 526 | nat_04_mbed___init__, |
va009039 | 1:28afb064a41c | 527 | nat_05_mbed_read, |
va009039 | 1:28afb064a41c | 528 | nat_06_mbed___init__, |
va009039 | 2:a2bea117e22e | 529 | nat_07_mbed_read, |
va009039 | 2:a2bea117e22e | 530 | nat_08_mbed_write, |
va009039 | 2:a2bea117e22e | 531 | nat_09_mbed_input, |
va009039 | 2:a2bea117e22e | 532 | nat_10_mbed_output, |
va009039 | 2:a2bea117e22e | 533 | nat_11_mbed___init__, |
va009039 | 2:a2bea117e22e | 534 | nat_12_mbed_read_u16, |
va009039 | 2:a2bea117e22e | 535 | nat_13_mbed_read, |
va009039 | 2:a2bea117e22e | 536 | nat_14_mbed___init__, |
va009039 | 2:a2bea117e22e | 537 | nat_15_mbed_write_u16, |
va009039 | 2:a2bea117e22e | 538 | nat_16_mbed_write, |
va009039 | 2:a2bea117e22e | 539 | nat_17_mbed_read, |
va009039 | 2:a2bea117e22e | 540 | nat_18_mbed___init__, |
va009039 | 2:a2bea117e22e | 541 | nat_19_mbed_write, |
va009039 | 2:a2bea117e22e | 542 | nat_20_mbed_read, |
va009039 | 2:a2bea117e22e | 543 | nat_21_mbed_period, |
va009039 | 2:a2bea117e22e | 544 | nat_22_mbed_period_ms, |
va009039 | 2:a2bea117e22e | 545 | nat_23_mbed_period_us, |
va009039 | 2:a2bea117e22e | 546 | nat_24_mbed_pulsewidth, |
va009039 | 2:a2bea117e22e | 547 | nat_25_mbed_pulsewidth_ms, |
va009039 | 2:a2bea117e22e | 548 | nat_26_mbed_pulsewidth_us, |
va009039 | 2:a2bea117e22e | 549 | nat_27_mbed___init__, |
va009039 | 2:a2bea117e22e | 550 | nat_28_mbed_baud, |
va009039 | 2:a2bea117e22e | 551 | nat_29_mbed_readable, |
va009039 | 2:a2bea117e22e | 552 | nat_30_mbed_writeable, |
va009039 | 2:a2bea117e22e | 553 | nat_31_mbed_putc, |
va009039 | 2:a2bea117e22e | 554 | nat_32_mbed_puts, |
va009039 | 2:a2bea117e22e | 555 | nat_33_mbed_getc, |
va009039 | 2:a2bea117e22e | 556 | nat_34_mbed___init__, |
va009039 | 2:a2bea117e22e | 557 | nat_35_mbed_format, |
va009039 | 2:a2bea117e22e | 558 | nat_36_mbed_frequency, |
va009039 | 2:a2bea117e22e | 559 | nat_37_mbed_write, |
va009039 | 2:a2bea117e22e | 560 | nat_38_mbed___init__, |
va009039 | 2:a2bea117e22e | 561 | nat_39_mbed_frequency, |
va009039 | 2:a2bea117e22e | 562 | nat_40_mbed_read, |
va009039 | 2:a2bea117e22e | 563 | nat_41_mbed_write, |
va009039 | 2:a2bea117e22e | 564 | nat_42_mbed___init__, |
va009039 | 2:a2bea117e22e | 565 | nat_43_mbed_start, |
va009039 | 2:a2bea117e22e | 566 | nat_44_mbed_stop, |
va009039 | 2:a2bea117e22e | 567 | nat_45_mbed_reset, |
va009039 | 2:a2bea117e22e | 568 | nat_46_mbed_read, |
va009039 | 2:a2bea117e22e | 569 | nat_47_mbed_read_ms, |
va009039 | 2:a2bea117e22e | 570 | nat_48_mbed_read_us, |
va009039 | 4:23becb24acb8 | 571 | nat_49_mbed___init__, |
va009039 | 4:23becb24acb8 | 572 | nat_50_mbed_readPercentage, |
va009039 | 4:23becb24acb8 | 573 | nat_51_mbed_readDistance, |
va009039 | 0:65f1469d6bfb | 574 | }; |