⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bq2050h_params.c

📁 在sharp 404开发板的串口测试代码
💻 C
字号:

/**********************************************************************
 * bq2050H Command and Status Register structure
 *********************************************************************/

typedef PACKED struct
{
   volatile UNS_8 flgs1;      /* Primary Status Flags register */
   volatile UNS_8 temp_gg;    /* Temperature register */
   volatile UNS_8 nach;       /* Nominal Capacity High Byte */
   volatile UNS_8 batid;      /* Battery ID register */
   volatile UNS_8 lmd;        /* Last Measured Discharge register */
   volatile UNS_8 flgs2;      /* Secondary Status Flags register */
   volatile UNS_8 ppd;        /* Program Pin Pull-Down register */
   volatile UNS_8 ppu;        /* Program Pin Pull-Up register */
   volatile UNS_8 cpi;        /* Capacity Inaccurate count register */
   volatile UNS_8 rsvd_1;     /* 0x0a */
   volatile UNS_8 vsb;        /* Battery Voltage register */
   volatile UNS_8 vts;        /* End-of-dschrg threshld select reg */
   volatile UNS_8 cact;       /* Temp & Dschrg Rate comp avail cap */
   volatile UNS_8 cacd;       /* Dschrg Rate comp avail capacity */
   volatile UNS_8 saeh;       /* Scaled avail energy high byte reg */
   volatile UNS_8 sael;       /* Scaled avail energy low byte reg */
   volatile UNS_8 rcac;       /* Relative CAC */
   volatile UNS_8 vsrh;       /* Current Scale High byte */
   volatile UNS_8 vsrl;       /* Current Scale Low byte */
   volatile UNS_8 rsvd_2;     /* 0x14 */
   volatile UNS_8 nmcv;       /* Maximum Cell Voltage */
   volatile UNS_8 rsvd_3;     /* 0x16 */
   volatile UNS_8 nacl;       /* Nominal capacity low byte register */
   volatile UNS_8 dcr;        /* Discharge register */
   volatile UNS_8 rsvd_4[5];  /* 0x19 ~ 0x1d */
   volatile UNS_8 ppfc;       /* Program pin data */
   volatile UNS_8 rsvd_5[25]; /* 0x1f ~ 0x37 */
   volatile UNS_8 intss;      /* Vos interrupt */
   volatile UNS_8 rst;        /* Reset register */
   volatile UNS_8 rsvd_6[5];  /* 0x3a ~ 0x3e */
   volatile UNS_8 hexff;      /* Check register */
}BQ2050HREGS_t;

/**********************************************************************
 * bq2050H Command and Status Register bit field definitions
 * *******************************************************************/

/**********************************************************************
 * bq2050H Flags 1 Register
 *********************************************************************/
#define EDVF   _BIT(0)        /* Final End-of-Discharge warning */
#define EDVL   _BIT(1)        /* First End-of-Discharge warning */
#define VDQ    _BIT(3)        /* Valid Discharge */
#define CAPI   _BIT(4)        /* Capacity Inaccurate */
#define PSTAT  _BIT(5)        /* Protector Status */
#define BRP    _BIT(6)        /* Battery Replaced */
#define CHGS   _BIT(7)        /* Charge Status */

/**********************************************************************
 * bq2050H Nominal Available Capacity Register
 *********************************************************************/
#define NAC       (_SBF(BQ2050HREGS->nach, 8) || (BQ2050HREGS->nacl))

/**********************************************************************
 * bq2050H Flags 2 Register
 *********************************************************************/
#define OVLD   _BIT(0)        /* Overload flag */
#define VCHG   _BIT(2)        /* Valid Charge flag */
#define ENINT  _BIT(3)        /* Enable Interupt flag */
#define DRATE  _SBF(4, 3)     /* Discharge Rate */

/**********************************************************************
 * bq2050H Tempurature and Gas Gauge Register
 *********************************************************************/
#define GGE    _BITMASK(4)          /* Gas Gauge Bits */
#define TEMP   _SBF(4, _BITMASK(4)  /* Temperature Bits */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -