Remove usb_midi.PortIn and PortOut constructors.

This commit is contained in:
Craig Forbes 2019-02-06 22:22:15 -06:00
parent 041a84e8f9
commit de43911a68
6 changed files with 6 additions and 29 deletions

View File

@ -43,16 +43,12 @@
//|
//| .. class:: PortIn()
//|
//| Not currently dynamically supported.
//| You cannot create an instance of `usb_midi.PortIn`.
//|
//| PortIn objects are constructed for every corresponding entry in the USB descriptor and added
//| to the ``usb_midi.ports`` tuple.
//| PortIn objects are constructed for every corresponding entry in the USB
//| descriptor and added to the ``usb_midi.ports`` tuple.
//|
STATIC mp_obj_t usb_midi_portin_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
return mp_const_none;
}
// These are standard stream methods. Code is in py/stream.c.
//
//| .. method:: read(nbytes=None)
@ -120,7 +116,6 @@ STATIC const mp_stream_p_t usb_midi_portin_stream_p = {
const mp_obj_type_t usb_midi_portin_type = {
{ &mp_type_type },
.name = MP_QSTR_PortIn,
.make_new = usb_midi_portin_make_new,
.getiter = mp_identity_getiter,
.iternext = mp_stream_unbuffered_iter,
.protocol = &usb_midi_portin_stream_p,

View File

@ -31,9 +31,6 @@
extern const mp_obj_type_t usb_midi_portin_type;
// Construct an underlying UART object.
extern void common_hal_usb_midi_portin_construct(usb_midi_portin_obj_t *self,
uint8_t receiver_buffer_size);
// Read characters.
extern size_t common_hal_usb_midi_portin_read(usb_midi_portin_obj_t *self,
uint8_t *data, size_t len, int *errcode);

View File

@ -43,16 +43,12 @@
//|
//| .. class:: PortOut()
//|
//| Not currently dynamically supported.
//| You cannot create an instance of `usb_midi.PortOut`.
//|
//| PortOut objects are constructed for every corresponding entry in the USB descriptor and added
//| to the ``usb_midi.ports`` tuple.
//| PortOut objects are constructed for every corresponding entry in the USB
//| descriptor and added to the ``usb_midi.ports`` tuple.
//|
STATIC mp_obj_t usb_midi_portout_make_new(const mp_obj_type_t *type, size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
return mp_const_none;
}
// These are standard stream methods. Code is in py/stream.c.
//
//| .. method:: write(buf)
@ -102,7 +98,6 @@ STATIC const mp_stream_p_t usb_midi_portout_stream_p = {
const mp_obj_type_t usb_midi_portout_type = {
{ &mp_type_type },
.name = MP_QSTR_PortOut,
.make_new = usb_midi_portout_make_new,
.getiter = mp_identity_getiter,
.iternext = mp_stream_unbuffered_iter,
.protocol = &usb_midi_portout_stream_p,

View File

@ -31,10 +31,6 @@
extern const mp_obj_type_t usb_midi_portout_type;
// Construct an underlying UART object.
extern void common_hal_usb_midi_portout_construct(usb_midi_portout_obj_t *self,
uint8_t receiver_buffer_size);
// Write characters. len is in characters NOT bytes!
extern size_t common_hal_usb_midi_portout_write(usb_midi_portout_obj_t *self,
const uint8_t *data, size_t len, int *errcode);

View File

@ -28,9 +28,6 @@
#include "supervisor/shared/translate.h"
#include "tusb.h"
void common_hal_usb_midi_portin_construct(usb_midi_portin_obj_t *self, uint8_t receiver_buffer_size) {
}
size_t common_hal_usb_midi_portin_read(usb_midi_portin_obj_t *self, uint8_t *data, size_t len, int *errcode) {
return tud_midi_read(data, len);
}

View File

@ -28,9 +28,6 @@
#include "supervisor/shared/translate.h"
#include "tusb.h"
void common_hal_usb_midi_portout_construct(usb_midi_portout_obj_t *self) {
}
size_t common_hal_usb_midi_portout_write(usb_midi_portout_obj_t *self, const uint8_t *data, size_t len, int *errcode) {
return tud_midi_write(0, data, len);
}