資源簡介
自己整理的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抽獎程序源代碼奉獻給大家
評論
共有 條評論