#include "ets_sys.h"
#include "osapi.h"
#include "user_interface.h"
#include "user_devicefind.h"
#include "user_webserver.h"
#include "gpio16.h"
#include "gpio.h"
#include "c_types.h"
#if ESP_PLATFORM
#include "user_esp_platform.h"
#endif
/** 定时器结构体 */
static os_timer_t os_timer;
/** LED操作命令 */
void Led_Cmd( bool status )
{
if ( status == true )
{
gpio16_output_set( 0 );
}
else
{
gpio16_output_set( 1 );
}
}
/** LED任务运行程序 */
void Led_Task_Run( void )
{
static bool status = false;
if ( status == true )
{
status = false;
}
else
{
status = true;
}
Led_Cmd( status );
}
/** LED模块初始化程序 */
void Led_Init( void )
{
gpio16_output_conf();
Led_Cmd( false );
/** 关闭该定时器 */
os_timer_disarm( &os_timer );
/** 配置该定时器回调函数 */
os_timer_setfn( &os_timer, (ETSTimerFunc *) ( Led_Task_Run ), NULL );
/** 启动该定时器 */
os_timer_arm( &os_timer, 500, true );
}
/** 初始化程序 */
void user_init(void)
{
Led_Init();
}
user_init(相当于main)
|