summaryrefslogtreecommitdiffhomepage
path: root/digital/beacon
diff options
context:
space:
mode:
Diffstat (limited to 'digital/beacon')
-rw-r--r--digital/beacon/src/Makefile7
-rw-r--r--digital/beacon/src/main_avr.c163
2 files changed, 88 insertions, 82 deletions
diff --git a/digital/beacon/src/Makefile b/digital/beacon/src/Makefile
index b336554b..34cf8bc5 100644
--- a/digital/beacon/src/Makefile
+++ b/digital/beacon/src/Makefile
@@ -26,12 +26,17 @@ simu:host
avr:
for count in $(NUMBER); do\
$(MAKE) -C makefiles/ -f Makefile_$(CONFIG_NAME) clean BITCLOUD_PATH=$(BITCLOUD_PATH);\
- $(MAKE) -C makefiles/ -f Makefile_$(CONFIG_NAME) all APP_NAME=Beacon_$$count BITCLOUD_PATH=$(BITCLOUD_PATH) LOL_NUMBER=$$count;\
+ $(MAKE) -C makefiles/ -f Makefile_$(CONFIG_NAME) all APP_NAME=beacon_$$count BITCLOUD_PATH=$(BITCLOUD_PATH) LOL_NUMBER=$$count;\
done;\
+flash:
+ avrdude -c stk500v2 -P /dev/ttyUSB1 -p atmega1281 -B3 -U flash:w:obj/beacon_$(TARGET).hex
+
clean:
for count in $(NUMBER); do\
$(MAKE) -C makefiles/$(PROJECT_NAME) -f Makefile_$(CONFIG_NAME) clean APP_NAME=Beacon_$$count BITCLOUD_PATH=$(BITCLOUD_PATH);\
done;\
+
+
diff --git a/digital/beacon/src/main_avr.c b/digital/beacon/src/main_avr.c
index 6c0cd3be..e826e39f 100644
--- a/digital/beacon/src/main_avr.c
+++ b/digital/beacon/src/main_avr.c
@@ -18,20 +18,21 @@ History:
/******************************************************************************
Includes section
******************************************************************************/
-// #include <types.h>
-// #include <configServer.h>
-// #include <appTimer.h>
-// #include <zdo.h>
-// #include <peer2peer.h>
-// #include <network.h>
+#include <types.h>
+#include <configServer.h>
+#include <appTimer.h>
+#include <zdo.h>
+#include "configuration.h"
+#include "network.h"
// #include <serialInterface.h>
-// #include <irq.h>
-// #include <sensors.h>
-// #include <servo.h>
-// #include <stdio.h>
-// #include <debug.h>
-// #include <position.h>
-// #include <math.h>
+#include <irq.h>
+#include "sensors.h"
+#include "servo.h"
+#include <stdio.h>
+#include "debug.h"
+#include "position.h"
+#include <math.h>
+#include <util/delay.h>
/******************************************************************************
Define(s) section
******************************************************************************/
@@ -41,7 +42,7 @@ History:
******************************************************************************/
// Application related parameters
-// AppState_t appState = APP_INITIAL_STATE; // application state
+AppState_t appState = APP_INITIAL_STATE; // application state
// int jack = 0;
// status_s status;
// extern int lost_packet;
@@ -61,68 +62,68 @@ History:
\param none.
\return none.
******************************************************************************/
-// #ifdef TYPE_COOR
-// DeviceType_t deviceType = DEVICE_TYPE_COORDINATOR;
-// #else
-// DeviceType_t deviceType = DEVICE_TYPE_END_DEVICE;
-// #endif
-// int top = 0;
-// void APL_TaskHandler(void)
-// {
-// switch (appState)
-// {
-// case APP_INITIAL_STATE: // Node has initial state
-//
-// /*D5/D6/D7 are configured in output */
-// DDRD = 0xE0;
-// /* Power on the led */
-// int temp=0;
-// for(temp=0;temp<3;temp++)
-// {
-// PORTD=0xE0;
-// _delay_ms(100);
-// PORTD=0;
-// _delay_ms(100);
-// }
-//
+#ifdef TYPE_COOR
+ DeviceType_t deviceType = DEVICE_TYPE_COORDINATOR;
+#else
+ DeviceType_t deviceType = DEVICE_TYPE_END_DEVICE;
+#endif
+int top = 0;
+void APL_TaskHandler(void)
+{
+ switch (appState)
+ {
+ case APP_INITIAL_STATE: // Node has initial state
+
+ /*D5/D6/D7 are configured in output */
+ DDRD = 0xE0;
+ /* Power on the led */
+ int temp=0;
+ for(temp=0;temp<3;temp++)
+ {
+ PORTD=0xE0;
+ _delay_ms(100);
+ PORTD=0;
+ _delay_ms(100);
+ }
+
// initSerialInterface(); // Open USART
-//
-// switch(deviceType)
-// {
-// case DEVICE_TYPE_COORDINATOR:
-// // error = init_twi();
+
+ switch(deviceType)
+ {
+ case DEVICE_TYPE_COORDINATOR:
+// error = init_twi();
// initNetwork();
-// break;
-// case DEVICE_TYPE_END_DEVICE:
+ break;
+ case DEVICE_TYPE_END_DEVICE:
// init_ILS();
// control_motor_ms(100);
// init_timer_servo();
// initNetwork();
-// break;
-// default:
-// break;
-// }
-// appState = APP_NETWORK_JOINING_STATE;
-// SYS_PostTask(APL_TASK_ID); // Execute next step
-// break;
-//
-// case APP_NETWORK_JOINING_STATE:
+ break;
+ default:
+ break;
+ }
+ appState = APP_NETWORK_JOINING_STATE;
+ SYS_PostTask(APL_TASK_ID); // Execute next step
+ break;
+
+ case APP_NETWORK_JOINING_STATE:
// startNetwork();
-// break;
-//
-// case APP_NETWORK_LEAVING_STATE:
-// break;
-// case APP_NETWORK_JOINED_STATE:
+ break;
+
+ case APP_NETWORK_LEAVING_STATE:
+ break;
+ case APP_NETWORK_JOINED_STATE:
// if(jack == 1)
// {
// send_angle(angle);
// }
-// break;
-// default:
-// break;
-// }
-// }
-//
+ break;
+ default:
+ break;
+ }
+}
+
/**************************************************************************//**
@@ -131,9 +132,9 @@ History:
\param none.
\return none.
******************************************************************************/
-// void ZDO_WakeUpInd(void)
-// {
-// }
+void ZDO_WakeUpInd(void)
+{
+}
#ifdef _BINDING_
@@ -147,10 +148,10 @@ Return:
none
***********************************************************************************/
-// void ZDO_BindIndication(ZDO_BindInd_t *bindInd)
-// {
-// (void)bindInd;
-// }
+void ZDO_BindIndication(ZDO_BindInd_t *bindInd)
+{
+(void)bindInd;
+}
/***********************************************************************************
Stub for ZDO Unbinding Indication
@@ -162,10 +163,10 @@ Return:
none
***********************************************************************************/
-// void ZDO_UnbindIndication(ZDO_UnbindInd_t *unbindInd)
-// {
-// (void)unbindInd;
-// }
+void ZDO_UnbindIndication(ZDO_UnbindInd_t *unbindInd)
+{
+(void)unbindInd;
+}
#endif //_BINDING_
/**********************************************************************//**
@@ -177,11 +178,11 @@ none
int main(void)
{
// init_timer3();
-// SYS_SysInit();
+ SYS_SysInit();
// init_struct();
-// for(;;)
-// {
-// SYS_RunTask();
-// }
+ for(;;)
+ {
+ SYS_RunTask();
+ }
}
// eof peer2Peer.c