回答編集履歴
1
ex
test
CHANGED
@@ -37,3 +37,85 @@
|
|
37
37
|
- [https://github.com/Seeed-Studio/Grove_Serial_MP3_Player_V2.0](https://github.com/Seeed-Studio/Grove_Serial_MP3_Player_V2.0)
|
38
38
|
|
39
39
|
- [http://wiki.seeed.cc/Grove-MP3_v2.0/](http://wiki.seeed.cc/Grove-MP3_v2.0/)
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
## 追記
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
うーん、本当に書き換えはほぼCの範囲なんだけどなぁ・・・
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
```cpp
|
52
|
+
|
53
|
+
void SpecifyfolderPlay(uint8_t folder, uint8_t index)
|
54
|
+
|
55
|
+
{
|
56
|
+
|
57
|
+
mp3.write(0x7E);
|
58
|
+
|
59
|
+
mp3.write(0xFF);
|
60
|
+
|
61
|
+
mp3.write(0x06);
|
62
|
+
|
63
|
+
mp3.write(0x0F);
|
64
|
+
|
65
|
+
mp3.write(uint8_t(0x00));
|
66
|
+
|
67
|
+
mp3.write(uint8_t(folder));
|
68
|
+
|
69
|
+
mp3.write(uint8_t(index));
|
70
|
+
|
71
|
+
mp3.write(0xEF);
|
72
|
+
|
73
|
+
delay(10);
|
74
|
+
|
75
|
+
// return true;
|
76
|
+
|
77
|
+
}
|
78
|
+
|
79
|
+
```
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
例えば[こんな関数](https://github.com/Seeed-Studio/Grove_Serial_MP3_Player_V2.0/blob/00dfa96d7444f12bd15c7feb39325bdc5b04c392/MP3Player_KT403A.cpp#L89)がありますが、
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
```cpp
|
88
|
+
|
89
|
+
#include "mbed.h"
|
90
|
+
|
91
|
+
#include <cstdint>
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
template <class T, size_t N>
|
96
|
+
|
97
|
+
constexpr size_t size(const T (&)[N]) noexcept { return N; }
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
using uint8_t = std::uint8_t;
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
void SpecifyfolderPlay(uint8_t folder, uint8_t index)
|
106
|
+
|
107
|
+
{
|
108
|
+
|
109
|
+
const uint8_t out[] = { 0x7E, 0xFF, 0x06, 0x00, folder, index, 0xEF };
|
110
|
+
|
111
|
+
mp3.write(reinterpret_cast<const char*>(out), size(out));
|
112
|
+
|
113
|
+
wait_ms(10);
|
114
|
+
|
115
|
+
}
|
116
|
+
|
117
|
+
```
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
こんな感じになるんじゃないですかね~、あくまでイメージですが。
|