init:初始框架

This commit is contained in:
SkyLi
2026-06-06 20:50:54 +08:00
commit b5be64b642
685 changed files with 398844 additions and 0 deletions
+136
View File
@@ -0,0 +1,136 @@
/*********************************************************************************************************************
* MSPM0G3507 Opensource Library 即(MSPM0G3507 开源库)是一个基于官方 SDK 接口的第三方开源库
* Copyright (c) 2022 SEEKFREE 逐飞科技
*
* 本文件是 MSPM0G3507 开源库的一部分
*
* MSPM0G3507 开源库 是免费软件
* 您可以根据自由软件基金会发布的 GPL(GNU General Public License,即 GNU通用公共许可证)的条款
* 即 GPL 的第3版(即 GPL3.0)或(您选择的)任何后来的版本,重新发布和/或修改它
*
* 本开源库的发布是希望它能发挥作用,但并未对其作任何的保证
* 甚至没有隐含的适销性或适合特定用途的保证
* 更多细节请参见 GPL
*
* 您应该在收到本开源库的同时收到一份 GPL 的副本
* 如果没有,请参阅<https://www.gnu.org/licenses/>
*
* 额外注明:
* 本开源库使用 GPL3.0 开源许可证协议 以上许可申明为译文版本
* 许可申明英文版在 libraries/doc 文件夹下的 GPL3_permission_statement.txt 文件中
* 许可证副本在 libraries 文件夹下 即该文件夹下的 LICENSE 文件
* 欢迎各位使用并传播本程序 但修改内容时必须保留逐飞科技的版权声明(即本声明)
*
* 文件名称 zf_driver_timer
* 公司名称 成都逐飞科技有限公司
* 版本信息 查看 libraries/doc 文件夹内 version 文件 版本说明
* 开发环境 MDK 5.37
* 适用平台 MSPM0G3507
* 店铺链接 https://seekfree.taobao.com/
*
* 修改记录
* 日期 作者 备注
* 2025-06-1 SeekFree first version
********************************************************************************************************************/
#ifndef _zf_driver_timer_h_
#define _zf_driver_timer_h_
#include "ti_msp_dl_config.h"
#include "zf_common_typedef.h"
typedef enum
{
TIM_A0 ,
TIM_A1 ,
TIM_G0 ,
TIM_G6 ,
TIM_G7 ,
TIM_G8 ,
TIM_G12 ,
}timer_index_enum;
typedef enum
{
TIMER_SYSTEM_CLOCK, // 系统频率计时 最大 0xFFFF
TIMER_US, // 微秒计时 最大 0xFFFF
TIMER_MS, // 毫秒计时 最大 0xFFFF/2
}timer_mode_enum;
typedef enum
{
TIMER_FUNCTION_INIT = 0, // 功能未初始化
TIMER_FUNCTION_TIMER, // 用作 TIMER 计时
TIMER_FUNCTION_PIT, // 用作 PIT
TIMER_FUNCTION_PWM, // 用作 PWM
}timer_function_enum;
#define TIM_NUM ( 7 )
//-------------------------------------------------------------------------------------------------------------------
// 函数简介 TIMER 外设确认功能状态 库内部调用
// 参数说明 index TIMER 外设模块号
// 参数说明 mode 需要确的功能模块
// 返回参数 uint8 1-可以使用 0-不可以使用
// 使用示例 zf_assert(timer_funciton_check(index, mode);
// 备注信息
//-------------------------------------------------------------------------------------------------------------------
uint8 timer_funciton_check (timer_index_enum index,timer_function_enum mode);
//-------------------------------------------------------------------------------------------------------------------
// 函数简介 TIMER 时钟使能 库内部调用
// 参数说明 index TIMER 外设模块号
// 返回参数 void
// 使用示例 timer_clock_enable(index);
// 备注信息
//-------------------------------------------------------------------------------------------------------------------
void timer_clock_enable (timer_index_enum index);
//-------------------------------------------------------------------------------------------------------------------
// 函数简介 TIMER 开始计时
// 参数说明 index TIMER 外设模块号
// 返回参数 void
// 使用示例 timer_start(index);
// 备注信息
//-------------------------------------------------------------------------------------------------------------------
void timer_start (timer_index_enum index);
//-------------------------------------------------------------------------------------------------------------------
// 函数简介 TIMER 停止计时
// 参数说明 index TIMER 外设模块号
// 返回参数 void
// 使用示例 timer_stop(index);
// 备注信息
//-------------------------------------------------------------------------------------------------------------------
void timer_stop (timer_index_enum index);
//-------------------------------------------------------------------------------------------------------------------
// 函数简介 TIMER 获取计时器计数
// 参数说明 index TIMER 外设模块号
// 返回参数 uint16 计数值
// 使用示例 timer_get(index);
// 备注信息
//-------------------------------------------------------------------------------------------------------------------
uint16 timer_get (timer_index_enum index);
//-------------------------------------------------------------------------------------------------------------------
// 函数简介 TIMER 清除计时器计数
// 参数说明 index TIMER 外设模块号
// 返回参数 void
// 使用示例 timer_clear(index);
// 备注信息
//-------------------------------------------------------------------------------------------------------------------
void timer_clear (timer_index_enum index);
//-------------------------------------------------------------------------------------------------------------------
// 函数简介 TIMER 计时器初始化
// 参数说明 index TIMER 外设模块号
// 参数说明 mode 计时方式
// 返回参数 void
// 使用示例 timer_init(index, mode);
// 备注信息
//-------------------------------------------------------------------------------------------------------------------
void timer_init (timer_index_enum index, timer_mode_enum mode);
#endif