浏览代码

Don't leak setup_struct into Arduino sketch namespace

main
PaulStoffregen 7 年前
父节点
当前提交
8b833f02d9
共有 2 个文件被更改,包括 25 次插入26 次删除
  1. +25
    -0
      teensy3/usb_audio.cpp
  2. +0
    -26
      teensy3/usb_audio.h

+ 25
- 0
teensy3/usb_audio.cpp 查看文件

@@ -350,6 +350,31 @@ unsigned int usb_audio_transmit_callback(void)
return target * 4;
}


struct setup_struct {
union {
struct {
uint8_t bmRequestType;
uint8_t bRequest;
union {
struct {
uint8_t bChannel; // 0=main, 1=left, 2=right
uint8_t bCS; // Control Selector
};
uint16_t wValue;
};
union {
struct {
uint8_t bIfEp; // type of entity
uint8_t bEntityId; // UnitID, TerminalID, etc.
};
uint16_t wIndex;
};
uint16_t wLength;
};
};
};

int usb_audio_get_feature(void *stp, uint8_t *data, uint32_t *datalen)
{
struct setup_struct setup = *((struct setup_struct *)stp);

+ 0
- 26
teensy3/usb_audio.h 查看文件

@@ -22,32 +22,6 @@ extern uint8_t usb_audio_transmit_setting;
#ifdef __cplusplus
}

// setup struct definition could be moved from usb_dev.c to usb_dev.h so we can reuse
// it instead of redefining it here
struct setup_struct {
union {
struct {
uint8_t bmRequestType;
uint8_t bRequest;
union {
struct {
uint8_t bChannel; // 0=main, 1=left, 2=right
uint8_t bCS; // Control Selector
};
uint16_t wValue;
};
union {
struct {
uint8_t bIfEp; // type of entity
uint8_t bEntityId; // UnitID, TerminalID, etc.
};
uint16_t wIndex;
};
uint16_t wLength;
};
};
};

// audio features supported
struct usb_audio_features_struct {
int change; // set to 1 when any value is changed

正在加载...
取消
保存