|
@@ -1,27 +1,33 @@
|
|
/*
|
|
/*
|
|
- * Copyright (c) 2006-2021, RT-Thread Development Team
|
|
|
|
|
|
+ * Copyright (c) 2006-2023, RT-Thread Development Team
|
|
*
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*
|
|
*
|
|
* Change Logs:
|
|
* Change Logs:
|
|
- * Date Author Notes
|
|
|
|
- * 2010-03-30 Kyle First version
|
|
|
|
|
|
+ * Date Author Notes
|
|
|
|
+ * 2010-03-30 Kyle First version
|
|
|
|
+ * 2023-10-20 Raman Gopalan Access GPIO using RT's pin abstractions
|
|
*/
|
|
*/
|
|
|
|
|
|
#include <rtthread.h>
|
|
#include <rtthread.h>
|
|
|
|
+#include <rtdevice.h>
|
|
#include "compiler.h"
|
|
#include "compiler.h"
|
|
#include "gpio.h"
|
|
#include "gpio.h"
|
|
|
|
|
|
|
|
+#define USER_LED_1 AVR32_PIN_PA08
|
|
|
|
+#define USER_LED_2 AVR32_PIN_PA07
|
|
|
|
+
|
|
char thread_led1_stack[1024];
|
|
char thread_led1_stack[1024];
|
|
struct rt_thread thread_led1;
|
|
struct rt_thread thread_led1;
|
|
static void rt_thread_entry_led1(void* parameter)
|
|
static void rt_thread_entry_led1(void* parameter)
|
|
{
|
|
{
|
|
|
|
+ rt_pin_mode(USER_LED_1, PIN_MODE_OUTPUT);
|
|
while (1)
|
|
while (1)
|
|
{
|
|
{
|
|
- gpio_tgl_gpio_pin(AVR32_PIN_PA08);
|
|
|
|
|
|
+ rt_pin_write(USER_LED_1, 1);
|
|
rt_thread_delay(RT_TICK_PER_SECOND / 2); /* sleep 0.5 second and switch to other thread */
|
|
rt_thread_delay(RT_TICK_PER_SECOND / 2); /* sleep 0.5 second and switch to other thread */
|
|
|
|
|
|
- gpio_tgl_gpio_pin(AVR32_PIN_PA08);
|
|
|
|
|
|
+ rt_pin_write(USER_LED_1, 0);
|
|
rt_thread_delay(RT_TICK_PER_SECOND / 2);
|
|
rt_thread_delay(RT_TICK_PER_SECOND / 2);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -30,12 +36,13 @@ char thread_led2_stack[1024];
|
|
struct rt_thread thread_led2;
|
|
struct rt_thread thread_led2;
|
|
void rt_thread_entry_led2(void* parameter)
|
|
void rt_thread_entry_led2(void* parameter)
|
|
{
|
|
{
|
|
|
|
+ rt_pin_mode(USER_LED_2, PIN_MODE_OUTPUT);
|
|
while (1)
|
|
while (1)
|
|
{
|
|
{
|
|
- gpio_tgl_gpio_pin(AVR32_PIN_PA07);
|
|
|
|
|
|
+ rt_pin_write(USER_LED_2, 1);
|
|
rt_thread_delay(RT_TICK_PER_SECOND);
|
|
rt_thread_delay(RT_TICK_PER_SECOND);
|
|
|
|
|
|
- gpio_tgl_gpio_pin(AVR32_PIN_PA07);
|
|
|
|
|
|
+ rt_pin_write(USER_LED_2, 0);
|
|
rt_thread_delay(RT_TICK_PER_SECOND);
|
|
rt_thread_delay(RT_TICK_PER_SECOND);
|
|
}
|
|
}
|
|
}
|
|
}
|