Versão sem FFT e aquisição por DMA. 256 amostras.

Dependencies:   EthernetInterface NTPClient mbed-rtos mbed

Committer:
rebonatto
Date:
Tue Jan 05 11:45:44 2016 +0000
Revision:
0:e57bc370d339
Vers?o est?vel sem calculo de FFT. Aquisi??o por DMA. Usa 256 amostras.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
rebonatto 0:e57bc370d339 1 #include "ntpc.h"
rebonatto 0:e57bc370d339 2
rebonatto 0:e57bc370d339 3 void ntpc::ntpc_Thread(void const* arg)
rebonatto 0:e57bc370d339 4 {
rebonatto 0:e57bc370d339 5 printf("\r\nTrhead NTP client\r\n");
rebonatto 0:e57bc370d339 6 while (true)
rebonatto 0:e57bc370d339 7 {
rebonatto 0:e57bc370d339 8 ntpcDo();
rebonatto 0:e57bc370d339 9 wait(30);
rebonatto 0:e57bc370d339 10 }
rebonatto 0:e57bc370d339 11 }
rebonatto 0:e57bc370d339 12
rebonatto 0:e57bc370d339 13 void ntpc::ntpcDo()
rebonatto 0:e57bc370d339 14 {
rebonatto 0:e57bc370d339 15 printf("Pegando NTP...\r\n");
rebonatto 0:e57bc370d339 16 if (ntpClient.setTime("ntp.ubuntu.com") == 0) {
rebonatto 0:e57bc370d339 17 printf("NTP OK!\r\n");
rebonatto 0:e57bc370d339 18 time_t ctTime;
rebonatto 0:e57bc370d339 19 ctTime = time(NULL);
rebonatto 0:e57bc370d339 20 printf("Setando para hora (UTC): %s\r\n", ctime(&ctTime));
rebonatto 0:e57bc370d339 21 } else {
rebonatto 0:e57bc370d339 22 printf("NTP Erro!\r\n");
rebonatto 0:e57bc370d339 23 }
rebonatto 0:e57bc370d339 24 }