|
|
@@ -41,10 +41,12 @@
|
|
|
#include "watchdog.h"
|
|
|
#include "flash.h"
|
|
|
#include "spidrv.h"
|
|
|
+#include "network.h"
|
|
|
|
|
|
|
|
|
#include <time.h>
|
|
|
#include "rtc.h"
|
|
|
+#include "ntp.h"
|
|
|
|
|
|
|
|
|
/*-------------------------------------------------------------------------*/
|
|
|
@@ -78,7 +80,7 @@ static void SysControlMainBeat(u_char);
|
|
|
/*-------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
-/* ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ */
|
|
|
+/* ����������������������������������������������������������������������� */
|
|
|
/*!
|
|
|
* \brief ISR MainBeat Timer Interrupt (Timer 2 for Mega128, Timer 0 for Mega256).
|
|
|
*
|
|
|
@@ -89,7 +91,7 @@ static void SysControlMainBeat(u_char);
|
|
|
*
|
|
|
* \param *p not used (might be used to pass parms from the ISR)
|
|
|
*/
|
|
|
-/* ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ */
|
|
|
+/* ����������������������������������������������������������������������� */
|
|
|
static void SysMainBeatInterrupt(void *p)
|
|
|
{
|
|
|
|
|
|
@@ -101,7 +103,7 @@ static void SysMainBeatInterrupt(void *p)
|
|
|
}
|
|
|
|
|
|
|
|
|
-/* ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ */
|
|
|
+/* ����������������������������������������������������������������������� */
|
|
|
/*!
|
|
|
* \brief Initialise Digital IO
|
|
|
* init inputs to '0', outputs to '1' (DDRxn='0' or '1')
|
|
|
@@ -109,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'
|
|
|
* is written to the pin (PORTxn='1')
|
|
|
*/
|
|
|
-/* ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ */
|
|
|
+/* ����������������������������������������������������������������������� */
|
|
|
void SysInitIO(void)
|
|
|
{
|
|
|
/*
|
|
|
@@ -166,12 +168,12 @@ void SysInitIO(void)
|
|
|
outp(0x18, DDRG);
|
|
|
}
|
|
|
|
|
|
-/* ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ */
|
|
|
+/* ����������������������������������������������������������������������� */
|
|
|
/*!
|
|
|
* \brief Starts or stops the 4.44 msec mainbeat of the system
|
|
|
* \param OnOff indicates if the mainbeat needs to start or to stop
|
|
|
*/
|
|
|
-/* ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ */
|
|
|
+/* ����������������������������������������������������������������������� */
|
|
|
static void SysControlMainBeat(u_char OnOff)
|
|
|
{
|
|
|
int nError = 0;
|
|
|
@@ -221,7 +223,7 @@ int checkOffPressed(){
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-/* ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ */
|
|
|
+/* ����������������������������������������������������������������������� */
|
|
|
/*!
|
|
|
* \brief Main entry of the SIR firmware
|
|
|
*
|
|
|
@@ -232,7 +234,7 @@ int checkOffPressed(){
|
|
|
*
|
|
|
* \return \b never returns
|
|
|
*/
|
|
|
-/* ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ */
|
|
|
+/* ����������������������������������������������������������������������� */
|
|
|
int main(void)
|
|
|
{
|
|
|
time_t start;
|
|
|
@@ -269,6 +271,9 @@ int main(void)
|
|
|
|
|
|
CardInit();
|
|
|
|
|
|
+ NetworkInit();
|
|
|
+
|
|
|
+ //NtpInit();
|
|
|
/*
|
|
|
* Kroeske: sources in rtc.c en rtc.h
|
|
|
*/
|
|
|
@@ -284,6 +289,7 @@ int main(void)
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
RcInit();
|
|
|
|
|
|
KbInit();
|