📄 feedis_spi._h
字号:
#ifndef feedisspi_h
#define feedisspi_h
/***********************************************************************
Comments:
Note: Since this is a master interface, SDO is to be connected to the
slaves SDO (output), and SDI to the slaves SDI (input).
***********************************************************************/
/***********************************************************************
Port and Pin configuration
***********************************************************************/
#define SPIPORT PORTB
//#define SPIPIN PINB
#define SPIDDR DDRB
#define SCLK 1
#define MOSI 2
#define SS 0
//POWERUP = 0X4 <<(3)
#define POWERUP 0X20
//PLAYADD = 0XC1 << (3+8)
#define PLAYADD 0XE000
//POWERDOWN = 0X2 << (3)
#define POWERDOWN 0x10
#define PLAYCURRENT 0xF0
/***********************************************************************
Macros
***********************************************************************/
#define SET_SCLK() SETBIT(SPIPORT, SCLK)
#define CLEAR_SCLK() CLEARBIT(SPIPORT, SCLK)
//#define SET_SCLK_TO_OUTPUT() SETBIT(SPIDDR, SCLK)
#define SET_MOSI() SETBIT(SPIPORT, MOSI)
#define CLEAR_MOSI() CLEARBIT(SPIPORT, MOSI)
//#define SET_MOSI_TO_OUTPUT() SETBIT(SPIDDR, MOSI)
#define SET_SS() SETBIT(SPIPORT,SS)
//#define SET_SS_TO_OUTPUT() SETBIT(SPIDDR, SS)
#define CLEAR_SS() CLEARBIT(SPIPORT, SS)
#define CHUANGDAO 6
#define YUEPIAO 1
#define MIANFEI 0
#define JUNJIN 2
#define GONGWU 4
#define THANKYOU 19
/*
语音内容 地址 16进制地址
请交5元 000000000000; 0X0
请交10元 000000000111; 0X7
请交15元 000000001110; 0XE
请交20元 000000010101; 0X15
请交25元 000000011100; 0X1C
请交30元 000000100100; 0X24
请交35元 000000101011; 0X2B
请交40元 000000110011; 0X33
请交45元 000000111011; 0X3B
请交50元 000001000011; 0X43
请交55元 000001001011; 0X4B
请交60元 000001010100; 0X54
请交65元 000001011100; 0X5C
请交70元 000001100100; 0X64
请交75元 000001101100; 0X6C
请交80元 000001110100; 0X74
请交85元 000001111100; 0X7C
请交90元 000010000100; 0X84
请交95元 000010001100; 0X8C
谢谢合作 000010010100; 0X94
请交 000010011001; 0X99
A型车 000010011101; 0X9D
B型车 000010100010; 0XA2
C型车 000010100111; 0XA7
D型车 000010101100 0XAC
E型车 000010110001; 0XB1
1型车 000010110110; 0XB6
2型车 000010111011; 0XBB
3型车 000011000000; 0XC0
4型车 000011000101; 0XC5
5型车 000011001010; 0XCA
6型车 000011001111; 0XCF
7型车 000011010100; 0XD4
8型车 000011011001; 0XD9
9型车 000011011110; 0XDE
你好,1型车 000011100011; 0XE3
你好,2型车 000011101011 0XEB
你好,3型车 000011110011; 0XF3
你好,4型车 000011111011; 0XFB
你好,5型车 000100000011; 0X103
你好,6型车 000100001011; 0X10B
你好,7型车 000100010011; 0X113
你好,8型车 000100011100; 0X11C
你好,9型车 000100100101; 0X125
元 000100101101;
一元 000100110000;
两元 000100110100;
三元 000100111000;
四元 000100111100;
五元 000101000000
六元 000101000100;
七元 000101001000;
八元 000101001100;
九元 000101010000;
0 000101010100;
1 000101010110;
2 000101011000;
3 000101011010;
4 000101011101;
5 000101100000;
6 000101100011
7 000101100101
8 000101101000
9 000101101010;
10 000101101101;
一十 000101110000;
二十 000101110100;
三十 000101111000;
四十 000101111100;
五十 000110000000;
六十 000110000100;
七十 000110001000;
八十 000110001100;
九十 000110010000;
一百 000110010100;
二百 000110011000;
三百 000110011100;
四百 000110100000;
五百 000110100100;
六百 000110101000;
七百 000110101100;
八百 000110110000;
九百 000110110100;
一千 000110111000;
两千 000110111100;
三千 000111000000;
四千 000111000100;
五千 000111001000;
六千 000111001100;
七千 000111010000;
八千 000111010100;
九千 000111011000;
两元 000111011100;
您好 000111100000;
免费车 000111100100;
月票车 000111101001;
军警车 000111101110;
闯口车 000111110011;
公务车 000111111000;
紧急车 000111111100;
闯道车 001000000001;
余额 001000000110;
*/
/***********************************************************************
Common prototypes
------------------------------------------------------------------------
Init the hardware for SPI communication
***********************************************************************/
void spi_init(void);
/***********************************************************************
Write one data byte to the SPI bus
LSB data transimite sequence
***********************************************************************/
void spi_sendbyte(unsigned char data);
/***********************************************************************
Write one data int to the SPI bus
LSB data transimite sequence
***********************************************************************/
void spi_sendint(unsigned int data);
/***********************************************************************
Read one word from the SPI bus (16-bit MSB first)
***********************************************************************/
//WORD read_spi_long(void);
/***********************************************************************
Prototypes for reading the Analog Devices AD7705 AD-Converter
------------------------------------------------------------------------
Init the Analog Devices AD7705 AD-Converter
Use one of the following gain settings:
0x00=1, 0x08=2, 0x10=4, 0x18=8, 0x20=16, 0x28=32, 0x30=64, 0x38=128
***********************************************************************/
//void init_ad7705(BYTE gain);
/***********************************************************************
Read the specified Analog Devices AD7705 AD-Converter channel
The channel must be specified as 1 or 2
***********************************************************************/
//WORD get_ad7705_value(BYTE channel);
/*ISDplay()
function describe: play a voice record from an address.
parameters:
uchar num: the ID of the voice will be played.
//uint CMD: the opcode
return value:
0: It's done
-1: there is something wrong with this routine.
*/
unsigned char ISDplay(unsigned char num);
void ISDpowerdown(void);
unsigned char ISDmonitor(void);
/***********************************************************************
End of code listing
***********************************************************************/
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -