Added to LPC4088-USBHost the USBHostMidi class. Plugin an usb midi interface to the usb host of lpc4088 allows to send midi event to the midi interface. For the moment I can not be able to get event from the interface by using the attacheNoteOn or other triggers...
Dependencies: FATFileSystem mbed-rtos
Fork of LPC4088-USBHost by
USBHost/myvector.h@1:d652de69bd1a, 2015-04-06 (annotated)
- Committer:
- Grag38
- Date:
- Mon Apr 06 12:46:58 2015 +0000
- Revision:
- 1:d652de69bd1a
- Parent:
- 0:148fca6fd246
Added USBHostMidi to drive midi interface.; ; Tested to send Midi messages from LPC4088. This works.; ; Need to test with incomming events.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
va009039 | 0:148fca6fd246 | 1 | #pragma once |
va009039 | 0:148fca6fd246 | 2 | |
va009039 | 0:148fca6fd246 | 3 | template<class T> |
va009039 | 0:148fca6fd246 | 4 | class myvector { |
va009039 | 0:148fca6fd246 | 5 | public: |
va009039 | 0:148fca6fd246 | 6 | myvector() { |
va009039 | 0:148fca6fd246 | 7 | m_size = 0; |
va009039 | 0:148fca6fd246 | 8 | m_buf = NULL; |
va009039 | 0:148fca6fd246 | 9 | } |
va009039 | 0:148fca6fd246 | 10 | ~myvector() { |
va009039 | 0:148fca6fd246 | 11 | if (m_buf) { |
va009039 | 0:148fca6fd246 | 12 | delete[] m_buf; |
va009039 | 0:148fca6fd246 | 13 | } |
va009039 | 0:148fca6fd246 | 14 | } |
va009039 | 0:148fca6fd246 | 15 | void push_back(T v) { |
va009039 | 0:148fca6fd246 | 16 | T* new_buf = new T[m_size+1]; |
va009039 | 0:148fca6fd246 | 17 | if (m_size > 0) { |
va009039 | 0:148fca6fd246 | 18 | for(int i = 0; i < m_size; i++) { |
va009039 | 0:148fca6fd246 | 19 | new_buf[i] = m_buf[i]; |
va009039 | 0:148fca6fd246 | 20 | } |
va009039 | 0:148fca6fd246 | 21 | delete[] m_buf; |
va009039 | 0:148fca6fd246 | 22 | } |
va009039 | 0:148fca6fd246 | 23 | m_buf = new_buf; |
va009039 | 0:148fca6fd246 | 24 | m_buf[m_size++] = v; |
va009039 | 0:148fca6fd246 | 25 | } |
va009039 | 0:148fca6fd246 | 26 | T& operator[](const int index) { |
va009039 | 0:148fca6fd246 | 27 | return m_buf[index]; |
va009039 | 0:148fca6fd246 | 28 | } |
va009039 | 0:148fca6fd246 | 29 | int size() { return m_size; } |
va009039 | 0:148fca6fd246 | 30 | |
va009039 | 0:148fca6fd246 | 31 | private: |
va009039 | 0:148fca6fd246 | 32 | int m_size; |
va009039 | 0:148fca6fd246 | 33 | T *m_buf; |
va009039 | 0:148fca6fd246 | 34 | }; |