MMEx with SPI Slave to allow legacy devices to communicate with modern media such as USB, SD cards, the internet and all of the mbed\'s other interfaces

Dependencies:   NetServices MSCUsbHost mbed TMP102 SDFileSystem

Committer:
DeMein
Date:
Sun Feb 27 18:54:40 2011 +0000
Revision:
0:67a55a82ce06
Version as submitted to the NXP Design Challenge

Who changed what in which revision?

UserRevisionLine numberNew contents of line
DeMein 0:67a55a82ce06 1 /* MMEx for MBED - Support functions
DeMein 0:67a55a82ce06 2 * Copyright (c) 2011 MK
DeMein 0:67a55a82ce06 3 *
DeMein 0:67a55a82ce06 4 * Permission is hereby granted, free of charge, to any person obtaining a copy
DeMein 0:67a55a82ce06 5 * of this software and associated documentation files (the "Software"), to deal
DeMein 0:67a55a82ce06 6 * in the Software without restriction, including without limitation the rights
DeMein 0:67a55a82ce06 7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
DeMein 0:67a55a82ce06 8 * copies of the Software, and to permit persons to whom the Software is
DeMein 0:67a55a82ce06 9 * furnished to do so, subject to the following conditions:
DeMein 0:67a55a82ce06 10 *
DeMein 0:67a55a82ce06 11 * The above copyright notice and this permission notice shall be included in
DeMein 0:67a55a82ce06 12 * all copies or substantial portions of the Software.
DeMein 0:67a55a82ce06 13 *
DeMein 0:67a55a82ce06 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
DeMein 0:67a55a82ce06 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
DeMein 0:67a55a82ce06 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
DeMein 0:67a55a82ce06 17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
DeMein 0:67a55a82ce06 18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
DeMein 0:67a55a82ce06 19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
DeMein 0:67a55a82ce06 20 * THE SOFTWARE.
DeMein 0:67a55a82ce06 21 */
DeMein 0:67a55a82ce06 22
DeMein 0:67a55a82ce06 23 /**
DeMein 0:67a55a82ce06 24 \file globaldefs.h.h
DeMein 0:67a55a82ce06 25 \brief header file for some global definitions
DeMein 0:67a55a82ce06 26 */
DeMein 0:67a55a82ce06 27
DeMein 0:67a55a82ce06 28 #ifndef GLOBALDEFS_H
DeMein 0:67a55a82ce06 29 #define GLOBALDEFS_H
DeMein 0:67a55a82ce06 30
DeMein 0:67a55a82ce06 31 // control characters
DeMein 0:67a55a82ce06 32 #define c_prompt '!' // prompt character
DeMein 0:67a55a82ce06 33 #define c_escape '>' // escape character
DeMein 0:67a55a82ce06 34 #define c_arrow '>' // to send the > character
DeMein 0:67a55a82ce06 35 #define c_eof 'F' // for End-Of-File/End-Of-Transmission
DeMein 0:67a55a82ce06 36 #define c_return 'C' // for Cariiage Return
DeMein 0:67a55a82ce06 37 #define c_null 'N' // for null character
DeMein 0:67a55a82ce06 38 #define c_zero '0' // alternative for null
DeMein 0:67a55a82ce06 39 #define c_hex '$' // hex chars to follow
DeMein 0:67a55a82ce06 40 #define c_hexalt 'X' // hex chars to follow
DeMein 0:67a55a82ce06 41 #define c_append '+' // append to string
DeMein 0:67a55a82ce06 42 #define c_intrpt 'I' // interrupt pending command
DeMein 0:67a55a82ce06 43 #define c_space ' ' // space character
DeMein 0:67a55a82ce06 44 #define c_cr 0x0d // Carriage Return or <CR>
DeMein 0:67a55a82ce06 45 #define c_percent '%' // percent character
DeMein 0:67a55a82ce06 46
DeMein 0:67a55a82ce06 47 #define c_error 'E'
DeMein 0:67a55a82ce06 48 #define c_busy 'B'
DeMein 0:67a55a82ce06 49
DeMein 0:67a55a82ce06 50 #define c_rpc '/'
DeMein 0:67a55a82ce06 51 #define c_rpcapp '+'
DeMein 0:67a55a82ce06 52 #define c_rpcexe '*'
DeMein 0:67a55a82ce06 53
DeMein 0:67a55a82ce06 54 // control strings
DeMein 0:67a55a82ce06 55 #define cc_arrow ">>"
DeMein 0:67a55a82ce06 56 #define cc_prompt ">!"
DeMein 0:67a55a82ce06 57 #define cc_null ">N"
DeMein 0:67a55a82ce06 58 #define cc_eof ">F"
DeMein 0:67a55a82ce06 59 #define cc_error ">E"
DeMein 0:67a55a82ce06 60 #define cc_busy ">B"
DeMein 0:67a55a82ce06 61
DeMein 0:67a55a82ce06 62 // main command grouping
DeMein 0:67a55a82ce06 63 #define cmd_m 'M'
DeMein 0:67a55a82ce06 64 #define cmd_c 'C'
DeMein 0:67a55a82ce06 65 #define cmd_f 'F'
DeMein 0:67a55a82ce06 66 #define cmd_r 'R'
DeMein 0:67a55a82ce06 67 #define cmd_rpc '/'
DeMein 0:67a55a82ce06 68 #define cmd_n 'N'
DeMein 0:67a55a82ce06 69 #define cmd_p 'P'
DeMein 0:67a55a82ce06 70 #define cmd_u 'U'
DeMein 0:67a55a82ce06 71 #define cmd_c 'C'
DeMein 0:67a55a82ce06 72
DeMein 0:67a55a82ce06 73 #define command_mode true
DeMein 0:67a55a82ce06 74 #define data_mode false
DeMein 0:67a55a82ce06 75
DeMein 0:67a55a82ce06 76
DeMein 0:67a55a82ce06 77 #endif