📄 lx1972l.c
字号:
//*****************************************************************************
//*****************************************************************************
// FILENAME: `@LIB_NAME`_LX1972L.c
// Version: 1.0, Updated on 2006/01/28 at 20:15:02
// Application: PSoC Express 2.0
//
// DESCRIPTION: This Driver calls the low level driver and returns the
// voltage that corresponds to a given channel.
//
//-----------------------------------------------------------------------------
// Copyright (c) Cypress MicroSystems 2006. All Rights Reserved.
//*****************************************************************************
//*****************************************************************************
#include "m8c.h"
#include "`@LIB_NAME`_LX1972L.h"
#include "cmx.h"
// Channel type header file
#include "CMX_MVOLTS_IN_CHAN.h"
// The format of the function should always be the same,
// no matter what low level driver is used.
//-----------------------------------------------------------------------------
// FUNCTION NAME: LX1972L_Instantiate(const `@LIB_NAME`_LX1972L_ParameterBlock * thisBLK)
//
// DESCRIPTION:
// This function doesn't do anything at this time, but is placed here
// for forward compatibility.
//
//-----------------------------------------------------------------------------
//
// ARGUMENTS:
// thisBLK => Pointer to ParameterBlock for this instance.
//
// RETURNS: None
//
// SIDE EFFECTS:
//
// THEORY of OPERATION or PROCEDURE:
//
//-----------------------------------------------------------------------------
void `@LIB_NAME`_LX1972L_Instantiate(const `@LIB_NAME`_LX1972L_ParameterBlock * thisBLK)
{
// Blank function
}
//-----------------------------------------------------------------------------
// FUNCTION NAME: LX1972L_GetValue(const `@LIB_NAME`_LX1972L_ParameterBlock * thisBLK)
//
// DESCRIPTION:
// This function returns a value between 0 and 100 based on the LX1972L
// postion.
//
//-----------------------------------------------------------------------------
//
// ARGUMENTS:
// thisBLK => Pointer to ParameterBlock for this instance.
//
// RETURNS:
// A Byte value between 0 and 100.
//
// SIDE EFFECTS:
//
// THEORY of OPERATION or PROCEDURE:
//
//-----------------------------------------------------------------------------
BYTE `@LIB_NAME`_LX1972L_GetValue(const `@LIB_NAME`_LX1972L_ParameterBlock * thisBLK)
{
long lCounts;
lCounts = (long)(iGetAinChanCounts(thisBLK->InPort))*101;
lCounts = lCounts / (1 << (CMX_ADC_CHAN_RESOLUTION));
if (lCounts > 100) lCounts = 100; // Make sure Max is 100
return((BYTE)lCounts); // Convert to BYTE and return
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -