Opens the endpoint for reading or writing via USB
Device (from impOS™ 34)
imp005 and impC001 only
The speed in Mb/s. Must be either 1.5 or 12
The address of the device
The endpoint’s interface number
The type of the endpoint
The maximum size of packet that can be written or read on this endpoint
The address of the endpoint
Interval for polling endpoint for data transfers. Valid range: 1—255 (from impOS 36)
This method opens the specified endpoint for reading or writing via the imp005’s USB. It will throw an exception if it can’t open the specified endpoint (otherwise it simply returns
If the device goes away or usb.disable() is called, all endpoints are closed and must be re-opened when the device returns.
The value of the endpointType parameter is provided in the endpoint descriptor generated when the device connects, an event which triggers a call to the callback function registered with usb.configure(). It will one of the following values:
||Isochronous endpoint not supported|
||Interrupt In endpoint (from impOS™ 36; see below)|
The maximum size of packet that can be written or read on this endpoint is also provided in the endpoint descriptor returned to the callback function registered with usb.configure() when the peripheral device first connects.
The endpoint value is an 8-bit integer formed from the following bit fields:
|D0-3||The endpoint number|
|D7||The direction of transfer: 0 is out, 1 is in|
Release 36 adds support for Interrupt In endpoints — but not Interrupt Out endpoints. To make use of an Interrupt In endpoint, the method requires an extra, seventh parameter: interval. This takes an integer value representing the polling period:
|Interval||Actual Polling Period (ms)|
If a value outside of the range 1-255 is passed into interval, or is not an integer, Squirrel will throw the following error:
"invalid interval in usb.openendpoint()".
One and only one Interrupt In endpoint may be opened. If you attempt to open another Interrupt In endpoint, Squirrel will throw the following error:
"endpoint already open in usb.openendpoint()".