Axeda Ready Demo for Freescale FRDM-KL46Z as accident alert system

Dependencies:   FRDM_MMA8451Q KL46Z-USBHost MAG3110 SocketModem TSI mbed FATFileSystem

Fork of AxedaGo-Freescal_FRDM-KL46Z revert by Axeda Corp

Committer:
AxedaCorp
Date:
Wed Jul 02 15:59:38 2014 +0000
Revision:
1:5ad12c581db4
Parent:
0:65004368569c
url ip switch
;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
AxedaCorp 0:65004368569c 1 /* mbed USBHost Library
AxedaCorp 0:65004368569c 2 * Copyright (c) 2006-2013 ARM Limited
AxedaCorp 0:65004368569c 3 *
AxedaCorp 0:65004368569c 4 * Licensed under the Apache License, Version 2.0 (the "License");
AxedaCorp 0:65004368569c 5 * you may not use this file except in compliance with the License.
AxedaCorp 0:65004368569c 6 * You may obtain a copy of the License at
AxedaCorp 0:65004368569c 7 *
AxedaCorp 0:65004368569c 8 * http://www.apache.org/licenses/LICENSE-2.0
AxedaCorp 0:65004368569c 9 *
AxedaCorp 0:65004368569c 10 * Unless required by applicable law or agreed to in writing, software
AxedaCorp 0:65004368569c 11 * distributed under the License is distributed on an "AS IS" BASIS,
AxedaCorp 0:65004368569c 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
AxedaCorp 0:65004368569c 13 * See the License for the specific language governing permissions and
AxedaCorp 0:65004368569c 14 * limitations under the License.
AxedaCorp 0:65004368569c 15 */
AxedaCorp 0:65004368569c 16
AxedaCorp 0:65004368569c 17 #pragma once
AxedaCorp 0:65004368569c 18 #include "USBHostTypes.h"
AxedaCorp 0:65004368569c 19 #include "USBDeviceConnected.h"
AxedaCorp 0:65004368569c 20 class USBDeviceConnected;
AxedaCorp 0:65004368569c 21
AxedaCorp 0:65004368569c 22 class USBEndpoint {
AxedaCorp 0:65004368569c 23 public:
AxedaCorp 0:65004368569c 24 USBEndpoint() : data01_toggle(DATA0),address(0),MaxPacketSize(8) {
AxedaCorp 0:65004368569c 25 dev = NULL;
AxedaCorp 0:65004368569c 26 }
AxedaCorp 0:65004368569c 27 void setDevice(USBDeviceConnected* _dev) { dev = _dev; }
AxedaCorp 0:65004368569c 28 void setState(uint8_t st){}; // dummy
AxedaCorp 0:65004368569c 29 void setLengthTransferred(int len) { transferred = len; };
AxedaCorp 0:65004368569c 30 void setSize(int size) { MaxPacketSize = size; }
AxedaCorp 0:65004368569c 31 void setType(ENDPOINT_TYPE _type) { type = _type; };
AxedaCorp 0:65004368569c 32 void setAddress(uint8_t addr) { address = addr; }
AxedaCorp 0:65004368569c 33 void setData01(uint8_t data01) { data01_toggle = data01; }
AxedaCorp 0:65004368569c 34
AxedaCorp 0:65004368569c 35 USBDeviceConnected* getDevice() { return dev; }
AxedaCorp 0:65004368569c 36 ENDPOINT_TYPE getType() { return type; };
AxedaCorp 0:65004368569c 37 int getLengthTransferred() { return transferred; }
AxedaCorp 0:65004368569c 38 uint8_t getAddress(){ return address; };
AxedaCorp 0:65004368569c 39 int getSize() { return MaxPacketSize; }
AxedaCorp 0:65004368569c 40 ENDPOINT_DIRECTION getDir() { return (address & 0x80) ? IN : OUT; }
AxedaCorp 0:65004368569c 41 uint8_t getData01() { return data01_toggle; }
AxedaCorp 0:65004368569c 42 void toggleData01() {
AxedaCorp 0:65004368569c 43 data01_toggle = (data01_toggle == DATA0) ? DATA1 : DATA0;
AxedaCorp 0:65004368569c 44 }
AxedaCorp 0:65004368569c 45
AxedaCorp 0:65004368569c 46 private:
AxedaCorp 0:65004368569c 47 ENDPOINT_TYPE type;
AxedaCorp 0:65004368569c 48 ENDPOINT_DIRECTION dir;
AxedaCorp 0:65004368569c 49 USBDeviceConnected* dev;
AxedaCorp 0:65004368569c 50 uint8_t data01_toggle; // DATA0,DATA1
AxedaCorp 0:65004368569c 51 uint8_t address;
AxedaCorp 0:65004368569c 52 int transferred;
AxedaCorp 0:65004368569c 53 int MaxPacketSize;
AxedaCorp 0:65004368569c 54 };