[c1aed7]: vs1053.h Maximize Restore History

Download this file

vs1053.h    94 lines (80 with data), 3.1 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
#ifndef __VS1053_H__
#define __VS1053_H__
#define VS1053_GPIO_SPI GPIOC
#define VS1053_GPIO_CTRL GPIOC
#define VS1053_PIN_CS GPIO_PIN_4
#define VS1053_PIN_BSYNC GPIO_PIN_3
#define VS1053_PIN_DREQ GPIO_PIN_2
#define VS1053_PIN_RESET GPIO_PIN_1
#define VS1053_SPI_CS_OFF ( ( VS1053_GPIO_SPI->ODR ) |= VS1053_PIN_CS )
#define VS1053_SPI_CS_ON ( ( VS1053_GPIO_SPI->ODR ) &= (~VS1053_PIN_CS) )
#define VS1053_CHECK_DREQ ((VS1053_GPIO_CTRL->IDR) & VS1053_PIN_DREQ)
#define VS1053_CHECK_BSYNC ((VS1053_GPIO_CTRL->IDR) & VS1053_PIN_BSYNC)
#define VS1053_CHECK_XPORTRTS ((GPIOA->IDR) & GPIO_PIN_5)
#define VS1053_CMD_WRITE 0x02
#define VS1053_CMD_READ 0x03
#define VS1053_REG_MODE 0x00
#define VS1053_REG_STATUS 0x01
#define VS1053_REG_BASS 0x02
#define VS1053_REG_CLOCKF 0x03
#define VS1053_REG_DECODE_TIME 0x04
#define VS1053_REG_AUDATA 0x05
#define VS1053_REG_WRAM 0x06
#define VS1053_REG_WRAMADDR 0x07
#define VS1053_REG_HDAT0 0x08
#define VS1053_REG_HDAT1 0x09
#define VS1053_REG_AIADDR 0x0A
#define VS1053_REG_VOL 0x0B
#define VS1053_REG_AICTRL0 0x0C
#define VS1053_REG_AICTRL1 0x0D
#define VS1053_REG_AICTRL2 0x0E
#define VS1053_REG_AICTRL3 0x0F
#define VS1053_ADDR_DDR 0xC017
#define VS1053_ADDR_IDATA 0xC018
#define VS1053_ADDR_ODATA 0xC019
#define VS1053_ADDR_INT_ENABLE 0xC01A
#define VS1053_CLOCK_4_5 0xc000
#define VS1053_CLOCK_1 0x0000
//Bits in Mode Register
#define VS1053_SM_DIFF BIT(0)
#define VS1053_SM_LAYER12 BIT(1)
#define VS1053_SM_RESET BIT(2)
#define VS1053_SM_CANCEL BIT(3)
#define VS1053_SM_EARSPEAKER_LO BIT(4)
#define VS1053_SM_TESTS BIT(5)
#define VS1053_SM_STREAM BIT(6)
#define VS1053_SM_EARSPEAKER_HI BIT(7)
#define VS1053_SM_DACT BIT(8)
#define VS1053_SM_SDIORD BIT(9)
#define VS1053_SM_SDISHARE BIT(10)
#define VS1053_SM_SDINEW BIT(11)
#define VS1053_SM_ADPCM BIT(12)
#define VS1053_SM_LINE1 BIT(14)
#define VS1053_SM_CLK_RANGE BIT(15)
//State Machine Defines
#define VS1053_STM_STREAMING 1
#define VS1053_STM_STOP 0
#define VS1053_READVOL_STM_START 0
#define VS1053_READVOL_STM_WAIT 1
#define VS1053_READVOL_STM_WAITMORE 2
#define VS1053_READVOL_STM_SETLEDS 3
#define VS1053_READVOL_PARAM_INITIALWAIT 1000
#define VS1053_READVOL_PARAM_ADDITIONALWAIT 100
#define VS1053_STREAMOGG_PARAM_MAXBLOCKSIZE 768
extern unsigned char vs1053stm;
extern void VS1053WriteRegister(unsigned char reg, unsigned short val);
extern unsigned short VS1053ReadRegister(unsigned char reg);
extern void VS1053WriteWram(unsigned short addr, unsigned short val);
extern unsigned short VS1053ReadWram(unsigned short addr);
extern void VS1053SetGPIO(unsigned char gpio);
extern unsigned char VS1053GetGPIO(void);
extern void InitVS1053(void);
extern void VS1053Reset(void);
extern void VS1053LoadPlugin(void);
extern void VS1053WriteIWram(unsigned short addr, unsigned long val);
extern unsigned long VS1053ReadIWram(unsigned short addr);
extern void VS1053StreamOgg(void);
extern void VS1053StreamOggClose(void);
extern unsigned char VS1053LevelMeter(unsigned char l);
extern void VS1053ReadVol(void);
#endif //__VS1053_H__