rgbled.c

来自「 PSoC(可编程片上系统)是Cypress半导体公司生产的包含有8位微处理器核」· C语言 代码 · 共 55 行

C
55
字号
//*****************************************************************************
//*****************************************************************************
//  FILENAME:  `@LIB_NAME`_RGBLED.c
//  Version: 1.1, Updated on 2007/03/08 at 09:37:41 
//  Application: PSoC Express 2.0
//
//  DESCRIPTION:  
//     This Driver calls DIO_SetValue to set IOs.
//
//-----------------------------------------------------------------------------
//      Copyright (c) Cypress MicroSystems 2007. All Rights Reserved.
//*****************************************************************************
//*****************************************************************************

#include "m8c.h"
#include "`@LIB_NAME`_RGBLED.h"
#include "cmx.h"

// *********************** RGBLED_Instantiate() *******************************
//
//  Description:
//    This function doesn't do anything at this time, but is placed here
//    for forward compatibility.
//
//

void `@LIB_NAME`_RGBLED_Instantiate(const CMX_RGBLED_ParameterBlock * thisBLK)
{
   // Blank function  
}

// *********************** RGBLED_SetValue() *******************************
//
//  Description:
//    This function sets the individual compenent drivers  
//
//    input:
//       thisBLK  => Pointer to ParameterBlock for this instance.
//      local_state => BYTE input variable that determine state of this driver
//
//   Return Value:
//      None.
//   THEORY of OPERATION or PROCEDURE: 
//	Driver output states include: OFF, RED, GREEN, BLUE. 

void `@LIB_NAME`_RGBLED_SetValue(const CMX_RGBLED_ParameterBlock * thisBLK, BYTE bState)
{
	if(bState >= 3) bState = 4;
	bState ^= thisBLK->bDrivePolarity;
	
	// Set appropriate subcontainer driver states
	`@LIB_NAME`_DIO_SetValue(thisBLK->DriverPin_RED, bState & 1);
	`@LIB_NAME`_DIO_SetValue(thisBLK->DriverPin_GREEN, (bState >> 1) & 1);
	`@LIB_NAME`_DIO_SetValue(thisBLK->DriverPin_BLUE, (bState >> 2) & 1);
}

⌨️ 快捷键说明

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