bosko lekovic
/
EthToCom_11
nova proba
main.cpp@7:7ea932eb31f6, 2020-04-18 (annotated)
- Committer:
- bosko001
- Date:
- Sat Apr 18 22:32:13 2020 +0000
- Revision:
- 7:7ea932eb31f6
- Parent:
- 5:c9a908749d4c
- Child:
- 11:2cc7e6f06cff
potpuno ispravan html - flash rad
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bosko001 | 0:fe8cd064ea08 | 1 | #include "mbed.h" |
bosko001 | 2:45b351b4fc2a | 2 | #include "clubbing.h" |
bosko001 | 2:45b351b4fc2a | 3 | #include "EthernetSetup.h" |
bosko001 | 2:45b351b4fc2a | 4 | #include "UdpToScom.h" |
bosko001 | 2:45b351b4fc2a | 5 | #include "TcpServerToFlash.h" |
bosko001 | 2:45b351b4fc2a | 6 | #include "dxml.h" |
bosko001 | 2:45b351b4fc2a | 7 | #include "doHTML.h" |
bosko001 | 3:1196befeace0 | 8 | #include "dataFlash.h" |
bosko001 | 2:45b351b4fc2a | 9 | #include "string.h" |
bosko001 | 0:fe8cd064ea08 | 10 | |
bosko001 | 5:c9a908749d4c | 11 | |
bosko001 | 5:c9a908749d4c | 12 | |
bosko001 | 5:c9a908749d4c | 13 | |
bosko001 | 5:c9a908749d4c | 14 | |
bosko001 | 2:45b351b4fc2a | 15 | volatile PFV pfv = NULL; |
bosko001 | 1:e1bde4e82763 | 16 | |
bosko001 | 1:e1bde4e82763 | 17 | |
bosko001 | 2:45b351b4fc2a | 18 | DigitalOut GLed(LED2,1); |
bosko001 | 1:e1bde4e82763 | 19 | |
bosko001 | 2:45b351b4fc2a | 20 | void pfv_fun( void ) |
bosko001 | 1:e1bde4e82763 | 21 | { |
bosko001 | 2:45b351b4fc2a | 22 | while(true) |
bosko001 | 2:45b351b4fc2a | 23 | { |
bosko001 | 2:45b351b4fc2a | 24 | if(pfv) {pfv(); pfv = NULL;} |
bosko001 | 2:45b351b4fc2a | 25 | cleanTcpServerToFlashThread( ); |
bosko001 | 2:45b351b4fc2a | 26 | |
bosko001 | 2:45b351b4fc2a | 27 | } |
bosko001 | 1:e1bde4e82763 | 28 | } |
bosko001 | 2:45b351b4fc2a | 29 | Thread pfv_thread(pfv_fun); |
bosko001 | 1:e1bde4e82763 | 30 | |
bosko001 | 7:7ea932eb31f6 | 31 | |
bosko001 | 7:7ea932eb31f6 | 32 | void input_fun( void ) |
bosko001 | 7:7ea932eb31f6 | 33 | { |
bosko001 | 7:7ea932eb31f6 | 34 | while(true) |
bosko001 | 7:7ea932eb31f6 | 35 | { |
bosko001 | 7:7ea932eb31f6 | 36 | unsigned char uc; |
bosko001 | 7:7ea932eb31f6 | 37 | uc = (unsigned char)getchar( ); |
bosko001 | 7:7ea932eb31f6 | 38 | printf( "\n\runesen karakter %c\n\r", uc); |
bosko001 | 7:7ea932eb31f6 | 39 | if( uc == 'h' ) |
bosko001 | 7:7ea932eb31f6 | 40 | { |
bosko001 | 7:7ea932eb31f6 | 41 | extern C_HTMLparse *gpc_html; |
bosko001 | 7:7ea932eb31f6 | 42 | auto c = gpc_html->getHTML_free( ); |
bosko001 | 7:7ea932eb31f6 | 43 | printf("\n\r%s\n\r", c); |
bosko001 | 7:7ea932eb31f6 | 44 | free(c); |
bosko001 | 7:7ea932eb31f6 | 45 | |
bosko001 | 7:7ea932eb31f6 | 46 | } |
bosko001 | 7:7ea932eb31f6 | 47 | } |
bosko001 | 7:7ea932eb31f6 | 48 | } |
bosko001 | 7:7ea932eb31f6 | 49 | Thread input_thread(input_fun); |
bosko001 | 7:7ea932eb31f6 | 50 | |
bosko001 | 7:7ea932eb31f6 | 51 | |
bosko001 | 5:c9a908749d4c | 52 | C_HTMLparse *gpc_html; |
bosko001 | 7:7ea932eb31f6 | 53 | |
bosko001 | 7:7ea932eb31f6 | 54 | |
bosko001 | 7:7ea932eb31f6 | 55 | |
bosko001 | 7:7ea932eb31f6 | 56 | |
bosko001 | 0:fe8cd064ea08 | 57 | |
bosko001 | 0:fe8cd064ea08 | 58 | int main(void) |
bosko001 | 0:fe8cd064ea08 | 59 | { |
bosko001 | 1:e1bde4e82763 | 60 | |
bosko001 | 2:45b351b4fc2a | 61 | printf("\n\r---------- POCETAK ------------- \n\r"); |
bosko001 | 3:1196befeace0 | 62 | |
bosko001 | 3:1196befeace0 | 63 | init_FlashData( ); |
bosko001 | 3:1196befeace0 | 64 | showFlashData( ); |
bosko001 | 3:1196befeace0 | 65 | |
bosko001 | 5:c9a908749d4c | 66 | gpc_html = new C_HTMLparse; |
bosko001 | 3:1196befeace0 | 67 | |
bosko001 | 5:c9a908749d4c | 68 | // putHTMLintoFLASH( gpc_html ); |
bosko001 | 5:c9a908749d4c | 69 | putFLASHintoHTML( gpc_html ); |
bosko001 | 3:1196befeace0 | 70 | |
bosko001 | 1:e1bde4e82763 | 71 | |
bosko001 | 2:45b351b4fc2a | 72 | init_EthToScom( ); |
bosko001 | 2:45b351b4fc2a | 73 | inic_TcpServerToFlash( ); |
bosko001 | 1:e1bde4e82763 | 74 | |
bosko001 | 1:e1bde4e82763 | 75 | |
bosko001 | 4:7abcf4543282 | 76 | extern void test_HTML(void); |
bosko001 | 5:c9a908749d4c | 77 | // test_HTML( ); |
bosko001 | 4:7abcf4543282 | 78 | |
bosko001 | 2:45b351b4fc2a | 79 | |
bosko001 | 2:45b351b4fc2a | 80 | int i=0; |
bosko001 | 2:45b351b4fc2a | 81 | while(true) |
bosko001 | 2:45b351b4fc2a | 82 | { |
bosko001 | 2:45b351b4fc2a | 83 | if(i++ >10 ) { i=0; GLed = !GLed;} |
bosko001 | 2:45b351b4fc2a | 84 | wait(0.01); |
bosko001 | 0:fe8cd064ea08 | 85 | } |
bosko001 | 3:1196befeace0 | 86 | |
bosko001 | 3:1196befeace0 | 87 | deinit_FlashData( ); |
bosko001 | 3:1196befeace0 | 88 | |
bosko001 | 3:1196befeace0 | 89 | |
bosko001 | 0:fe8cd064ea08 | 90 | } |
bosko001 | 0:fe8cd064ea08 | 91 | |
bosko001 | 1:e1bde4e82763 | 92 | |
bosko001 | 2:45b351b4fc2a | 93 | |
bosko001 | 2:45b351b4fc2a | 94 | |
bosko001 | 2:45b351b4fc2a | 95 | |
bosko001 | 1:e1bde4e82763 | 96 | |
bosko001 | 1:e1bde4e82763 | 97 | |
bosko001 | 1:e1bde4e82763 | 98 | |
bosko001 | 0:fe8cd064ea08 | 99 | // |
bosko001 | 0:fe8cd064ea08 | 100 | //enum nsapi_error { |
bosko001 | 0:fe8cd064ea08 | 101 | // NSAPI_ERROR_OK = 0, /*!< no error */ |
bosko001 | 0:fe8cd064ea08 | 102 | // NSAPI_ERROR_WOULD_BLOCK = -3001, /*!< no data is not available but call is non-blocking */ |
bosko001 | 0:fe8cd064ea08 | 103 | // NSAPI_ERROR_UNSUPPORTED = -3002, /*!< unsupported functionality */ |
bosko001 | 0:fe8cd064ea08 | 104 | // NSAPI_ERROR_PARAMETER = -3003, /*!< invalid configuration */ |
bosko001 | 0:fe8cd064ea08 | 105 | // NSAPI_ERROR_NO_CONNECTION = -3004, /*!< not connected to a network */ |
bosko001 | 0:fe8cd064ea08 | 106 | // NSAPI_ERROR_NO_SOCKET = -3005, /*!< socket not available for use */ |
bosko001 | 0:fe8cd064ea08 | 107 | // NSAPI_ERROR_NO_ADDRESS = -3006, /*!< IP address is not known */ |
bosko001 | 0:fe8cd064ea08 | 108 | // NSAPI_ERROR_NO_MEMORY = -3007, /*!< memory resource not available */ |
bosko001 | 0:fe8cd064ea08 | 109 | // NSAPI_ERROR_NO_SSID = -3008, /*!< ssid not found */ |
bosko001 | 0:fe8cd064ea08 | 110 | // NSAPI_ERROR_DNS_FAILURE = -3009, /*!< DNS failed to complete successfully */ |
bosko001 | 0:fe8cd064ea08 | 111 | // NSAPI_ERROR_DHCP_FAILURE = -3010, /*!< DHCP failed to complete successfully */ |
bosko001 | 0:fe8cd064ea08 | 112 | // NSAPI_ERROR_AUTH_FAILURE = -3011, /*!< connection to access point failed */ |
bosko001 | 0:fe8cd064ea08 | 113 | // NSAPI_ERROR_DEVICE_ERROR = -3012, /*!< failure interfacing with the network processor */ |
bosko001 | 0:fe8cd064ea08 | 114 | // NSAPI_ERROR_IN_PROGRESS = -3013, /*!< operation (eg connect) in progress */ |
bosko001 | 0:fe8cd064ea08 | 115 | // NSAPI_ERROR_ALREADY = -3014, /*!< operation (eg connect) already in progress */ |
bosko001 | 0:fe8cd064ea08 | 116 | // NSAPI_ERROR_IS_CONNECTED = -3015, /*!< socket is already connected */ |
bosko001 | 0:fe8cd064ea08 | 117 | // NSAPI_ERROR_CONNECTION_LOST = -3016, /*!< connection lost */ |
bosko001 | 0:fe8cd064ea08 | 118 | // NSAPI_ERROR_CONNECTION_TIMEOUT = -3017, /*!< connection timed out */ |
bosko001 | 0:fe8cd064ea08 | 119 | //}; |