Wiznet W5500 lightweight SNTPClient example, tested on Maxim MAX32630FTHR board

Dependencies:   mbed W5500-Interface max32630fthr W5500-SNTPClient

Files at this revision

API Documentation at this revision

Comitter:
star297
Date:
Thu May 02 20:57:14 2019 +0000
Commit message:
First commit

Changed in this revision

W5500-Interface.lib Show annotated file Show diff for this revision Revisions of this file
W5500-SNTPClient.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
max32630fthr.lib Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 31500befb6ca W5500-Interface.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/W5500-Interface.lib	Thu May 02 20:57:14 2019 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/star297/code/W5500-Interface/#e9275bdfa393
diff -r 000000000000 -r 31500befb6ca W5500-SNTPClient.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/W5500-SNTPClient.lib	Thu May 02 20:57:14 2019 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/star297/code/W5500-SNTPClient/#f8cb34a007a4
diff -r 000000000000 -r 31500befb6ca main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu May 02 20:57:14 2019 +0000
@@ -0,0 +1,32 @@
+
+//  Wiznet WIZ550io bytsize SNTPClient Example
+//  Tested using MAX32630FTHR board
+
+#include "mbed.h"
+#include "EthernetInterface.h"
+#include "SNTPClient.h"
+
+#include "max32630fthr.h" 
+    //Init board and set GPIO to 3.3V logic
+MAX32630FTHR pegasus(MAX32630FTHR::VIO_3V3);
+ 
+EthernetInterface   eth(P5_1, P5_2, P5_0, P3_0, P3_1); // MOSI, MISO, SCK, CS, RESET
+SNTPClient          sntp;
+ 
+int main() {
+    
+    printf("Initialise! \n\n");
+    eth.init(); //Use DHCP
+    printf("Connecting.. \n");
+    eth.connect();
+    printf("IP Address is: %s\n\n", eth.getIPAddress());
+    printf("Get NTP... \n\n");
+    
+    // example NTPpool = "1.nl.pool.ntp.org"
+    // get seconds UTC + 1hour, enable DST and set MCU RTC
+    printf("Seconds since 1970 = %d\n\n", sntp.getNTP("1.nl.pool.ntp.org",1,1,1));
+    time_t ctTime;
+    ctTime = time(NULL);
+    printf("RTC is set to: %s\n", ctime(&ctTime));
+}
+ 
\ No newline at end of file
diff -r 000000000000 -r 31500befb6ca max32630fthr.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/max32630fthr.lib	Thu May 02 20:57:14 2019 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/teams/MaximIntegrated/code/max32630fthr/#8f6e6a800f2f
diff -r 000000000000 -r 31500befb6ca mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu May 02 20:57:14 2019 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file