资源简介
自己整理的AT1846S的驱动,在我自己做的机器上跑的,能够实现频道切换。输出调整音量。收发切换。带有静音功能。用的是freetRTOS单片机stm32f103
代码片段和文件信息
/*******************************************************************************
Copyright:
File_name: at1846s.c
Version: 0.0
Revised: $Date:2017-1-16 ; $
Description: the driver of at1846.
Notes: This version targets the stm8
Editor: Mr.kon
*******************************************************************************/
/*==============================================================================
@ Include files
*/
#include “at1846s.h“
#include “stdio.h“
/*==============================================================================
@ Global variable
*/
/*==============================================================================
@ All functions as follow
*/
ATINFO AT1846s;
REG_30H reg30;
REG_03H reg03;
REG_04H reg04;
REG_08H reg08;
REG_09H reg09;
REG_0AH reg0a;
REG_15H reg15;
REG_24H reg24;
REG_29H reg29;
REG_2AH reg2a;
REG_32H reg32;
REG_3AH reg3a;
REG_41H reg41;
REG_44H reg44;
REG_49H reg49;
REG_4EH reg4e;
REG_58H reg58;
REG_64H reg64;
/*******************************************************************************
Function: rda_spi_write_Bytes
Description:
SPI write a bytes HSB module
Input: None
Output: None
Return: None
Editor: Mr.kon
Others: 2017/1/16
*******************************************************************************/
static void rda_spi_write_Bytes( unsigned char wdata)
{
//set the IO output
SET_SDIO_OUT
for(unsigned char i = 8; i !=0 ; i--)
{
if (wdata & 0x80)
{
RDA1846_O(1);
}
else
{
RDA1846_O(0);
}
NOP
RDA1846CLK(1);
NOP
RDA1846CLK(0);
wdata <<= 1;
}
}
/*******************************************************************************
Function: rda_spi_read_Bytes
Description:
SPI read a bytes HSB module
Input: None
Output: None
Return: the data of readed
Editor: Mr.kon
Others: 2017/1/16
*******************************************************************************/
static unsigned char rda_spi_read_Bytes()
{
unsigned char rdaRead = 0;
//set the IO input
//SDIO
SET_SDIO_IN
for(unsigned char i= 8;i!=0;i--)
{
rdaRead =rdaRead<< 1;
RDA1846CLK(1);
NOP
if(RDA1846_I)
{
rdaRead|= 0x1;
}
RDA1846CLK(0);
NOP
}
return rdaRead;
}
/*******************************************************************************
Function: Readrda1846
Description:
write : rdarom |080 and the read 16bitsvalue value.
Input: rdarom : the address of register
Output: None
Return: 16bits register value
Editor: Mr.kon
Others: 2017/1/16
*******************************************************************************/
static unsigned int Readrda1846(un
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 13213 2018-12-01 19:20 at1846s.c
文件 10981 2018-11-26 20:49 at1846s.h
- 上一篇:雪人兄弟游戏素材图片
- 下一篇:PB抽奖程序源代码奉献给大家
评论
共有 条评论