bsp_Digit.h D:/gitt/MicrochipFor32/bsp_Device/bsp_Digit.h 浏览该文件的文档.00001 /*---------------------------------------------------------------------------------------------------- 00002 # 00003 # Copyright (c) 2022 Yuankang Liang(XerolySkinner) 00004 # 00005 # 本软件按原样提供,无任何明示或暗示 00006 # 在任何情况下,作者都不承担任何损害赔偿责任 00007 # 00008 # 使用的许可声明: 00009 # 1. 不得歪曲本软件的来源,你不能声称你编写了原始软件. 00010 # 2. 免费授予以任何目的,前提是版权声明出现在所有副本中. 00011 # 并且版权声明和许可声明同时出现. 00012 # 3. 你有使用,复制,修改,分发,和销售本软件的许可. 00013 # 4. 如果你在产品中使用,产品文档中的声明是赞赏的但不是必须的. 00014 # 5. 本通知不得从任何来源删除或更改. 00015 # 00016 # Yuankang Liang(XerolySkinner) 00017 # E-mail:zabbcccbbaz@163.com 00018 # QQ:2715099320 00019 # Mobile Phone:13005636215 00020 # 00021 # All rights reserved. 00022 */ 00023 00034 //---------------------------------------------------------------------------------------------------- 00035 // 头文件 00036 #pragma once 00037 #ifdef __cplusplus 00038 #include "varint.h" 00039 #include "gpio.h" 00041 //---------------------------------------------------------------------------------------------------- 00042 // 枚举 00046 enum { 00047 anode, 00048 cathode 00049 }; 00051 //---------------------------------------------------------------------------------------------------- 00052 // 段码表 00056 static const u8 digit_ca[] = { 00057 0xc0,0xf9,0xa4,0xb0, 00058 0x99,0x92,0x82,0xf8, 00059 0x80,0x90,0x88,0x83, 00060 0xc6,0xa1,0x86,0x8e}; 00062 //---------------------------------------------------------------------------------------------------- 00063 // 类目 00067 class bsp_Digit{ 00068 public: 00069 bsp_Digit( 00070 GPIO_TypeDef* GPIOx_MOSIO, uint16_t GPIO_Pin_MOSIO, 00071 GPIO_TypeDef* GPIOx_S_CLK, uint16_t GPIO_Pin_S_CLK, 00072 GPIO_TypeDef* GPIOx_R_CLK, uint16_t GPIO_Pin_R_CLK, 00073 bool Polarity 00074 ); 00075 public: 00076 void DatCom(u8 SendVal,u8 cha); 00077 void num(u16 num); 00078 u16 division; 00079 void dop(u8 cha); 00080 void numdop(u16 num,u8 cha); 00081 protected: 00082 void dat(u8 SendVal); 00083 void com(void); 00084 private: 00085 bool Polarity; 00086 GPIO_TypeDef* GPIOx_MOSIO; 00087 uint16_t GPIO_Pin_MOSIO; 00088 GPIO_TypeDef* GPIOx_S_CLK; 00089 uint16_t GPIO_Pin_S_CLK; 00090 GPIO_TypeDef* GPIOx_R_CLK; 00091 uint16_t GPIO_Pin_R_CLK; 00092 }; 00094 #endif