-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDFRobot_TM6605.cpp
More file actions
40 lines (32 loc) · 925 Bytes
/
DFRobot_TM6605.cpp
File metadata and controls
40 lines (32 loc) · 925 Bytes
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
/*!
* @file DFRobot_TM6605.cpp
* @brief Implementation of DFRobot_TM6605 class methods
* @copyright Copyright (c) 2025 DFRobot Co.Ltd (http://www.dfrobot.com)
* @license The MIT License (MIT)
* @author [fary](feng.yang@dfrobot.com)
* @version V1.0
* @date 2025-04-22
* @url https://github.com/DFRobot/DFRobot_TM6605
*/
#include "DFRobot_TM6605.h"
byte DFRobot_TM6605::begin(void){
_pWire->begin();
_pWire->beginTransmission(_deviceAddr);
return _pWire->endTransmission();
}
void DFRobot_TM6605::play(void){
writeReg(TM6605_REG_CONTROL,0x01);
}
void DFRobot_TM6605::stop(void){
writeReg(TM6605_REG_CONTROL,0x00);
}
void DFRobot_TM6605::selectEffect(eEffect_t effect)
{
writeReg(TM6605_REG_EFFECT,(uint8_t)effect);
}
void DFRobot_TM6605::writeReg(uint8_t reg,uint8_t data){
_pWire->beginTransmission(_deviceAddr);
_pWire->write(reg);
_pWire->write(data);
_pWire->endTransmission();
}