回答編集履歴
1
ex
answer
CHANGED
@@ -17,4 +17,45 @@
|
|
17
17
|
- [https://github.com/arduino/Arduino](https://github.com/arduino/Arduino)
|
18
18
|
- [https://github.com/ARMmbed/mbed-os](https://github.com/ARMmbed/mbed-os)
|
19
19
|
- [https://github.com/Seeed-Studio/Grove_Serial_MP3_Player_V2.0](https://github.com/Seeed-Studio/Grove_Serial_MP3_Player_V2.0)
|
20
|
-
- [http://wiki.seeed.cc/Grove-MP3_v2.0/](http://wiki.seeed.cc/Grove-MP3_v2.0/)
|
20
|
+
- [http://wiki.seeed.cc/Grove-MP3_v2.0/](http://wiki.seeed.cc/Grove-MP3_v2.0/)
|
21
|
+
|
22
|
+
## 追記
|
23
|
+
|
24
|
+
うーん、本当に書き換えはほぼCの範囲なんだけどなぁ・・・
|
25
|
+
|
26
|
+
```cpp
|
27
|
+
void SpecifyfolderPlay(uint8_t folder, uint8_t index)
|
28
|
+
{
|
29
|
+
mp3.write(0x7E);
|
30
|
+
mp3.write(0xFF);
|
31
|
+
mp3.write(0x06);
|
32
|
+
mp3.write(0x0F);
|
33
|
+
mp3.write(uint8_t(0x00));
|
34
|
+
mp3.write(uint8_t(folder));
|
35
|
+
mp3.write(uint8_t(index));
|
36
|
+
mp3.write(0xEF);
|
37
|
+
delay(10);
|
38
|
+
// return true;
|
39
|
+
}
|
40
|
+
```
|
41
|
+
|
42
|
+
例えば[こんな関数](https://github.com/Seeed-Studio/Grove_Serial_MP3_Player_V2.0/blob/00dfa96d7444f12bd15c7feb39325bdc5b04c392/MP3Player_KT403A.cpp#L89)がありますが、
|
43
|
+
|
44
|
+
```cpp
|
45
|
+
#include "mbed.h"
|
46
|
+
#include <cstdint>
|
47
|
+
|
48
|
+
template <class T, size_t N>
|
49
|
+
constexpr size_t size(const T (&)[N]) noexcept { return N; }
|
50
|
+
|
51
|
+
using uint8_t = std::uint8_t;
|
52
|
+
|
53
|
+
void SpecifyfolderPlay(uint8_t folder, uint8_t index)
|
54
|
+
{
|
55
|
+
const uint8_t out[] = { 0x7E, 0xFF, 0x06, 0x00, folder, index, 0xEF };
|
56
|
+
mp3.write(reinterpret_cast<const char*>(out), size(out));
|
57
|
+
wait_ms(10);
|
58
|
+
}
|
59
|
+
```
|
60
|
+
|
61
|
+
こんな感じになるんじゃないですかね~、あくまでイメージですが。
|