Usb read

Dependencies:   FATFileSystem

Fork of F401RE-USBHost by Norimasa Okamoto

Committer:
va009039
Date:
Wed Feb 05 13:34:37 2014 +0000
Revision:
10:40c7f6788902
Child:
16:981c3104f6c0
fix endpoint callback.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
va009039 10:40c7f6788902 1 #pragma once
va009039 10:40c7f6788902 2
va009039 10:40c7f6788902 3 template<class T>
va009039 10:40c7f6788902 4 class myvector {
va009039 10:40c7f6788902 5 public:
va009039 10:40c7f6788902 6 myvector() {
va009039 10:40c7f6788902 7 m_size = 0;
va009039 10:40c7f6788902 8 m_buf = NULL;
va009039 10:40c7f6788902 9 }
va009039 10:40c7f6788902 10 void push_back(T v) {
va009039 10:40c7f6788902 11 T* new_buf = new T[m_size+1];
va009039 10:40c7f6788902 12 if (m_size > 0) {
va009039 10:40c7f6788902 13 for(int i = 0; i < m_size; i++) {
va009039 10:40c7f6788902 14 new_buf[i] = m_buf[i];
va009039 10:40c7f6788902 15 }
va009039 10:40c7f6788902 16 delete[] m_buf;
va009039 10:40c7f6788902 17 }
va009039 10:40c7f6788902 18 m_buf = new_buf;
va009039 10:40c7f6788902 19 m_buf[m_size++] = v;
va009039 10:40c7f6788902 20 }
va009039 10:40c7f6788902 21 T& operator[](const int index) {
va009039 10:40c7f6788902 22 return m_buf[index];
va009039 10:40c7f6788902 23 }
va009039 10:40c7f6788902 24 int size() { return m_size; }
va009039 10:40c7f6788902 25
va009039 10:40c7f6788902 26 private:
va009039 10:40c7f6788902 27 int m_size;
va009039 10:40c7f6788902 28 T *m_buf;
va009039 10:40c7f6788902 29 };