![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
1st Released
Dependencies: MbedJSONValue WIZnetInterface mbed
Fork of WIZwiki-REST by
main.cpp@1:728e5b5c8dae, 2016-04-05 (annotated)
- Committer:
- MidnightCow
- Date:
- Tue Apr 05 11:40:33 2016 +0000
- Revision:
- 1:728e5b5c8dae
- Parent:
- 0:5886f525a4ad
1st Released
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
joon874 | 0:5886f525a4ad | 1 | #include "mbed.h" |
joon874 | 0:5886f525a4ad | 2 | #include "HTTPServer.h" |
joon874 | 0:5886f525a4ad | 3 | #include "RequestHandler.h" |
joon874 | 0:5886f525a4ad | 4 | #include "EthernetInterface.h" |
joon874 | 0:5886f525a4ad | 5 | #include "MbedJSONValue.h" |
joon874 | 0:5886f525a4ad | 6 | |
joon874 | 0:5886f525a4ad | 7 | #define SERVER_PORT 80 |
joon874 | 0:5886f525a4ad | 8 | |
joon874 | 0:5886f525a4ad | 9 | EthernetInterface eth; |
joon874 | 0:5886f525a4ad | 10 | HTTPServer WIZwikiWebSvr; |
joon874 | 0:5886f525a4ad | 11 | MbedJSONValue WIZwikiREST; |
joon874 | 0:5886f525a4ad | 12 | |
joon874 | 0:5886f525a4ad | 13 | // Enter a MAC address for your controller below. |
joon874 | 0:5886f525a4ad | 14 | uint8_t mac_addr[6] = {0x00, 0x08, 0xDC, 0x00, 0x01, 0xFE}; |
joon874 | 0:5886f525a4ad | 15 | char mac_str[20]; |
joon874 | 0:5886f525a4ad | 16 | char ip_addr[] = "192.168.100.100"; |
joon874 | 0:5886f525a4ad | 17 | char subnet_mask[] = "255.255.255.0"; |
joon874 | 0:5886f525a4ad | 18 | char gateway_addr[] = "192.168.100.1"; |
joon874 | 0:5886f525a4ad | 19 | |
joon874 | 0:5886f525a4ad | 20 | DigitalOut LED_1(PA_1); |
joon874 | 0:5886f525a4ad | 21 | DigitalOut LED_2(PA_2); |
joon874 | 0:5886f525a4ad | 22 | |
MidnightCow | 1:728e5b5c8dae | 23 | DigitalInOut GP05(P5); |
MidnightCow | 1:728e5b5c8dae | 24 | DigitalInOut GP06(P6); |
MidnightCow | 1:728e5b5c8dae | 25 | DigitalInOut GP07(P7); |
MidnightCow | 1:728e5b5c8dae | 26 | DigitalInOut GP08(P8); |
MidnightCow | 1:728e5b5c8dae | 27 | DigitalInOut GP09(P9); |
MidnightCow | 1:728e5b5c8dae | 28 | DigitalInOut GP10(P10); |
MidnightCow | 1:728e5b5c8dae | 29 | DigitalInOut GP11(P11); |
MidnightCow | 1:728e5b5c8dae | 30 | DigitalInOut GP12(P12); |
MidnightCow | 1:728e5b5c8dae | 31 | DigitalInOut GP13(P13); |
MidnightCow | 1:728e5b5c8dae | 32 | DigitalInOut GP14(P14); |
MidnightCow | 1:728e5b5c8dae | 33 | DigitalInOut GP15(P15); |
MidnightCow | 1:728e5b5c8dae | 34 | DigitalInOut GP16(P16); |
MidnightCow | 1:728e5b5c8dae | 35 | DigitalInOut GP17(P17); |
MidnightCow | 1:728e5b5c8dae | 36 | DigitalInOut GP18(P18); |
MidnightCow | 1:728e5b5c8dae | 37 | DigitalInOut GP19(P19); |
MidnightCow | 1:728e5b5c8dae | 38 | DigitalInOut GP20(P20); |
MidnightCow | 1:728e5b5c8dae | 39 | DigitalInOut GP21(P21); |
MidnightCow | 1:728e5b5c8dae | 40 | DigitalInOut GP22(P22); |
MidnightCow | 1:728e5b5c8dae | 41 | DigitalInOut GP23(P23); |
MidnightCow | 1:728e5b5c8dae | 42 | DigitalInOut GP24(P24); |
MidnightCow | 1:728e5b5c8dae | 43 | DigitalInOut GP25(P25); |
MidnightCow | 1:728e5b5c8dae | 44 | DigitalInOut GP26(P26); |
MidnightCow | 1:728e5b5c8dae | 45 | DigitalInOut GP27(P27); |
MidnightCow | 1:728e5b5c8dae | 46 | DigitalInOut GP28(P28); |
MidnightCow | 1:728e5b5c8dae | 47 | DigitalInOut GP29(P29); |
MidnightCow | 1:728e5b5c8dae | 48 | DigitalInOut GP30(P30); |
MidnightCow | 1:728e5b5c8dae | 49 | DigitalInOut GP31(P31); |
MidnightCow | 1:728e5b5c8dae | 50 | DigitalInOut GP32(P32); |
joon874 | 0:5886f525a4ad | 51 | |
MidnightCow | 1:728e5b5c8dae | 52 | bool p5_set(void* param) |
MidnightCow | 1:728e5b5c8dae | 53 | { |
MidnightCow | 1:728e5b5c8dae | 54 | if(!param) return false; |
MidnightCow | 1:728e5b5c8dae | 55 | GP05.write(*(int*)param); |
MidnightCow | 1:728e5b5c8dae | 56 | return true; |
MidnightCow | 1:728e5b5c8dae | 57 | } |
MidnightCow | 1:728e5b5c8dae | 58 | bool p6_set(void* param) |
MidnightCow | 1:728e5b5c8dae | 59 | { |
MidnightCow | 1:728e5b5c8dae | 60 | if(!param) return false; |
MidnightCow | 1:728e5b5c8dae | 61 | GP06.write(*(int*)param); |
MidnightCow | 1:728e5b5c8dae | 62 | return true; |
MidnightCow | 1:728e5b5c8dae | 63 | } |
MidnightCow | 1:728e5b5c8dae | 64 | bool p7_set(void* param) |
MidnightCow | 1:728e5b5c8dae | 65 | { |
MidnightCow | 1:728e5b5c8dae | 66 | if(!param) return false; |
MidnightCow | 1:728e5b5c8dae | 67 | GP07.write(*(int*)param); |
MidnightCow | 1:728e5b5c8dae | 68 | return true; |
MidnightCow | 1:728e5b5c8dae | 69 | } |
MidnightCow | 1:728e5b5c8dae | 70 | bool p8_set(void* param) |
MidnightCow | 1:728e5b5c8dae | 71 | { |
MidnightCow | 1:728e5b5c8dae | 72 | if(!param) return false; |
MidnightCow | 1:728e5b5c8dae | 73 | GP08.write(*(int*)param); |
MidnightCow | 1:728e5b5c8dae | 74 | return true; |
MidnightCow | 1:728e5b5c8dae | 75 | } |
MidnightCow | 1:728e5b5c8dae | 76 | bool p9_set(void* param) |
MidnightCow | 1:728e5b5c8dae | 77 | { |
MidnightCow | 1:728e5b5c8dae | 78 | if(!param) return false; |
MidnightCow | 1:728e5b5c8dae | 79 | GP09.write(*(int*)param); |
MidnightCow | 1:728e5b5c8dae | 80 | return true; |
MidnightCow | 1:728e5b5c8dae | 81 | } |
MidnightCow | 1:728e5b5c8dae | 82 | bool p10_set(void* param) |
MidnightCow | 1:728e5b5c8dae | 83 | { |
MidnightCow | 1:728e5b5c8dae | 84 | if(!param) return false; |
MidnightCow | 1:728e5b5c8dae | 85 | GP10.write(*(int*)param); |
MidnightCow | 1:728e5b5c8dae | 86 | return true; |
MidnightCow | 1:728e5b5c8dae | 87 | } |
MidnightCow | 1:728e5b5c8dae | 88 | bool p11_set(void* param) |
MidnightCow | 1:728e5b5c8dae | 89 | { |
MidnightCow | 1:728e5b5c8dae | 90 | if(!param) return false; |
MidnightCow | 1:728e5b5c8dae | 91 | GP11.write(*(int*)param); |
MidnightCow | 1:728e5b5c8dae | 92 | return true; |
MidnightCow | 1:728e5b5c8dae | 93 | } |
MidnightCow | 1:728e5b5c8dae | 94 | bool p12_set(void* param) |
MidnightCow | 1:728e5b5c8dae | 95 | { |
MidnightCow | 1:728e5b5c8dae | 96 | if(!param) return false; |
MidnightCow | 1:728e5b5c8dae | 97 | GP12.write(*(int*)param); |
MidnightCow | 1:728e5b5c8dae | 98 | return true; |
MidnightCow | 1:728e5b5c8dae | 99 | } |
MidnightCow | 1:728e5b5c8dae | 100 | bool p13_set(void* param) |
MidnightCow | 1:728e5b5c8dae | 101 | { |
MidnightCow | 1:728e5b5c8dae | 102 | if(!param) return false; |
MidnightCow | 1:728e5b5c8dae | 103 | GP13.write(*(int*)param); |
MidnightCow | 1:728e5b5c8dae | 104 | return true; |
MidnightCow | 1:728e5b5c8dae | 105 | } |
MidnightCow | 1:728e5b5c8dae | 106 | bool p14_set(void* param) |
MidnightCow | 1:728e5b5c8dae | 107 | { |
MidnightCow | 1:728e5b5c8dae | 108 | if(!param) return false; |
MidnightCow | 1:728e5b5c8dae | 109 | GP14.write(*(int*)param); |
MidnightCow | 1:728e5b5c8dae | 110 | return true; |
MidnightCow | 1:728e5b5c8dae | 111 | } |
MidnightCow | 1:728e5b5c8dae | 112 | bool p15_set(void* param) |
MidnightCow | 1:728e5b5c8dae | 113 | { |
MidnightCow | 1:728e5b5c8dae | 114 | if(!param) return false; |
MidnightCow | 1:728e5b5c8dae | 115 | GP15.write(*(int*)param); |
MidnightCow | 1:728e5b5c8dae | 116 | return true; |
MidnightCow | 1:728e5b5c8dae | 117 | } |
MidnightCow | 1:728e5b5c8dae | 118 | bool p16_set(void* param) |
MidnightCow | 1:728e5b5c8dae | 119 | { |
MidnightCow | 1:728e5b5c8dae | 120 | if(!param) return false; |
MidnightCow | 1:728e5b5c8dae | 121 | GP16.write(*(int*)param); |
MidnightCow | 1:728e5b5c8dae | 122 | return true; |
MidnightCow | 1:728e5b5c8dae | 123 | } |
MidnightCow | 1:728e5b5c8dae | 124 | bool p17_set(void* param) |
MidnightCow | 1:728e5b5c8dae | 125 | { |
MidnightCow | 1:728e5b5c8dae | 126 | if(!param) return false; |
MidnightCow | 1:728e5b5c8dae | 127 | GP17.write(*(int*)param); |
MidnightCow | 1:728e5b5c8dae | 128 | return true; |
MidnightCow | 1:728e5b5c8dae | 129 | } |
MidnightCow | 1:728e5b5c8dae | 130 | bool p18_set(void* param) |
MidnightCow | 1:728e5b5c8dae | 131 | { |
MidnightCow | 1:728e5b5c8dae | 132 | if(!param) return false; |
MidnightCow | 1:728e5b5c8dae | 133 | GP18.write(*(int*)param); |
MidnightCow | 1:728e5b5c8dae | 134 | return true; |
MidnightCow | 1:728e5b5c8dae | 135 | } |
MidnightCow | 1:728e5b5c8dae | 136 | bool p19_set(void* param) |
MidnightCow | 1:728e5b5c8dae | 137 | { |
MidnightCow | 1:728e5b5c8dae | 138 | if(!param) return false; |
MidnightCow | 1:728e5b5c8dae | 139 | GP19.write(*(int*)param); |
MidnightCow | 1:728e5b5c8dae | 140 | return true; |
MidnightCow | 1:728e5b5c8dae | 141 | } |
MidnightCow | 1:728e5b5c8dae | 142 | bool p20_set(void* param) |
MidnightCow | 1:728e5b5c8dae | 143 | { |
MidnightCow | 1:728e5b5c8dae | 144 | if(!param) return false; |
MidnightCow | 1:728e5b5c8dae | 145 | GP20.write(*(int*)param); |
MidnightCow | 1:728e5b5c8dae | 146 | return true; |
MidnightCow | 1:728e5b5c8dae | 147 | } |
MidnightCow | 1:728e5b5c8dae | 148 | bool p21_set(void* param) |
MidnightCow | 1:728e5b5c8dae | 149 | { |
MidnightCow | 1:728e5b5c8dae | 150 | if(!param) return false; |
MidnightCow | 1:728e5b5c8dae | 151 | GP21.write(*(int*)param); |
MidnightCow | 1:728e5b5c8dae | 152 | return true; |
MidnightCow | 1:728e5b5c8dae | 153 | } |
MidnightCow | 1:728e5b5c8dae | 154 | bool p22_set(void* param) |
MidnightCow | 1:728e5b5c8dae | 155 | { |
MidnightCow | 1:728e5b5c8dae | 156 | if(!param) return false; |
MidnightCow | 1:728e5b5c8dae | 157 | GP22.write(*(int*)param); |
MidnightCow | 1:728e5b5c8dae | 158 | return true; |
MidnightCow | 1:728e5b5c8dae | 159 | } |
MidnightCow | 1:728e5b5c8dae | 160 | bool p23_set(void* param) |
MidnightCow | 1:728e5b5c8dae | 161 | { |
MidnightCow | 1:728e5b5c8dae | 162 | if(!param) return false; |
MidnightCow | 1:728e5b5c8dae | 163 | GP23.write(*(int*)param); |
MidnightCow | 1:728e5b5c8dae | 164 | return true; |
MidnightCow | 1:728e5b5c8dae | 165 | } |
MidnightCow | 1:728e5b5c8dae | 166 | bool p24_set(void* param) |
MidnightCow | 1:728e5b5c8dae | 167 | { |
MidnightCow | 1:728e5b5c8dae | 168 | if(!param) return false; |
MidnightCow | 1:728e5b5c8dae | 169 | GP24.write(*(int*)param); |
MidnightCow | 1:728e5b5c8dae | 170 | return true; |
MidnightCow | 1:728e5b5c8dae | 171 | } |
MidnightCow | 1:728e5b5c8dae | 172 | bool p25_set(void* param) |
MidnightCow | 1:728e5b5c8dae | 173 | { |
MidnightCow | 1:728e5b5c8dae | 174 | if(!param) return false; |
MidnightCow | 1:728e5b5c8dae | 175 | GP25.write(*(int*)param); |
MidnightCow | 1:728e5b5c8dae | 176 | return true; |
MidnightCow | 1:728e5b5c8dae | 177 | } |
MidnightCow | 1:728e5b5c8dae | 178 | bool p26_set(void* param) |
MidnightCow | 1:728e5b5c8dae | 179 | { |
MidnightCow | 1:728e5b5c8dae | 180 | if(!param) return false; |
MidnightCow | 1:728e5b5c8dae | 181 | GP26.write(*(int*)param); |
MidnightCow | 1:728e5b5c8dae | 182 | return true; |
MidnightCow | 1:728e5b5c8dae | 183 | } |
MidnightCow | 1:728e5b5c8dae | 184 | bool p27_set(void* param) |
MidnightCow | 1:728e5b5c8dae | 185 | { |
MidnightCow | 1:728e5b5c8dae | 186 | if(!param) return false; |
MidnightCow | 1:728e5b5c8dae | 187 | GP27.write(*(int*)param); |
MidnightCow | 1:728e5b5c8dae | 188 | return true; |
MidnightCow | 1:728e5b5c8dae | 189 | } |
MidnightCow | 1:728e5b5c8dae | 190 | bool p28_set(void* param) |
MidnightCow | 1:728e5b5c8dae | 191 | { |
MidnightCow | 1:728e5b5c8dae | 192 | if(!param) return false; |
MidnightCow | 1:728e5b5c8dae | 193 | GP28.write(*(int*)param); |
MidnightCow | 1:728e5b5c8dae | 194 | return true; |
MidnightCow | 1:728e5b5c8dae | 195 | } |
MidnightCow | 1:728e5b5c8dae | 196 | bool p29_set(void* param) |
MidnightCow | 1:728e5b5c8dae | 197 | { |
MidnightCow | 1:728e5b5c8dae | 198 | if(!param) return false; |
MidnightCow | 1:728e5b5c8dae | 199 | GP29.write(*(int*)param); |
MidnightCow | 1:728e5b5c8dae | 200 | return true; |
MidnightCow | 1:728e5b5c8dae | 201 | } |
MidnightCow | 1:728e5b5c8dae | 202 | bool p30_set(void* param) |
MidnightCow | 1:728e5b5c8dae | 203 | { |
MidnightCow | 1:728e5b5c8dae | 204 | if(!param) return false; |
MidnightCow | 1:728e5b5c8dae | 205 | GP30.write(*(int*)param); |
MidnightCow | 1:728e5b5c8dae | 206 | return true; |
MidnightCow | 1:728e5b5c8dae | 207 | } |
MidnightCow | 1:728e5b5c8dae | 208 | bool p31_set(void* param) |
MidnightCow | 1:728e5b5c8dae | 209 | { |
MidnightCow | 1:728e5b5c8dae | 210 | if(!param) return false; |
MidnightCow | 1:728e5b5c8dae | 211 | GP31.write(*(int*)param); |
MidnightCow | 1:728e5b5c8dae | 212 | return true; |
MidnightCow | 1:728e5b5c8dae | 213 | } |
MidnightCow | 1:728e5b5c8dae | 214 | bool p32_set(void* param) |
MidnightCow | 1:728e5b5c8dae | 215 | { |
MidnightCow | 1:728e5b5c8dae | 216 | if(!param) return false; |
MidnightCow | 1:728e5b5c8dae | 217 | GP32.write(*(int*)param); |
MidnightCow | 1:728e5b5c8dae | 218 | return true; |
MidnightCow | 1:728e5b5c8dae | 219 | } |
MidnightCow | 1:728e5b5c8dae | 220 | |
MidnightCow | 1:728e5b5c8dae | 221 | void debug_info() |
MidnightCow | 1:728e5b5c8dae | 222 | { |
MidnightCow | 1:728e5b5c8dae | 223 | printf("SP:0x%X\r\n",__current_sp()); |
MidnightCow | 1:728e5b5c8dae | 224 | __heapstats((__heapprt)fprintf,stderr); |
MidnightCow | 1:728e5b5c8dae | 225 | printf("\r\n"); |
MidnightCow | 1:728e5b5c8dae | 226 | } |
joon874 | 0:5886f525a4ad | 227 | void WIZwiki_REST_init(); |
joon874 | 0:5886f525a4ad | 228 | |
joon874 | 0:5886f525a4ad | 229 | int main(void) |
joon874 | 0:5886f525a4ad | 230 | { |
MidnightCow | 1:728e5b5c8dae | 231 | |
joon874 | 0:5886f525a4ad | 232 | sprintf(mac_str, "%02X:%02X:%02X:%02X:%02X:%02X",mac_addr[0],mac_addr[1], |
joon874 | 0:5886f525a4ad | 233 | mac_addr[2],mac_addr[3], |
joon874 | 0:5886f525a4ad | 234 | mac_addr[4],mac_addr[5]); |
joon874 | 0:5886f525a4ad | 235 | //GPIO Set |
MidnightCow | 1:728e5b5c8dae | 236 | GP05.output(); |
MidnightCow | 1:728e5b5c8dae | 237 | GP05.write(0); |
MidnightCow | 1:728e5b5c8dae | 238 | GP06.input(); |
MidnightCow | 1:728e5b5c8dae | 239 | |
joon874 | 0:5886f525a4ad | 240 | //LED Setbit |
joon874 | 0:5886f525a4ad | 241 | LED_1.write(0); // LED On |
joon874 | 0:5886f525a4ad | 242 | LED_2.write(1); // LED Off |
MidnightCow | 1:728e5b5c8dae | 243 | printf("START \r\n"); |
MidnightCow | 1:728e5b5c8dae | 244 | printf("sizeof(MbedJSONValue)=%d\r\n",sizeof(MbedJSONValue)); |
MidnightCow | 1:728e5b5c8dae | 245 | printf("sizeof(vector)=%d\r\n",sizeof(std::vector<string*>)); |
MidnightCow | 1:728e5b5c8dae | 246 | printf("sizeof(string)=%d\r\n",sizeof(std::string)); |
MidnightCow | 1:728e5b5c8dae | 247 | debug_info(); |
joon874 | 0:5886f525a4ad | 248 | |
joon874 | 0:5886f525a4ad | 249 | WIZwiki_REST_init(); |
MidnightCow | 1:728e5b5c8dae | 250 | |
MidnightCow | 1:728e5b5c8dae | 251 | debug_info(); |
MidnightCow | 1:728e5b5c8dae | 252 | |
joon874 | 0:5886f525a4ad | 253 | // Serialize it into a JSON string |
joon874 | 0:5886f525a4ad | 254 | printf("\r\n"); |
joon874 | 0:5886f525a4ad | 255 | printf("-------------------------WIZwikiREST--------------------------- \r\n"); |
joon874 | 0:5886f525a4ad | 256 | printf("%s\r\n", WIZwikiREST.serialize().c_str()); |
joon874 | 0:5886f525a4ad | 257 | printf("--------------------------------------------------------------- \r\n"); |
joon874 | 0:5886f525a4ad | 258 | |
joon874 | 0:5886f525a4ad | 259 | WIZwikiWebSvr.add_request_handler("GET", new GetRequestHandler()); |
joon874 | 0:5886f525a4ad | 260 | //WIZwikiWebSvr.add_request_handler("DELETE", new DeleteRequestHandler()); |
joon874 | 0:5886f525a4ad | 261 | //WIZwikiWebSvr.add_request_handler("PUT", new PutRequestHandler()); |
joon874 | 0:5886f525a4ad | 262 | |
joon874 | 0:5886f525a4ad | 263 | #ifdef DHCP |
joon874 | 0:5886f525a4ad | 264 | eth.init(mac_addr); //Use DHCP |
joon874 | 0:5886f525a4ad | 265 | #else |
joon874 | 0:5886f525a4ad | 266 | eth.init(mac_addr, ip_addr, subnet_mask, gateway_addr); //Not Use DHCP |
joon874 | 0:5886f525a4ad | 267 | #endif |
joon874 | 0:5886f525a4ad | 268 | |
joon874 | 0:5886f525a4ad | 269 | printf("Check Ethernet Link\r\n"); |
joon874 | 0:5886f525a4ad | 270 | |
joon874 | 0:5886f525a4ad | 271 | while(1) //Wait link up |
joon874 | 0:5886f525a4ad | 272 | { |
joon874 | 0:5886f525a4ad | 273 | if(eth.link() == true) |
joon874 | 0:5886f525a4ad | 274 | break; |
joon874 | 0:5886f525a4ad | 275 | } |
joon874 | 0:5886f525a4ad | 276 | |
joon874 | 0:5886f525a4ad | 277 | printf("Link up\r\n"); |
joon874 | 0:5886f525a4ad | 278 | printf("IP Address is %s\r\n", eth.getIPAddress()); |
joon874 | 0:5886f525a4ad | 279 | |
joon874 | 0:5886f525a4ad | 280 | if(!WIZwikiWebSvr.init(SERVER_PORT)) |
joon874 | 0:5886f525a4ad | 281 | { |
joon874 | 0:5886f525a4ad | 282 | eth.disconnect(); |
joon874 | 0:5886f525a4ad | 283 | return -1; |
joon874 | 0:5886f525a4ad | 284 | } |
joon874 | 0:5886f525a4ad | 285 | |
joon874 | 0:5886f525a4ad | 286 | while(1) |
joon874 | 0:5886f525a4ad | 287 | { |
joon874 | 0:5886f525a4ad | 288 | WIZwikiWebSvr.run(); |
joon874 | 0:5886f525a4ad | 289 | } |
joon874 | 0:5886f525a4ad | 290 | } |
joon874 | 0:5886f525a4ad | 291 | |
joon874 | 0:5886f525a4ad | 292 | void WIZwiki_REST_init(void) |
joon874 | 0:5886f525a4ad | 293 | { |
joon874 | 0:5886f525a4ad | 294 | //Fill the object |
MidnightCow | 1:728e5b5c8dae | 295 | WIZwikiREST["Name"] = "WIZwiki-RESTful-01"; |
MidnightCow | 1:728e5b5c8dae | 296 | WIZwikiREST["Name"].accessible = false; |
MidnightCow | 1:728e5b5c8dae | 297 | debug_info(); |
MidnightCow | 1:728e5b5c8dae | 298 | |
joon874 | 0:5886f525a4ad | 299 | //Network |
MidnightCow | 1:728e5b5c8dae | 300 | |
joon874 | 0:5886f525a4ad | 301 | WIZwikiREST["Network"]["MAC"] = mac_str; |
MidnightCow | 1:728e5b5c8dae | 302 | debug_info(); |
joon874 | 0:5886f525a4ad | 303 | WIZwikiREST["Network"]["IP"] = ip_addr; |
MidnightCow | 1:728e5b5c8dae | 304 | WIZwikiREST["Network"]["IP"].accessible = true; |
MidnightCow | 1:728e5b5c8dae | 305 | debug_info(); |
joon874 | 0:5886f525a4ad | 306 | WIZwikiREST["Network"]["SN"] = subnet_mask; |
MidnightCow | 1:728e5b5c8dae | 307 | WIZwikiREST["Network"]["SN"].accessible = true; |
MidnightCow | 1:728e5b5c8dae | 308 | debug_info(); |
joon874 | 0:5886f525a4ad | 309 | WIZwikiREST["Network"]["GW"] = gateway_addr; |
MidnightCow | 1:728e5b5c8dae | 310 | WIZwikiREST["Network"]["GW"].accessible = true; |
MidnightCow | 1:728e5b5c8dae | 311 | debug_info(); |
MidnightCow | 1:728e5b5c8dae | 312 | |
joon874 | 0:5886f525a4ad | 313 | //LEDs |
MidnightCow | 1:728e5b5c8dae | 314 | WIZwikiREST["LED1"] = (LED_1.read() ? "Off" : "On"); |
MidnightCow | 1:728e5b5c8dae | 315 | WIZwikiREST["LED1"].accessible = true; |
MidnightCow | 1:728e5b5c8dae | 316 | debug_info(); |
MidnightCow | 1:728e5b5c8dae | 317 | WIZwikiREST["LED2"] = (LED_2.read() ? "Off" : "On"); |
MidnightCow | 1:728e5b5c8dae | 318 | WIZwikiREST["LED2"].accessible = true; |
MidnightCow | 1:728e5b5c8dae | 319 | debug_info(); |
joon874 | 0:5886f525a4ad | 320 | // GPIOs |
MidnightCow | 1:728e5b5c8dae | 321 | WIZwikiREST["GPIOs"]["P05"] = GP05.read(); |
MidnightCow | 1:728e5b5c8dae | 322 | WIZwikiREST["GPIOs"]["P05"].accessible = true; |
MidnightCow | 1:728e5b5c8dae | 323 | WIZwikiREST["GPIOs"]["P05"].cb_action = p5_set; |
MidnightCow | 1:728e5b5c8dae | 324 | WIZwikiREST["GPIOs"]["P06"] = GP06.read(); |
MidnightCow | 1:728e5b5c8dae | 325 | WIZwikiREST["GPIOs"]["P06"].accessible = true; |
MidnightCow | 1:728e5b5c8dae | 326 | WIZwikiREST["GPIOs"]["P06"].cb_action = p6_set; |
MidnightCow | 1:728e5b5c8dae | 327 | WIZwikiREST["GPIOs"]["P07"] = GP07.read(); |
MidnightCow | 1:728e5b5c8dae | 328 | WIZwikiREST["GPIOs"]["P07"].accessible = true; |
MidnightCow | 1:728e5b5c8dae | 329 | WIZwikiREST["GPIOs"]["P07"].cb_action = p7_set; |
MidnightCow | 1:728e5b5c8dae | 330 | WIZwikiREST["GPIOs"]["P08"] = GP08.read(); |
MidnightCow | 1:728e5b5c8dae | 331 | WIZwikiREST["GPIOs"]["P08"].accessible = true; |
MidnightCow | 1:728e5b5c8dae | 332 | WIZwikiREST["GPIOs"]["P08"].cb_action = p8_set; |
MidnightCow | 1:728e5b5c8dae | 333 | WIZwikiREST["GPIOs"]["P09"] = GP09.read(); |
MidnightCow | 1:728e5b5c8dae | 334 | WIZwikiREST["GPIOs"]["P09"].accessible = true; |
MidnightCow | 1:728e5b5c8dae | 335 | WIZwikiREST["GPIOs"]["P09"].cb_action = p9_set; |
MidnightCow | 1:728e5b5c8dae | 336 | WIZwikiREST["GPIOs"]["P10"] = GP10.read(); |
MidnightCow | 1:728e5b5c8dae | 337 | WIZwikiREST["GPIOs"]["P10"].accessible = true; |
MidnightCow | 1:728e5b5c8dae | 338 | WIZwikiREST["GPIOs"]["P10"].cb_action = p10_set; |
MidnightCow | 1:728e5b5c8dae | 339 | WIZwikiREST["GPIOs"]["P11"] = GP11.read(); |
MidnightCow | 1:728e5b5c8dae | 340 | WIZwikiREST["GPIOs"]["P11"].accessible = true; |
MidnightCow | 1:728e5b5c8dae | 341 | WIZwikiREST["GPIOs"]["P11"].cb_action = p11_set; |
MidnightCow | 1:728e5b5c8dae | 342 | WIZwikiREST["GPIOs"]["P12"] = GP12.read(); |
MidnightCow | 1:728e5b5c8dae | 343 | WIZwikiREST["GPIOs"]["P12"].accessible = true; |
MidnightCow | 1:728e5b5c8dae | 344 | WIZwikiREST["GPIOs"]["P12"].cb_action = p12_set; |
MidnightCow | 1:728e5b5c8dae | 345 | WIZwikiREST["GPIOs"]["P13"] = GP13.read(); |
MidnightCow | 1:728e5b5c8dae | 346 | WIZwikiREST["GPIOs"]["P13"].accessible = true; |
MidnightCow | 1:728e5b5c8dae | 347 | WIZwikiREST["GPIOs"]["P13"].cb_action = p13_set; |
MidnightCow | 1:728e5b5c8dae | 348 | WIZwikiREST["GPIOs"]["P14"] = GP14.read(); |
MidnightCow | 1:728e5b5c8dae | 349 | WIZwikiREST["GPIOs"]["P14"].accessible = true; |
MidnightCow | 1:728e5b5c8dae | 350 | WIZwikiREST["GPIOs"]["P14"].cb_action = p14_set; |
MidnightCow | 1:728e5b5c8dae | 351 | WIZwikiREST["GPIOs"]["P15"] = GP15.read(); |
MidnightCow | 1:728e5b5c8dae | 352 | WIZwikiREST["GPIOs"]["P15"].accessible = true; |
MidnightCow | 1:728e5b5c8dae | 353 | WIZwikiREST["GPIOs"]["P15"].cb_action = p15_set; |
MidnightCow | 1:728e5b5c8dae | 354 | WIZwikiREST["GPIOs"]["P16"] = GP16.read(); |
MidnightCow | 1:728e5b5c8dae | 355 | WIZwikiREST["GPIOs"]["P16"].accessible = true; |
MidnightCow | 1:728e5b5c8dae | 356 | WIZwikiREST["GPIOs"]["P16"].cb_action = p16_set; |
MidnightCow | 1:728e5b5c8dae | 357 | WIZwikiREST["GPIOs"]["P17"] = GP17.read(); |
MidnightCow | 1:728e5b5c8dae | 358 | WIZwikiREST["GPIOs"]["P17"].accessible = true; |
MidnightCow | 1:728e5b5c8dae | 359 | WIZwikiREST["GPIOs"]["P17"].cb_action = p17_set; |
MidnightCow | 1:728e5b5c8dae | 360 | WIZwikiREST["GPIOs"]["P18"] = GP18.read(); |
MidnightCow | 1:728e5b5c8dae | 361 | WIZwikiREST["GPIOs"]["P18"].accessible = true; |
MidnightCow | 1:728e5b5c8dae | 362 | WIZwikiREST["GPIOs"]["P18"].cb_action = p18_set; |
MidnightCow | 1:728e5b5c8dae | 363 | WIZwikiREST["GPIOs"]["P19"] = GP19.read(); |
MidnightCow | 1:728e5b5c8dae | 364 | WIZwikiREST["GPIOs"]["P19"].accessible = true; |
MidnightCow | 1:728e5b5c8dae | 365 | WIZwikiREST["GPIOs"]["P19"].cb_action = p19_set; |
MidnightCow | 1:728e5b5c8dae | 366 | WIZwikiREST["GPIOs"]["P20"] = GP20.read(); |
MidnightCow | 1:728e5b5c8dae | 367 | WIZwikiREST["GPIOs"]["P20"].accessible = true; |
MidnightCow | 1:728e5b5c8dae | 368 | WIZwikiREST["GPIOs"]["P20"].cb_action = p20_set; |
MidnightCow | 1:728e5b5c8dae | 369 | WIZwikiREST["GPIOs"]["P21"] = GP21.read(); |
MidnightCow | 1:728e5b5c8dae | 370 | WIZwikiREST["GPIOs"]["P21"].accessible = true; |
MidnightCow | 1:728e5b5c8dae | 371 | WIZwikiREST["GPIOs"]["P21"].cb_action = p21_set; |
MidnightCow | 1:728e5b5c8dae | 372 | WIZwikiREST["GPIOs"]["P22"] = GP22.read(); |
MidnightCow | 1:728e5b5c8dae | 373 | WIZwikiREST["GPIOs"]["P22"].accessible = true; |
MidnightCow | 1:728e5b5c8dae | 374 | WIZwikiREST["GPIOs"]["P22"].cb_action = p22_set; |
MidnightCow | 1:728e5b5c8dae | 375 | |
MidnightCow | 1:728e5b5c8dae | 376 | WIZwikiREST["GPIOs"]["P23"] = GP23.read(); |
MidnightCow | 1:728e5b5c8dae | 377 | WIZwikiREST["GPIOs"]["P23"].accessible = true; |
MidnightCow | 1:728e5b5c8dae | 378 | WIZwikiREST["GPIOs"]["P23"].cb_action = p23_set; |
MidnightCow | 1:728e5b5c8dae | 379 | WIZwikiREST["GPIOs"]["P24"] = GP24.read(); |
MidnightCow | 1:728e5b5c8dae | 380 | WIZwikiREST["GPIOs"]["P24"].accessible = true; |
MidnightCow | 1:728e5b5c8dae | 381 | WIZwikiREST["GPIOs"]["P24"].cb_action = p24_set; |
MidnightCow | 1:728e5b5c8dae | 382 | WIZwikiREST["GPIOs"]["P25"] = GP25.read(); |
MidnightCow | 1:728e5b5c8dae | 383 | WIZwikiREST["GPIOs"]["P25"].accessible = true; |
MidnightCow | 1:728e5b5c8dae | 384 | WIZwikiREST["GPIOs"]["P25"].cb_action = p25_set; |
MidnightCow | 1:728e5b5c8dae | 385 | WIZwikiREST["GPIOs"]["P26"] = GP26.read(); |
MidnightCow | 1:728e5b5c8dae | 386 | WIZwikiREST["GPIOs"]["P26"].accessible = true; |
MidnightCow | 1:728e5b5c8dae | 387 | WIZwikiREST["GPIOs"]["P26"].cb_action = p26_set; |
MidnightCow | 1:728e5b5c8dae | 388 | WIZwikiREST["GPIOs"]["P27"] = GP27.read(); |
MidnightCow | 1:728e5b5c8dae | 389 | WIZwikiREST["GPIOs"]["P27"].accessible = true; |
MidnightCow | 1:728e5b5c8dae | 390 | WIZwikiREST["GPIOs"]["P27"].cb_action = p27_set; |
MidnightCow | 1:728e5b5c8dae | 391 | WIZwikiREST["GPIOs"]["P28"] = GP28.read(); |
MidnightCow | 1:728e5b5c8dae | 392 | WIZwikiREST["GPIOs"]["P28"].accessible = true; |
MidnightCow | 1:728e5b5c8dae | 393 | WIZwikiREST["GPIOs"]["P28"].cb_action = p28_set; |
MidnightCow | 1:728e5b5c8dae | 394 | WIZwikiREST["GPIOs"]["P29"] = GP29.read(); |
MidnightCow | 1:728e5b5c8dae | 395 | WIZwikiREST["GPIOs"]["P29"].accessible = true; |
MidnightCow | 1:728e5b5c8dae | 396 | WIZwikiREST["GPIOs"]["P29"].cb_action = p29_set; |
MidnightCow | 1:728e5b5c8dae | 397 | WIZwikiREST["GPIOs"]["P30"] = GP30.read(); |
MidnightCow | 1:728e5b5c8dae | 398 | WIZwikiREST["GPIOs"]["P30"].accessible = true; |
MidnightCow | 1:728e5b5c8dae | 399 | WIZwikiREST["GPIOs"]["P30"].cb_action = p30_set; |
MidnightCow | 1:728e5b5c8dae | 400 | WIZwikiREST["GPIOs"]["P31"] = GP31.read(); |
MidnightCow | 1:728e5b5c8dae | 401 | WIZwikiREST["GPIOs"]["P31"].accessible = true; |
MidnightCow | 1:728e5b5c8dae | 402 | WIZwikiREST["GPIOs"]["P31"].cb_action = p31_set; |
MidnightCow | 1:728e5b5c8dae | 403 | WIZwikiREST["GPIOs"]["P32"] = GP32.read(); |
MidnightCow | 1:728e5b5c8dae | 404 | WIZwikiREST["GPIOs"]["P32"].accessible = true; |
MidnightCow | 1:728e5b5c8dae | 405 | WIZwikiREST["GPIOs"]["P32"].cb_action = p32_set; |
MidnightCow | 1:728e5b5c8dae | 406 | |
MidnightCow | 1:728e5b5c8dae | 407 | debug_info(); |
joon874 | 0:5886f525a4ad | 408 | } |