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

📄 rgbled.c

📁  PSoC(可编程片上系统)是Cypress半导体公司生产的包含有8位微处理器核和数字与模拟混合的信号阵列芯片
💻 C
字号:
//*****************************************************************************
//*****************************************************************************
//  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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -