当前位置: 首页 > news >正文

网站设计制作需要多少钱旅游电子商务网站建设情况

网站设计制作需要多少钱,旅游电子商务网站建设情况,做像58同城样的网站,宜昌住房和城乡建设厅网站00. 目录 文章目录 00. 目录01. 概述02. 定时器相关API2.1 hi_timer_create2.2 hi_timer_start2.3 hi_timer_stop2.4 hi_timer_delete 03. 硬件设计04. 软件设计05. 实验现象06. 附录 01. 概述 定时器,顾名思义就是用来计时的,我们常常会设定计时或闹钟…

00. 目录

文章目录

    • 00. 目录
    • 01. 概述
    • 02. 定时器相关API
      • 2.1 hi_timer_create
      • 2.2 hi_timer_start
      • 2.3 hi_timer_stop
      • 2.4 hi_timer_delete
    • 03. 硬件设计
    • 04. 软件设计
    • 05. 实验现象
    • 06. 附录

01. 概述

定时器,顾名思义就是用来计时的,我们常常会设定计时或闹钟,然后时间到了就告诉我们要做什么。Hi3861 也是这样,通过定时器可

以完成各种预设好的任务。定时器到达指定时间后也会产生中断,然后在回调函数内执行所需功能,这个和外部中断类似。

02. 定时器相关API

2.1 hi_timer_create

/**
* @ingroup  iot_systimer
* @brief  Creates the system timer.CNcomment:获取定时器句柄。CNend
*
* @par 描述:
*           Creates the system timer.CNcomment:获取高精定时器句柄。CNend
*
* @attention None
* @param  timer_handle [OUT] type #hi_u32*,handle.CNcomment:获取到的句柄。CNend
*
* @retval #0           Success.
* @retval #Other       Failure. For details, see hi_errno.h.
*
* @par 依赖:
*          @li hi_timer.h:Describes the timer APIs.CNcomment:文件用于描述定时器相关接口。CNend
* @see  hi_timer_delete。
*/
hi_u32 hi_timer_create(hi_u32 *timer_handle);
功能:创建系统定时器
参数:timer_handle:获取创建好的定时器句柄
返回值:0 成功,1 失败;

2.2 hi_timer_start

/**
* @ingroup  iot_systimer
* @brief  Starts the system timer.CNcomment:启动系统定时器。CNend
*
* @par 描述:
*            This API is used in the following scenarios:CNcomment:本API接口使用分为以下几个场景:CNend
*            @li If no timer is created, create and start a timer.
CNcomment:如果未启动定时器,则直接启动。CNend
*            @li If the timer expires and is called again, start the timer directly.
CNcomment:如果该定时器到期后调用,则直接启动定时器。CNend
*            @li If the timer does not expire, stop and restart the timer.
CNcomment:如果定时器没有到期,则停止该定时器,重新启动定时器。CNend
*
* @attention This timer callback function is executed in the interrupt context. Therefore, the callback function should
*            be as simple as possible and the functions such as sleep and wait semaphores that trigger scheduling
*            cannot be used.CNcomment:本定时器回调函数执行于中断上下文,回调函数尽量简单,不能使用睡眠、
等待信号量等引起调度的函数。CNend
*
* @param  timer_handle  [IN]  type #hi_u32,handle.CNcomment:句柄。CNend
* @param  type          [IN]   type #hi_timer_type,timer type.CNcomment:定时器类型。CNend
* @param  expire        [IN]   type #hi_u32,timeout period of the timer (unit: ms). If this parameter is set to 0,
*                       the default value is 10 ms.CNcomment:定时器超时时间(单位:ms)。配置为0时,默认为10ms。CNend
* @param  timer_func    [IN]   type #timer_proc_func,timer callback function.CNcomment:定时器回调函数。CNend
* @param  data          [IN]   type #hi_u32,callback input parameter.CNcomment:回调函数传参。CNend
*
* @retval #0           Success.
* @retval #Other       Failure. For details, see hi_errno.h.
*
* @par 依赖:
*          @li hi_timer.h:Describes the timer APIs.CNcomment:文件用于描述定时器相关接口。CNend
* @see hi_timer_stop
*/
hi_u32 hi_timer_start(hi_u32 timer_handle, hi_timer_type type, hi_u32 expire,hi_timer_callback_f timer_func, hi_u32 data);
功能:启动系统定时器
参数:timer_handle:定时器句柄Type:用于设置所创建的定时器类型expire:定时时间,单位 ms。如果参数设置值为 0,则默认为 10ms。timer_func:定时器定时时间到达,回调函数。data:回调函数参数。不传递参数则为 NULL。
返回值:0 成功,1 失败;        

