|
@@ -46,6 +46,7 @@
|
|
|
|
|
|
|
|
#include <time.h>
|
|
#include <time.h>
|
|
|
#include "rtc.h"
|
|
#include "rtc.h"
|
|
|
|
|
+#include "ntp.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------*/
|
|
/*-------------------------------------------------------------------------*/
|
|
@@ -79,7 +80,7 @@ static void SysControlMainBeat(u_char);
|
|
|
/*-------------------------------------------------------------------------*/
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
|
|
|
-/* ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ */
|
|
|
|
|
|
|
+/* ����������������������������������������������������������������������� */
|
|
|
/*!
|
|
/*!
|
|
|
* \brief ISR MainBeat Timer Interrupt (Timer 2 for Mega128, Timer 0 for Mega256).
|
|
* \brief ISR MainBeat Timer Interrupt (Timer 2 for Mega128, Timer 0 for Mega256).
|
|
|
*
|
|
*
|
|
@@ -90,7 +91,7 @@ static void SysControlMainBeat(u_char);
|
|
|
*
|
|
*
|
|
|
* \param *p not used (might be used to pass parms from the ISR)
|
|
* \param *p not used (might be used to pass parms from the ISR)
|
|
|
*/
|
|
*/
|
|
|
-/* ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ */
|
|
|
|
|
|
|
+/* ����������������������������������������������������������������������� */
|
|
|
static void SysMainBeatInterrupt(void *p)
|
|
static void SysMainBeatInterrupt(void *p)
|
|
|
{
|
|
{
|
|
|
|
|
|
|
@@ -102,7 +103,7 @@ static void SysMainBeatInterrupt(void *p)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
-/* ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ */
|
|
|
|
|
|
|
+/* ����������������������������������������������������������������������� */
|
|
|
/*!
|
|
/*!
|
|
|
* \brief Initialise Digital IO
|
|
* \brief Initialise Digital IO
|
|
|
* init inputs to '0', outputs to '1' (DDRxn='0' or '1')
|
|
* init inputs to '0', outputs to '1' (DDRxn='0' or '1')
|
|
@@ -110,7 +111,7 @@ static void SysMainBeatInterrupt(void *p)
|
|
|
* Pull-ups are enabled when the pin is set to input (DDRxn='0') and then a '1'
|
|
* Pull-ups are enabled when the pin is set to input (DDRxn='0') and then a '1'
|
|
|
* is written to the pin (PORTxn='1')
|
|
* is written to the pin (PORTxn='1')
|
|
|
*/
|
|
*/
|
|
|
-/* ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ */
|
|
|
|
|
|
|
+/* ����������������������������������������������������������������������� */
|
|
|
void SysInitIO(void)
|
|
void SysInitIO(void)
|
|
|
{
|
|
{
|
|
|
/*
|
|
/*
|
|
@@ -167,12 +168,12 @@ void SysInitIO(void)
|
|
|
outp(0x18, DDRG);
|
|
outp(0x18, DDRG);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-/* ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ */
|
|
|
|
|
|
|
+/* ����������������������������������������������������������������������� */
|
|
|
/*!
|
|
/*!
|
|
|
* \brief Starts or stops the 4.44 msec mainbeat of the system
|
|
* \brief Starts or stops the 4.44 msec mainbeat of the system
|
|
|
* \param OnOff indicates if the mainbeat needs to start or to stop
|
|
* \param OnOff indicates if the mainbeat needs to start or to stop
|
|
|
*/
|
|
*/
|
|
|
-/* ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ */
|
|
|
|
|
|
|
+/* ����������������������������������������������������������������������� */
|
|
|
static void SysControlMainBeat(u_char OnOff)
|
|
static void SysControlMainBeat(u_char OnOff)
|
|
|
{
|
|
{
|
|
|
int nError = 0;
|
|
int nError = 0;
|
|
@@ -206,7 +207,7 @@ int checkOffPressed(){
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-/* ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ */
|
|
|
|
|
|
|
+/* ����������������������������������������������������������������������� */
|
|
|
/*!
|
|
/*!
|
|
|
* \brief Main entry of the SIR firmware
|
|
* \brief Main entry of the SIR firmware
|
|
|
*
|
|
*
|
|
@@ -217,7 +218,7 @@ int checkOffPressed(){
|
|
|
*
|
|
*
|
|
|
* \return \b never returns
|
|
* \return \b never returns
|
|
|
*/
|
|
*/
|
|
|
-/* ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ */
|
|
|
|
|
|
|
+/* ����������������������������������������������������������������������� */
|
|
|
int main(void)
|
|
int main(void)
|
|
|
{
|
|
{
|
|
|
time_t start;
|
|
time_t start;
|
|
@@ -254,6 +255,8 @@ int main(void)
|
|
|
CardInit();
|
|
CardInit();
|
|
|
|
|
|
|
|
NetworkInit();
|
|
NetworkInit();
|
|
|
|
|
+
|
|
|
|
|
+ NtpInit();
|
|
|
/*
|
|
/*
|
|
|
* Kroeske: sources in rtc.c en rtc.h
|
|
* Kroeske: sources in rtc.c en rtc.h
|
|
|
*/
|
|
*/
|