T3.6 MIDI USB Host - querying "midi1.product"

Status
Not open for further replies.

insolace

Active member
Apologies for what is probably a rudimentary question. I'm using a Teensy 3.6 as a USB host with a MIDI device, I'm attempting to query "midi1.product" but am getting an error when compiling. I'm using the "USBHost_t36/MIDI/InputFunctions" example, and referencing the USBHost_t36.h file.

Adding the following code to the "myNoteOn" section compiles and works fine:

Code:
  Serial.println(midi1.idVendor());  
  Serial.println(midi1.idProduct());

The following code gives an error:

Code:
  Serial.println(midi1.product());

The error is "no matching function for call to 'println(const uint8_t*)'"

The relevant code from the header is:

Code:
// All USB device drivers inherit from this base class.
class USBDriver : public USBHost {
public:
	operator bool() {
		Device_t *dev = *(Device_t * volatile *)&device;
		return dev != nullptr;
	}
	uint16_t idVendor() {
		Device_t *dev = *(Device_t * volatile *)&device;
		return (dev != nullptr) ? dev->idVendor : 0;
	}
	uint16_t idProduct() {
		Device_t *dev = *(Device_t * volatile *)&device;
		return (dev != nullptr) ? dev->idProduct : 0;
	}
	const uint8_t *manufacturer() {
		Device_t *dev = *(Device_t * volatile *)&device;
		if (dev == nullptr || dev->strbuf == nullptr) return nullptr;
		return &dev->strbuf->buffer[dev->strbuf->iStrings[strbuf_t::STR_ID_MAN]];
	}
	const uint8_t *product() {
		Device_t *dev = *(Device_t * volatile *)&device;
		if (dev == nullptr || dev->strbuf == nullptr) return nullptr;
		return &dev->strbuf->buffer[dev->strbuf->iStrings[strbuf_t::STR_ID_PROD]];
	}
	const uint8_t *serialNumber() {
		Device_t *dev = *(Device_t * volatile *)&device;
		if (dev == nullptr || dev->strbuf == nullptr) return nullptr;
		return &dev->strbuf->buffer[dev->strbuf->iStrings[strbuf_t::STR_ID_SERIAL]];
	}

I suspect this is because the "*product()" variable is being defined as a constant, and I'm not calling it correctly. Could someone point me in the right direction here?
 
Status
Not open for further replies.
Back
Top