2.3 hi_timer_stop

/**
* @ingroup  iot_systimer
* @brief  Stops the system timer.CNcomment:停止系统定时器。CNend
*
* @par 描述:
*          Stops the system timer.CNcomment:停止系统定时器。CNend
*
* @attention This API only stops the timer and does not delete the timer.CNcomment:本接口仅停止定时器,
并不删除该定时器。CNend
* @param  timer_handle [IN] type #hi_u32,handle.CNcomment:句柄。CNend
*
* @retval #0           Success.
* @retval #Other       Failure. For details, see hi_errno.h.
*
* @par 依赖:
*          @li hi_timer.h:Describes the timer APIs.CNcomment:文件用于描述定时器相关接口。CNend
* @see hi_timer_start | hi_timer_delete
*/
hi_u32 hi_timer_stop(hi_u32 timer_handle)
功能:停止系统定时器
参数:timer_handle:定时器句柄
返回值:0 成功 1 失败     

2.4 hi_timer_delete

/**
* @ingroup  iot_systimer
* @brief  Deletes the timer.CNcomment:删除定时器。CNend
*
* @par 描述:
*           Deletes the timer.CNcomment:删除定时器。CNend
*
* @attention
*            @li If the timer does not expire, stop the timer before deleting it.
CNcomment:如果定时器未到期,则先停止该定时器再删除。CNend
*
* @param  timer_handle [IN] type #hi_u32,handle.CNcomment:句柄。CNend
*
* @retval #0           Success.
* @retval #Other       Failure. For details, see hi_errno.h.
*
* @par 依赖:
*          @li hi_timer.h:Describes the timer APIs.CNcomment:文件用于描述定时器相关接口。CNend
* @see hi_timer_start | hi_timer_stop
*/
hi_u32 hi_timer_delete(hi_u32 timer_handle)
功能:删除系统定时器。如果定时器未到期,则先停止该定时器再删除
参数:timer_handle:定时器句柄
返回值:0 成功,1 失败

03. 硬件设计

在这里插入图片描述

从网络标号可知,LED 与芯片的 IO2 管脚连接,当该引脚输出高电平时,LED点亮,输出低电平时,LED 熄灭。

04. 软件设计

bsp_time.h

#ifndef BSP_TIME_H
#define BSP_TIME_H#include "cmsis_os2.h"
#include "hi_io.h"
#include "hi_gpio.h"//函数声明
void time_init(uint16_t times);
void time_onoff(uint8_t sta);#endif

bsp_time.c

#include "bsp_time.h"
#include <unistd.h>
#include "bsp_led.h"
#include "hi_timer.h"hi_u32 timer_handle;
uint16_t g_times=0;//定时器回调函数
void time_isr_fun(void)
{static uint8_t i=0;i=!i; LED(i);
}//定时器初始化
//times:定时时间,ms
void time_init(uint16_t times)
{hi_u32 ret;g_times=times; ret = hi_timer_create(&timer_handle);if(ret!=HI_ERR_SUCCESS){printf("Timer_Create failed\r\n");}hi_timer_start(timer_handle,HI_TIMER_TYPE_PERIOD,times,(hi_timer_callback_f)time_isr_fun,NULL);
}//定时器开关
void time_onoff(uint8_t sta)
{if(sta==0)hi_timer_stop(timer_handle);else hi_timer_start(timer_handle,HI_TIMER_TYPE_PERIOD,g_times,(hi_timer_callback_f)time_isr_fun,NULL);
}

