Skip to content

allow 3rd party boards that depend on sam core to use their own USB vid/pid and manufacturer/product strings #4693

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 15, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions hardware/arduino/sam/boards.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ arduino_due_x_dbg.upload.wait_for_upload_port=false
arduino_due_x_dbg.upload.native_usb=false
arduino_due_x_dbg.build.mcu=cortex-m3
arduino_due_x_dbg.build.f_cpu=84000000L
arduino_due_x_dbg.build.usb_manufacturer="Arduino LLC"
arduino_due_x_dbg.build.usb_product="Arduino Due"
arduino_due_x_dbg.build.board=SAM_DUE
arduino_due_x_dbg.build.core=arduino
Expand All @@ -35,6 +36,7 @@ arduino_due_x.upload.wait_for_upload_port=true
arduino_due_x.upload.native_usb=true
arduino_due_x.build.mcu=cortex-m3
arduino_due_x.build.f_cpu=84000000L
arduino_due_x.build.usb_manufacturer="Arduino LLC"
arduino_due_x.build.usb_product="Arduino Due"
arduino_due_x.build.board=SAM_DUE
arduino_due_x.build.core=arduino
Expand Down
12 changes: 8 additions & 4 deletions hardware/arduino/sam/cores/arduino/Arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,14 @@ extern const PinDescription g_APinDescription[] ;
#include "watchdog.h"

// USB Device
#define USB_VID 0x2341 // arduino LLC vid
#define USB_PID_LEONARDO 0x0034
#define USB_PID_MICRO 0x0035
#define USB_PID_DUE 0x003E
#ifndef USB_VID
#define USB_VID 0x2341 // arduino LLC vid
#endif

#ifndef USB_PID
#define USB_PID 0x003E // arduino Due pid
#endif

#include "USB/USBDesc.h"
#include "USB/USBCore.h"
#include "USB/USBAPI.h"
Expand Down
17 changes: 3 additions & 14 deletions hardware/arduino/sam/cores/arduino/USB/USBCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,27 +66,16 @@ const uint16_t STRING_LANGUAGE[2] = {
};

#ifndef USB_PRODUCT
// Use a hardcoded product name if none is provided
#if USB_PID == USB_PID_DUE
#define USB_PRODUCT "Arduino Due"
#else
#define USB_PRODUCT "USB IO Board"
#endif
#endif

const uint8_t STRING_PRODUCT[] = USB_PRODUCT;

#if USB_VID == 0x2341
# if defined(USB_MANUFACTURER)
# undef USB_MANUFACTURER
# endif
# define USB_MANUFACTURER "Arduino LLC"
#elif !defined(USB_MANUFACTURER)
// Fall through to unknown if no manufacturer name was provided in a macro
# define USB_MANUFACTURER "Unknown"
#ifndef USB_MANUFACTURER
#define USB_MANUFACTURER "Arduino LLC"
#endif

const uint8_t STRING_MANUFACTURER[12] = USB_MANUFACTURER;
const uint8_t STRING_MANUFACTURER[] = USB_MANUFACTURER;

#ifdef CDC_ENABLED
#define DEVICE_CLASS 0x02
Expand Down