-
Notifications
You must be signed in to change notification settings - Fork 2
/
SI4730.h
57 lines (51 loc) · 1.53 KB
/
SI4730.h
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
#ifndef Si4730_h
#define Si4730_h
#include "Arduino.h"
#include <Wire.h>
#define SI4730_ADDR 0x63
#define SI4730_POWER_UP 0x01
#define SI4730_POWER_DOWN 0x11
#define SI4730_SET_PROPERTY 0x12 // SI4730 변수 값 변경
#define SI4730_ANALOGOUT 0x05
#define SI4730_SET_FM_FREQ 0x20
#define SI4730_SET_AM_FREQ 0x40
#define SI4730_SEEK_FM 0x21
#define SI4730_SEEK_AM 0x41
#define SI4730_SEEK_UP 0x0C
#define SI4730_SEEK_DOWN 0x04
#define SI4730_FM_STATUS 0x22
#define SI4730_AM_STATUS 0x42
#define SI4730_MODE_FM 0x50
#define SI4730_MODE_AM 0x51 // 0x01 이라는 데이터시트 내용도 있음. 참고
// AM 채널 필터 값
#define SI4730_AM_FILTER_6 0x00
#define SI4730_AM_FILTER_4 0x01
#define SI4730_AM_FILTER_3 0x02
#define SI4730_AM_FILTER_2 0x03
#define SI4730_AM_FILTER_1 0x04
class Si4730
{
public:
Si4730(uint8_t rstpin);
void powerUp(bool mode);
void setFMFrequency(uint16_t freq);
void setAMFrequency(uint16_t freq);
void seekFM(bool updown);
void seekAM(bool updown);
void setVolume(uint8_t vol);
void setMute(bool mute);
void channelFilterFM(uint8_t filter);
void channelFilterAM(uint8_t filter);
void deEmphasisAM(bool emphasis);
void spaceSeekAM(bool space);
void receiveResponse(void);
void GET_REV(void);
uint16_t getProperty(uint16_t command);
void FM_STATUS(void);
void AM_STATUS(void);
void powerDown(void);
private:
uint8_t _pin, _i=6, _highbyte, _lowbyte, _filter=6;
uint16_t _frequency = 9870;
};
#endif