bosko lekovic
/
ETHtoCOM_10
nova verzija tcp+udp->serial com
main.cpp@3:1196befeace0, 2020-04-08 (annotated)
- Committer:
- bosko001
- Date:
- Wed Apr 08 08:41:16 2020 +0000
- Revision:
- 3:1196befeace0
- Parent:
- 2:45b351b4fc2a
- Child:
- 4:7abcf4543282
ver 04 od 8.4.20
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 | 2:45b351b4fc2a | 11 | volatile PFV pfv = NULL; |
bosko001 | 1:e1bde4e82763 | 12 | |
bosko001 | 1:e1bde4e82763 | 13 | |
bosko001 | 2:45b351b4fc2a | 14 | DigitalOut GLed(LED2,1); |
bosko001 | 1:e1bde4e82763 | 15 | |
bosko001 | 2:45b351b4fc2a | 16 | void pfv_fun( void ) |
bosko001 | 1:e1bde4e82763 | 17 | { |
bosko001 | 2:45b351b4fc2a | 18 | while(true) |
bosko001 | 2:45b351b4fc2a | 19 | { |
bosko001 | 2:45b351b4fc2a | 20 | if(pfv) {pfv(); pfv = NULL;} |
bosko001 | 2:45b351b4fc2a | 21 | cleanTcpServerToFlashThread( ); |
bosko001 | 2:45b351b4fc2a | 22 | |
bosko001 | 2:45b351b4fc2a | 23 | } |
bosko001 | 1:e1bde4e82763 | 24 | } |
bosko001 | 2:45b351b4fc2a | 25 | Thread pfv_thread(pfv_fun); |
bosko001 | 1:e1bde4e82763 | 26 | |
bosko001 | 0:fe8cd064ea08 | 27 | |
bosko001 | 0:fe8cd064ea08 | 28 | int main(void) |
bosko001 | 0:fe8cd064ea08 | 29 | { |
bosko001 | 1:e1bde4e82763 | 30 | |
bosko001 | 2:45b351b4fc2a | 31 | printf("\n\r---------- POCETAK ------------- \n\r"); |
bosko001 | 3:1196befeace0 | 32 | |
bosko001 | 3:1196befeace0 | 33 | init_FlashData( ); |
bosko001 | 3:1196befeace0 | 34 | showFlashData( ); |
bosko001 | 3:1196befeace0 | 35 | |
bosko001 | 3:1196befeace0 | 36 | init_html( ); |
bosko001 | 3:1196befeace0 | 37 | putHTMLintoFlash( ); |
bosko001 | 3:1196befeace0 | 38 | refreshDataFromFlash( ); |
bosko001 | 3:1196befeace0 | 39 | |
bosko001 | 3:1196befeace0 | 40 | showFlashData( ); |
bosko001 | 3:1196befeace0 | 41 | |
bosko001 | 1:e1bde4e82763 | 42 | |
bosko001 | 2:45b351b4fc2a | 43 | init_EthToScom( ); |
bosko001 | 2:45b351b4fc2a | 44 | inic_TcpServerToFlash( ); |
bosko001 | 1:e1bde4e82763 | 45 | |
bosko001 | 1:e1bde4e82763 | 46 | |
bosko001 | 2:45b351b4fc2a | 47 | |
bosko001 | 2:45b351b4fc2a | 48 | |
bosko001 | 2:45b351b4fc2a | 49 | int i=0; |
bosko001 | 2:45b351b4fc2a | 50 | while(true) |
bosko001 | 2:45b351b4fc2a | 51 | { |
bosko001 | 2:45b351b4fc2a | 52 | if(i++ >10 ) { i=0; GLed = !GLed;} |
bosko001 | 2:45b351b4fc2a | 53 | wait(0.01); |
bosko001 | 0:fe8cd064ea08 | 54 | } |
bosko001 | 3:1196befeace0 | 55 | |
bosko001 | 3:1196befeace0 | 56 | deinit_FlashData( ); |
bosko001 | 3:1196befeace0 | 57 | |
bosko001 | 3:1196befeace0 | 58 | |
bosko001 | 0:fe8cd064ea08 | 59 | } |
bosko001 | 0:fe8cd064ea08 | 60 | |
bosko001 | 1:e1bde4e82763 | 61 | |
bosko001 | 2:45b351b4fc2a | 62 | |
bosko001 | 2:45b351b4fc2a | 63 | |
bosko001 | 2:45b351b4fc2a | 64 | |
bosko001 | 1:e1bde4e82763 | 65 | |
bosko001 | 1:e1bde4e82763 | 66 | |
bosko001 | 1:e1bde4e82763 | 67 | |
bosko001 | 0:fe8cd064ea08 | 68 | // |
bosko001 | 0:fe8cd064ea08 | 69 | //enum nsapi_error { |
bosko001 | 0:fe8cd064ea08 | 70 | // NSAPI_ERROR_OK = 0, /*!< no error */ |
bosko001 | 0:fe8cd064ea08 | 71 | // NSAPI_ERROR_WOULD_BLOCK = -3001, /*!< no data is not available but call is non-blocking */ |
bosko001 | 0:fe8cd064ea08 | 72 | // NSAPI_ERROR_UNSUPPORTED = -3002, /*!< unsupported functionality */ |
bosko001 | 0:fe8cd064ea08 | 73 | // NSAPI_ERROR_PARAMETER = -3003, /*!< invalid configuration */ |
bosko001 | 0:fe8cd064ea08 | 74 | // NSAPI_ERROR_NO_CONNECTION = -3004, /*!< not connected to a network */ |
bosko001 | 0:fe8cd064ea08 | 75 | // NSAPI_ERROR_NO_SOCKET = -3005, /*!< socket not available for use */ |
bosko001 | 0:fe8cd064ea08 | 76 | // NSAPI_ERROR_NO_ADDRESS = -3006, /*!< IP address is not known */ |
bosko001 | 0:fe8cd064ea08 | 77 | // NSAPI_ERROR_NO_MEMORY = -3007, /*!< memory resource not available */ |
bosko001 | 0:fe8cd064ea08 | 78 | // NSAPI_ERROR_NO_SSID = -3008, /*!< ssid not found */ |
bosko001 | 0:fe8cd064ea08 | 79 | // NSAPI_ERROR_DNS_FAILURE = -3009, /*!< DNS failed to complete successfully */ |
bosko001 | 0:fe8cd064ea08 | 80 | // NSAPI_ERROR_DHCP_FAILURE = -3010, /*!< DHCP failed to complete successfully */ |
bosko001 | 0:fe8cd064ea08 | 81 | // NSAPI_ERROR_AUTH_FAILURE = -3011, /*!< connection to access point failed */ |
bosko001 | 0:fe8cd064ea08 | 82 | // NSAPI_ERROR_DEVICE_ERROR = -3012, /*!< failure interfacing with the network processor */ |
bosko001 | 0:fe8cd064ea08 | 83 | // NSAPI_ERROR_IN_PROGRESS = -3013, /*!< operation (eg connect) in progress */ |
bosko001 | 0:fe8cd064ea08 | 84 | // NSAPI_ERROR_ALREADY = -3014, /*!< operation (eg connect) already in progress */ |
bosko001 | 0:fe8cd064ea08 | 85 | // NSAPI_ERROR_IS_CONNECTED = -3015, /*!< socket is already connected */ |
bosko001 | 0:fe8cd064ea08 | 86 | // NSAPI_ERROR_CONNECTION_LOST = -3016, /*!< connection lost */ |
bosko001 | 0:fe8cd064ea08 | 87 | // NSAPI_ERROR_CONNECTION_TIMEOUT = -3017, /*!< connection timed out */ |
bosko001 | 0:fe8cd064ea08 | 88 | //}; |