template.c

/******************************************************************************************************* @file        template.c***************************************************************************************************** 实验现象:间隔1S,LED指示灯亮灭******************************************************************************************************/#include <stdio.h>
#include <unistd.h>#include "ohos_init.h"
#include "cmsis_os2.h"#include "bsp_time.h"
#include "bsp_led.h"//控制任务
osThreadId_t TIME_Task_ID; //任务IDvoid TIME_Task(void)
{led_init();//LED初始化time_init(500);//定时器初始化,定时时间500mswhile (1) {usleep(10*1000);}
}
//任务创建
void time_task_create(void)
{osThreadAttr_t taskOptions;taskOptions.name = "timeTask";       // 任务的名字taskOptions.attr_bits = 0;               // 属性位taskOptions.cb_mem = NULL;               // 堆空间地址taskOptions.cb_size = 0;                 // 堆空间大小taskOptions.stack_mem = NULL;            // 栈空间地址taskOptions.stack_size = 1024;           // 栈空间大小 单位:字节taskOptions.priority = osPriorityNormal; // 任务的优先级TIME_Task_ID = osThreadNew((osThreadFunc_t)TIME_Task, NULL, &taskOptions); // 创建任务if (TIME_Task_ID != NULL){printf("ID = %d, Task Create OK!\n", TIME_Task_ID);}
}/*** @description: 初始化并创建任务* @param {*}* @return {*}*/
static void template_demo(void)
{printf("-Hi3861开发板--定时器中断实验\r\n");time_task_create();//任务创建
}
SYS_RUN(template_demo);

05. 实验现象

实验现象: LED 周期性每秒闪烁 1 次。

06. 附录

http://www.dtcms.com/a/488785.html

相关文章:

  • discuz做商城网站wordpress 用户介绍
  • 企业网站的设计风格动态素材网站
  • 福州网站建设企业哪家好?网页制作模板 html
  • 做网站要费用多少广东品牌网站建设公司
  • 广东住房和城乡建设局网站首页wordpress扩展插件
  • 上海免费网站建设模板网站如何添加百度统计
  • 传奇网站模板怎么做的吗合肥房地产最新消息
  • 高端网站开发wordpress适配熊掌号
  • 用asp做网站遇到的问题如何把网站主关键词做到百度首页
  • 有域名就可以做网站吗苏州网络公司哪家最好
  • 小软件下载网站繁体网站怎么做
  • 专业企业网站开发联系电话网站seo计划
  • 网站开发新手什么软件好沈阳做网站有名公司有哪些
  • 国外免费logo网站网页升级防问广大
  • 毕设做网站答辩稿网站弹广告是什么样做的
  • 网站更换空间改版收录电子商务公司企业简介
  • 注册公司制作网站灌南县规划局网站理想家园规划建设
  • 太原网站优化多少钱深圳设计公司画册设计
  • 建设五证在那个网站可以查宁波网站建设rswl
  • asp做学生信息网站公司 宜宾网站建设
  • 网站建设 工作建议上海网站排名seo公司
  • 软件开发公司需要什么硬件设备大型seo公司
  • 域名查询ip福州seo关键词排名
  • 多周期框架中不同时间粒度的检验指标可比性
  • 收录网站源码开网店需要什么条件
  • 济南设计网站有没有专门做老年婚介的网站
  • 代做单片机毕业设计网站自建网站营销是什么
  • 吉林城市建设学校网站北京创意网站设计
  • 有口碑的宜昌网站建设什么网站都有漏洞
  • 漂亮购物网站欣赏自建 wordpress