📄 drvfmradiowrite.c
字号:
//===========================================================================// The information contained herein is the exclusive property of// Sunplus Technology Co。 And shall not be distributed, reproduced,// or disclosed in whole in part without prior written permission// (C) COPYRIGHT 2001 SUNPLUS TECHNOLOGY CO// ALL RIGHTS RESERVED// The entire notice above must be reproduced on all authorized copies//===========================================================================// Filename : DrvFMRadioWrite.c// Author : guoquan// Tel : // Date : 2005/11/21// Description: 将准备好的5字节数据写入到5767中// Reference ://// Version history: //---------------------------------------------------------------------------// Version YYYY-MM-DD-INDEX Modified By Description//---------------------------------------------------------------------------// 1.0.0 2005-11-21 guoquan 初始版本//===========================================================================//===========================================================================//include file list//===========================================================================#include ".\system\TypeDefine.h"#include ".\system\SysAssert.h"#include ".\Driver\FMRadio\DrvFMRadioPrivate.h"#include ".\Driver\FMRadio\DrvFMRadio.h"#ifdef __FMRadio_5767__//===========================================================================//Function : FMRadioWriteSTR//Description: 将准备好的5字节数据写入到5767中//Syntax : void DrvFMRadioWrite(void)//Parameters : NONE//Return : NONE//Notes : NONE//===========================================================================void DrvFMRadioWrite(void){ UCHAR ucCount; //发送起始位 FMRadioI2CSendStart(); //发送5字节数据 if(TRUE == FMRadioI2CSendByte(0xC0)) { for (ucCount = 0; ucCount < 5; ucCount++) { if (FALSE == FMRadioI2CSendByte(g_ucFMRadioWriteData[ucCount])) { break; } } } //发送停止位 FMRadioI2CSendStop(); FMRadioI2CDelay(C_FMRadioDelayNum); }#endif#ifdef __FMRadio_NS953__code UCHAR g_ucFMRadioSetData[14] = \ {0x12, 0x00, 0xC0, 0x46, 0xC3, 0x61, 0x88, 0x5D, 0x0F, 0x8C, 0x28, 0x8C, 0x04, 0x00 };//===========================================================================//Function : FMRadioWriteSTR//Description: 将指定地址的数据写入到953中//Syntax : void DrvFMRadioWrite(UCHAR ucAddr, UCHAR ucData)//Parameters : UCHAR ucAddr 地址// UCHAR ucData 数据//Return : NONE//Notes : NONE//===========================================================================void DrvFMRadioWrite(UCHAR ucAddr, UCHAR ucData){ //发送起始位 FMRadioI2CSendStart(); FMRadioI2CSendByte(0xc8); FMRadioI2CSendByte(ucAddr); FMRadioI2CSendByte(ucData); //发送停止位 FMRadioI2CSendStop(); FMRadioI2CDelay(C_FMRadioDelayNum); }//===========================================================================//Function : FMRadioWriteSTR//Description: 将指定地址的数据写入到953中//Syntax : void DrvFMRadioWrite(UCHAR ucAddr, UCHAR ucData)//Parameters : UCHAR ucAddr 地址// UCHAR ucData 数据//Return : NONE//Notes : NONE//===========================================================================void DrvFMRadioWriteAllData(void){ UCHAR ucCount; //发送起始位 FMRadioI2CSendStart(); FMRadioI2CSendByte(0xc8); FMRadioI2CSendByte(0x00); for(ucCount = 0; ucCount < 14; ucCount++) { FMRadioI2CSendByte(g_ucFMRadioSetData[ucCount]); } //发送停止位 FMRadioI2CSendStop(); FMRadioI2CDelay(C_FMRadioDelayNum);} #endif#ifdef _LV2400_//===========================================================================//Function : IoWriteI2CBus0//Description: Write 16 bit data to LV24200-device//Syntax : unsigned char IoWriteI2CBus0(unsigned char byLow, unsigned char byHigh)//Parameters : unsigned char byLow 低位数据// unsigned char byHigh 高位数据//Return : 0 成功// Others 错误代码//Notes : NONE//===========================================================================unsigned char DrvFMRadioWrite(unsigned char ucData, unsigned char ucAddr){ unsigned char ucResult; //假定发生没有应答错误 ucResult = LVLS_NO_DEV_ACK_ERR; //发送其始位 FMRadioI2CSendStart(); //开始发送,首先发送控制命令 if(TRUE == FMRadioI2CSendByte(LV24200_I2C_ADDR_W)) { //发送地址 if(TRUE == FMRadioI2CSendByte(ucAddr)) { //发送数据 if(TRUE == FMRadioI2CSendByte(ucData)) { //发送成功 ucResult = LVLS_NO_ERROR; } else { sysprintf("fm ack err1\n"); } } } else { sysprintf("fm ack err0\n"); } //发送停止位 FMRadioI2CSendStop(); FMRadioI2CDelay(C_FMRadioDelayNum); return(ucResult);}#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -