1 /* 2 * Copyright (c) 2006-2021, RT-Thread Development Team 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 * 6 * Change Logs: 7 * Date Author Notes 8 * 2011-01-13 weety first version 9 * 2015-04-27 ArdaFu Port bsp from at91sam9260 to asm9260t 10 */ 11 12 #include <rtthread.h> 13 #include <rtdevice.h> 14 15 #ifdef RT_USING_LED 16 #include "led.h" 17 rt_led_thread_entry(void * parameter)18void rt_led_thread_entry(void* parameter) 19 { 20 rt_uint8_t cnt = 0; 21 led_init(); 22 while(1) 23 { 24 /* light on leds for one second */ 25 rt_thread_delay(40); 26 cnt++; 27 if(cnt & 0x01) 28 led_on(1); 29 else 30 led_off(1); 31 } 32 } 33 start_led_thread(void)34static void start_led_thread(void) 35 { 36 rt_thread_t led_thread; 37 led_thread = rt_thread_create("led", rt_led_thread_entry, RT_NULL, 512, 38 (RT_THREAD_PRIORITY_MAX / 8 * 5), 20); 39 if(led_thread != RT_NULL) 40 rt_thread_startup(led_thread); 41 } 42 #endif 43 main()44int main() 45 { 46 #ifdef RT_USING_LED 47 start_led_thread(); 48 #endif 49 return 0; 50 } 51