Usb read

Dependencies:   FATFileSystem

Fork of F401RE-USBHost by Norimasa Okamoto

Committer:
va009039
Date:
Mon Jun 23 20:30:04 2014 +0900
Revision:
16:981c3104f6c0
Parent:
10:40c7f6788902
add FRDM-K64F.(not tested)

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 16:981c3104f6c0 10 ~myvector() {
va009039 16:981c3104f6c0 11 if (m_buf) {
va009039 16:981c3104f6c0 12 delete[] m_buf;
va009039 16:981c3104f6c0 13 }
va009039 16:981c3104f6c0 14 }
va009039 10:40c7f6788902 15 void push_back(T v) {
va009039 10:40c7f6788902 16 T* new_buf = new T[m_size+1];
va009039 10:40c7f6788902 17 if (m_size > 0) {
va009039 10:40c7f6788902 18 for(int i = 0; i < m_size; i++) {
va009039 10:40c7f6788902 19 new_buf[i] = m_buf[i];
va009039 10:40c7f6788902 20 }
va009039 10:40c7f6788902 21 delete[] m_buf;
va009039 10:40c7f6788902 22 }
va009039 10:40c7f6788902 23 m_buf = new_buf;
va009039 10:40c7f6788902 24 m_buf[m_size++] = v;
va009039 10:40c7f6788902 25 }
va009039 10:40c7f6788902 26 T& operator[](const int index) {
va009039 10:40c7f6788902 27 return m_buf[index];
va009039 10:40c7f6788902 28 }
va009039 10:40c7f6788902 29 int size() { return m_size; }
va009039 10:40c7f6788902 30
va009039 10:40c7f6788902 31 private:
va009039 10:40c7f6788902 32 int m_size;
va009039 10:40c7f6788902 33 T *m_buf;
va009039 10:40c7f6788902 34 };