/****************************************************************************
|
* Copyright: (C)2014 Î人ÁèÔÆÇ¶ÈëʽʵÑéÊÒ www.emblinux.com
|
* Author: GuoWenxue<guowenxue@gmail.com> QQ: 281143292
|
* Description: ·Ü¶·STM32v5¿ª·¢°åcontiki²Ù×÷ϵͳÈë¿Ú³ÌÐò
|
*
|
* ChangeLog:
|
* °æ±¾ºÅ ÈÕÆÚ ×÷Õß ËµÃ÷
|
* V1.0.0 2014.08.25 GuoWenxue ·¢²¼¸Ã°æ±¾
|
****************************************************************************/
|
|
#include"stm32f10x.h"
|
#include "stm32v5_led.h"
|
#include "debug-uart.h"
|
#include "contiki.h"
|
#include <stdio.h>
|
|
PROCESS(led_blink_process, "LED blink process");
|
AUTOSTART_PROCESSES(&led_blink_process);
|
|
PROCESS_THREAD(led_blink_process, ev, data)
|
{
|
PROCESS_BEGIN();
|
|
while(1)
|
{
|
static struct etimer et;
|
|
etimer_set(&et, CLOCK_SECOND);
|
PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et));
|
printf("Turn LED1 on\n");
|
turn_led(LED1, ON);
|
|
etimer_set(&et, CLOCK_SECOND);
|
PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&et));
|
printf("Turn LED1 off\n");
|
turn_led(LED1, OFF);
|
}
|
|
PROCESS_END();
|
}
|
|
int main(void)
|
{
|
init_led_gpio();
|
dbg_setup_uart();
|
clock_init();
|
|
process_init();
|
process_start(&etimer_process, NULL);
|
autostart_start(autostart_processes);
|
printf("Processes running\n");
|
|
while(1)
|
{
|
do { } while(process_run() > 0); /* Let process running */
|
/*Comes here means CPU is Idel*/
|
}
|
|
return 0;
|
}
|