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