working pedometer code using tickers
Dependencies: mbed PulseSensor2 SCP1000 4DGL-uLCD-SE LSM9DS1_Library_cal PinDetect FatFileSystemCpp GP-20U7
USBHostLite/usbhost_ms.h@1:3b016acc5c55, 2020-04-21 (annotated)
- Committer:
- memig3
- Date:
- Tue Apr 21 22:56:01 2020 +0000
- Revision:
- 1:3b016acc5c55
- Parent:
- 0:bcfec522ef98
working pedometer code using tickers;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
memig3 | 0:bcfec522ef98 | 1 | /* |
memig3 | 0:bcfec522ef98 | 2 | ************************************************************************************************************** |
memig3 | 0:bcfec522ef98 | 3 | * NXP USB Host Stack |
memig3 | 0:bcfec522ef98 | 4 | * |
memig3 | 0:bcfec522ef98 | 5 | * (c) Copyright 2008, NXP SemiConductors |
memig3 | 0:bcfec522ef98 | 6 | * (c) Copyright 2008, OnChip Technologies LLC |
memig3 | 0:bcfec522ef98 | 7 | * All Rights Reserved |
memig3 | 0:bcfec522ef98 | 8 | * |
memig3 | 0:bcfec522ef98 | 9 | * www.nxp.com |
memig3 | 0:bcfec522ef98 | 10 | * www.onchiptech.com |
memig3 | 0:bcfec522ef98 | 11 | * |
memig3 | 0:bcfec522ef98 | 12 | * File : usbhost_ms.h |
memig3 | 0:bcfec522ef98 | 13 | * Programmer(s) : Ravikanth.P |
memig3 | 0:bcfec522ef98 | 14 | * Version : |
memig3 | 0:bcfec522ef98 | 15 | * |
memig3 | 0:bcfec522ef98 | 16 | ************************************************************************************************************** |
memig3 | 0:bcfec522ef98 | 17 | */ |
memig3 | 0:bcfec522ef98 | 18 | |
memig3 | 0:bcfec522ef98 | 19 | #ifndef USBHOST_MS_H |
memig3 | 0:bcfec522ef98 | 20 | #define USBHOST_MS_H |
memig3 | 0:bcfec522ef98 | 21 | |
memig3 | 0:bcfec522ef98 | 22 | /* |
memig3 | 0:bcfec522ef98 | 23 | ************************************************************************************************************** |
memig3 | 0:bcfec522ef98 | 24 | * INCLUDE HEADER FILES |
memig3 | 0:bcfec522ef98 | 25 | ************************************************************************************************************** |
memig3 | 0:bcfec522ef98 | 26 | */ |
memig3 | 0:bcfec522ef98 | 27 | |
memig3 | 0:bcfec522ef98 | 28 | #include "usbhost_inc.h" |
memig3 | 0:bcfec522ef98 | 29 | |
memig3 | 0:bcfec522ef98 | 30 | /* |
memig3 | 0:bcfec522ef98 | 31 | ************************************************************************************************************** |
memig3 | 0:bcfec522ef98 | 32 | * MASS STORAGE SPECIFIC DEFINITIONS |
memig3 | 0:bcfec522ef98 | 33 | ************************************************************************************************************** |
memig3 | 0:bcfec522ef98 | 34 | */ |
memig3 | 0:bcfec522ef98 | 35 | |
memig3 | 0:bcfec522ef98 | 36 | #define MS_GET_MAX_LUN_REQ 0xFE |
memig3 | 0:bcfec522ef98 | 37 | #define MASS_STORAGE_CLASS 0x08 |
memig3 | 0:bcfec522ef98 | 38 | #define MASS_STORAGE_SUBCLASS_SCSI 0x06 |
memig3 | 0:bcfec522ef98 | 39 | #define MASS_STORAGE_PROTOCOL_BO 0x50 |
memig3 | 0:bcfec522ef98 | 40 | |
memig3 | 0:bcfec522ef98 | 41 | #define INQUIRY_LENGTH 36 |
memig3 | 0:bcfec522ef98 | 42 | /* |
memig3 | 0:bcfec522ef98 | 43 | ************************************************************************************************************** |
memig3 | 0:bcfec522ef98 | 44 | * SCSI SPECIFIC DEFINITIONS |
memig3 | 0:bcfec522ef98 | 45 | ************************************************************************************************************** |
memig3 | 0:bcfec522ef98 | 46 | */ |
memig3 | 0:bcfec522ef98 | 47 | |
memig3 | 0:bcfec522ef98 | 48 | #define CBW_SIGNATURE 0x43425355 |
memig3 | 0:bcfec522ef98 | 49 | #define CSW_SIGNATURE 0x53425355 |
memig3 | 0:bcfec522ef98 | 50 | #define CBW_SIZE 31 |
memig3 | 0:bcfec522ef98 | 51 | #define CSW_SIZE 13 |
memig3 | 0:bcfec522ef98 | 52 | #define CSW_CMD_PASSED 0x00 |
memig3 | 0:bcfec522ef98 | 53 | #define SCSI_CMD_REQUEST_SENSE 0x03 |
memig3 | 0:bcfec522ef98 | 54 | #define SCSI_CMD_TEST_UNIT_READY 0x00 |
memig3 | 0:bcfec522ef98 | 55 | #define SCSI_CMD_INQUIRY 0x12 |
memig3 | 0:bcfec522ef98 | 56 | #define SCSI_CMD_READ_10 0x28 |
memig3 | 0:bcfec522ef98 | 57 | #define SCSI_CMD_READ_CAPACITY 0x25 |
memig3 | 0:bcfec522ef98 | 58 | #define SCSI_CMD_WRITE_10 0x2A |
memig3 | 0:bcfec522ef98 | 59 | |
memig3 | 0:bcfec522ef98 | 60 | /* |
memig3 | 0:bcfec522ef98 | 61 | ************************************************************************************************************** |
memig3 | 0:bcfec522ef98 | 62 | * TYPE DEFINITIONS |
memig3 | 0:bcfec522ef98 | 63 | ************************************************************************************************************** |
memig3 | 0:bcfec522ef98 | 64 | */ |
memig3 | 0:bcfec522ef98 | 65 | |
memig3 | 0:bcfec522ef98 | 66 | typedef enum ms_data_dir { |
memig3 | 0:bcfec522ef98 | 67 | |
memig3 | 0:bcfec522ef98 | 68 | MS_DATA_DIR_IN = 0x80, |
memig3 | 0:bcfec522ef98 | 69 | MS_DATA_DIR_OUT = 0x00, |
memig3 | 0:bcfec522ef98 | 70 | MS_DATA_DIR_NONE = 0x01 |
memig3 | 0:bcfec522ef98 | 71 | |
memig3 | 0:bcfec522ef98 | 72 | } MS_DATA_DIR; |
memig3 | 0:bcfec522ef98 | 73 | |
memig3 | 0:bcfec522ef98 | 74 | /* |
memig3 | 0:bcfec522ef98 | 75 | ************************************************************************************************************** |
memig3 | 0:bcfec522ef98 | 76 | * FUNCTION PROTOTYPES |
memig3 | 0:bcfec522ef98 | 77 | ************************************************************************************************************** |
memig3 | 0:bcfec522ef98 | 78 | */ |
memig3 | 0:bcfec522ef98 | 79 | |
memig3 | 0:bcfec522ef98 | 80 | USB_INT32S MS_BulkRecv ( USB_INT32U block_number, |
memig3 | 0:bcfec522ef98 | 81 | USB_INT16U num_blocks, |
memig3 | 0:bcfec522ef98 | 82 | volatile USB_INT08U *user_buffer); |
memig3 | 0:bcfec522ef98 | 83 | |
memig3 | 0:bcfec522ef98 | 84 | USB_INT32S MS_BulkSend ( USB_INT32U block_number, |
memig3 | 0:bcfec522ef98 | 85 | USB_INT16U num_blocks, |
memig3 | 0:bcfec522ef98 | 86 | volatile USB_INT08U *user_buffer); |
memig3 | 0:bcfec522ef98 | 87 | USB_INT32S MS_ParseConfiguration(void); |
memig3 | 0:bcfec522ef98 | 88 | USB_INT32S MS_TestUnitReady (void); |
memig3 | 0:bcfec522ef98 | 89 | USB_INT32S MS_ReadCapacity (USB_INT32U *numBlks, USB_INT32U *blkSize); |
memig3 | 0:bcfec522ef98 | 90 | USB_INT32S MS_GetMaxLUN (void); |
memig3 | 0:bcfec522ef98 | 91 | USB_INT32S MS_GetSenseInfo (void); |
memig3 | 0:bcfec522ef98 | 92 | USB_INT32S MS_Init (USB_INT32U *blkSize, USB_INT32U *numBlks, USB_INT08U *inquiryResult); |
memig3 | 0:bcfec522ef98 | 93 | USB_INT32S MS_Inquire (USB_INT08U *response); |
memig3 | 0:bcfec522ef98 | 94 | |
memig3 | 0:bcfec522ef98 | 95 | void Fill_MSCommand ( USB_INT32U block_number, |
memig3 | 0:bcfec522ef98 | 96 | USB_INT32U block_size, |
memig3 | 0:bcfec522ef98 | 97 | USB_INT16U num_blocks, |
memig3 | 0:bcfec522ef98 | 98 | MS_DATA_DIR direction, |
memig3 | 0:bcfec522ef98 | 99 | USB_INT08U scsi_cmd, |
memig3 | 0:bcfec522ef98 | 100 | USB_INT08U scsi_cmd_len); |
memig3 | 0:bcfec522ef98 | 101 | #endif |