add Microchip MPLAB Harmony support

This commit is contained in:
toddouska 2013-10-28 11:03:50 -07:00
parent 8c7715ee33
commit 9438d0d41b
3 changed files with 17 additions and 4 deletions

View File

@ -285,7 +285,11 @@ time_t pic32_time(time_t* timer)
if (timer == NULL)
timer = &localTime;
#ifdef MICROCHIP_MPLAB_HARMONY
sec = TCPIP_SNTP_UTCSecondsGet();
#else
sec = SNTPGetUTCSeconds();
#endif
*timer = (time_t) sec;
return *timer;

View File

@ -458,18 +458,23 @@ int GenerateSeed(OS_Seed* os, byte* output, word32 sz)
#elif defined(MICROCHIP_PIC32)
#ifndef MICROCHIP_MPLAB_HARMONY
#include <peripheral/timer.h>
#define PIC32_SEED_COUNT _CP0_GET_COUNT
#else
#define PIC32_SEED_COUNT ReadCoreTimer
#endif
/* uses the core timer, in nanoseconds to seed srand */
int GenerateSeed(OS_Seed* os, byte* output, word32 sz)
{
int i;
srand(ReadCoreTimer() * 25);
srand(PIC32_SEED_COUNT() * 25);
for (i = 0; i < sz; i++ ) {
output[i] = rand() % 256;
if ( (i % 8) == 7)
srand(ReadCoreTimer() * 25);
srand(PIC32_SEED_COUNT() * 25);
}
return 0;

View File

@ -130,8 +130,12 @@
#ifdef MICROCHIP_TCPIP
/* include timer, NTP functions */
#include "system/system_services.h"
#ifdef MICROCHIP_MPLAB_HARMONY
#include "tcpip/tcpip.h"
#else
#include "tcpip/sntp.h"
#endif
#endif
#ifdef MBED
#define SINGLE_THREADED