用于EagleEye3.0 规则集漏报和误报测试的示例项目,项目收集于github和gitee
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

42 lines
864 B

/*
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2020-09-05 DongBowen first version
*/
#include "board.h"
#include <rtthread.h>
#include <rtdevice.h>
#define LED_PIN GET_PIN(C, 13)
#define LED_PERIOD (RT_TICK_PER_SECOND / 5)
#define KEY_PIN GET_PIN(B, 12)
void key_handle(void *args)
{
rt_kprintf("key pressed!\n");
}
int main(void)
{
rt_pin_mode(KEY_PIN, PIN_MODE_INPUT_PULLUP);
rt_pin_attach_irq(KEY_PIN, PIN_IRQ_MODE_FALLING, key_handle, RT_NULL);
rt_pin_irq_enable(KEY_PIN, PIN_IRQ_ENABLE);
rt_pin_mode(LED_PIN, PIN_MODE_OUTPUT);
while (1)
{
rt_pin_write(LED_PIN, PIN_HIGH);
rt_thread_delay(LED_PERIOD / 2);
rt_pin_write(LED_PIN, PIN_LOW);
rt_thread_delay(LED_PERIOD / 2);
};
}