金牌会员
 
- 积分
- 2655
- 金钱
- 2655
- 注册时间
- 2016-4-4
- 在线时间
- 226 小时
|
3金钱
我找到一个arduino的库
他定义了同样的函数名但输入参数分别为不同值
就实现了不同功能或者默认参数2为0,
在stm32里这样重定义报错那么如何实现?
下面是那份代码
void mp3_set_serial (HardwareSerial &theSerial) {
_hardware_serial = &theSerial;
send_func = h_send_func;
}
//
void mp3_set_serial (SoftwareSerial &theSerial) {
_software_serial = &theSerial;
send_func = s_send_func;
}
//
void mp3_send_cmd (uint8_t cmd, uint16_t arg) {
send_buf[3] = cmd;
fill_uint16_bigend ((send_buf+5), arg);
mp3_fill_checksum ();
send_func ();
}
//
void mp3_send_cmd (uint8_t cmd) {
send_buf[3] = cmd;
fill_uint16_bigend ((send_buf+5), 0);
mp3_fill_checksum ();
send_func ();
|
|