69 #include <ti/mcu/msp430/Grace.h>
103 #define MAIN_TASK_SCH_SPI main_taskSchedule[0]// SPI
104 #define MAIN_TASK_SCH_CCAI main_taskSchedule[1]// CC2480
105 #define MAIN_TASK_SCH_NWK main_taskSchedule[2]// Network
106 #define MAIN_TASK_SCH_ADC main_taskSchedule[3]// ADC
107 #define MAIN_TASK_SCH_UART main_taskSchedule[4]// UART
108 #define MAIN_TASK_SCH_LED main_taskSchedule[5]// Led
109 #define MAIN_TASK_SCH_BUT main_taskSchedule[6]// Button
110 #define MAIN_TASK_SCH_REP main_taskSchedule[7]// Report
111 #define MAIN_TASK_SCH_WDT main_taskSchedule[8]// Watch Dog
115 #define MAIN_TASK_COUNT 9
120 #define MAIN_FLAG_WDT_BIT 1
143 UInt16 main_runCounter = 0;
144 Uint8 main_flags = 0;
194 MAIN_TASK_SCH_REP= 200;
200 if (MAIN_TASK_SCH_SPI== main_runCounter)
204 if (MAIN_TASK_SCH_CCAI == main_runCounter)
208 if (MAIN_TASK_SCH_NWK == main_runCounter)
209 MAIN_TASK_SCH_NWK = main_runCounter +
nwk_process();
212 if (MAIN_TASK_SCH_ADC == main_runCounter)
216 if (MAIN_TASK_SCH_UART == main_runCounter)
220 if (MAIN_TASK_SCH_LED == main_runCounter)
224 if (MAIN_TASK_SCH_BUT == main_runCounter)
228 if (MAIN_TASK_SCH_REP == main_runCounter)
232 if (MAIN_TASK_SCH_WDT == main_runCounter) {
233 MAIN_TASK_SCH_WDT = main_runCounter + 2000;
235 WDTCTL = WDTPW | WDTCNTCL | WDTSSEL;
239 __bis_SR_register(LPM3_bits + GIE);
257 static Uint8 main_timerCount = 0;
259 __disable_interrupt();
266 if (!(main_timerCount & 0x03)) {
270 __enable_interrupt();
UInt16 rep_proccess()
Report process.
Network functions interface.
UInt8 TMRB0_ISR()
Tiner B0 ISR.
Interruption management (enable/disable) interface.
void clock_tick()
Clock tick.
void adc_init()
This function initializes the ADC variables.
UInt16 uart_proccess()
UART process.
UInt16 led_proccess()
This function processes the tasks of the LED, it controls the red LED.
ADC10 connected sensors reading interface.
void main()
Main function of the program.
void rep_init()
Report initialization.
void clock_init()
Clock Initialization.
UInt8 uart_startFrame(UInt8 len, UInt8 cmd0, UInt8 cmd1)
Start frame.
UInt16 main_taskSchedule[MAIN_TASK_COUNT]
Task schedule for each task.
void nwk_init()
Network initialization.
UInt16 nwk_process()
Network process.
#define MAIN_FLAG_WDT_BIT
void led_init()
LED Initialization.
UInt16 spi_proccess()
SPI proccess.
UInt8 uart_snd(UInt8 len, void *pBuf)
Send.
void rep_hello()
Hello message.
void ccai_init()
This function initializes the CC2480 Application Interface variables.
UInt16 ccai_proccess()
This function processes the tasks of the CC2480 Application Interface.
void uart_init()
UART initialization.
void uart_endFrame()
End frame.
void spi_init()
SPI initialization.
UInt16 adc_proccess()
This function processes the tasks of the ADC.