Versão sem FFT e aquisição por DMA. 256 amostras.
Dependencies: EthernetInterface NTPClient mbed-rtos mbed
Diff: Codes/ntpc.cpp
- Revision:
- 0:e57bc370d339
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Codes/ntpc.cpp Tue Jan 05 11:45:44 2016 +0000 @@ -0,0 +1,24 @@ +#include "ntpc.h" + +void ntpc::ntpc_Thread(void const* arg) +{ + printf("\r\nTrhead NTP client\r\n"); + while (true) + { + ntpcDo(); + wait(30); + } +} + +void ntpc::ntpcDo() +{ + printf("Pegando NTP...\r\n"); + if (ntpClient.setTime("ntp.ubuntu.com") == 0) { + printf("NTP OK!\r\n"); + time_t ctTime; + ctTime = time(NULL); + printf("Setando para hora (UTC): %s\r\n", ctime(&ctTime)); + } else { + printf("NTP Erro!\r\n"); + } +} \ No newline at end of file