MAX30001-MAX32630FTHR SYS EvKit
Dependencies: USBDevice max32630fthr
Max30001 EVKIT Summary
The MAX30001 EVKIT SYS-MBED Evaluation System (EV System) is used to evaluates the MAX30001 sensor, which is an ECG (electrocardiogram), biopotential and bioimpedance analog front end solution for wearable applications. The full EV System consists of the MAX32630FTHR Development board (DEV board) and MAX30001 sensor board and the evaluation software. The EvKit features EKG, PACE, RtoR (R-peak timing), Bio-Z, and raw data logging.
The MAX30001 EVKIT SYS-MBED evaluation system is assembled, tested and contains the necessary circuitry and connections to evaluate the MAX30001 sensor.
When evaluated as an EV System, the MAX32630FTHR board provides the necessary logic rails, master clock, SPI, USB-to-Serial interfaces that are needed to evaluate the MAX30001 sensor board. MAX32630FTHR can be used as an independent development platform. Another wiki page for that platform is available here.
Communication with the DEV board is facilitated by Windows 7, Windows 8 and Windows 10 compatible software that provides a simple and intuitive graphical user interface (GUI).
HSP/Devices/S25FS256/S25FS512_RPC.cpp@0:8e4630a71eb1, 2018-04-05 (annotated)
- Committer:
- Emre.Eken@IST-LT-35101.maxim-ic.internal
- Date:
- Thu Apr 05 10:53:26 2018 +0300
- Revision:
- 0:8e4630a71eb1
mbed os 5.8.1 compatible
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 1 | /******************************************************************************* |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 2 | * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved. |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 3 | * |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 4 | * Permission is hereby granted, free of charge, to any person obtaining a |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 5 | * copy of this software and associated documentation files (the "Software"), |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 6 | * to deal in the Software without restriction, including without limitation |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 7 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 8 | * and/or sell copies of the Software, and to permit persons to whom the |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 9 | * Software is furnished to do so, subject to the following conditions: |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 10 | * |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 11 | * The above copyright notice and this permission notice shall be included |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 12 | * in all copies or substantial portions of the Software. |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 13 | * |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 15 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 16 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 17 | * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 18 | * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 19 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 20 | * OTHER DEALINGS IN THE SOFTWARE. |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 21 | * |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 22 | * Except as contained in this notice, the name of Maxim Integrated |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 23 | * Products, Inc. shall not be used except as stated in the Maxim Integrated |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 24 | * Products, Inc. Branding Policy. |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 25 | * |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 26 | * The mere transfer of this software does not imply any licenses |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 27 | * of trade secrets, proprietary technology, copyrights, patents, |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 28 | * trademarks, maskwork rights, or any other form of intellectual |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 29 | * property whatsoever. Maxim Integrated Products, Inc. retains all |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 30 | * ownership rights. |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 31 | ******************************************************************************* |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 32 | */ |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 33 | |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 34 | #include "S25FS512_RPC.h" |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 35 | #include "S25FS512.h" |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 36 | #include "StringInOut.h" |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 37 | #include "StringHelper.h" |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 38 | #include "Peripherals.h" |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 39 | #include "SDBlockDevice.h" |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 40 | |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 41 | int S25FS512_Reset(char argStrs[32][32], char replyStrs[32][32]) { |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 42 | uint32_t reply[1]; |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 43 | Peripherals::s25FS512()->reset(); |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 44 | reply[0] = 0x80; |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 45 | FormatReply32(reply, sizeof(reply) / sizeof(uint32_t), replyStrs); |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 46 | return 0; |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 47 | } |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 48 | |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 49 | int S25FS512_EnableHWReset(char argStrs[32][32], char replyStrs[32][32]) { |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 50 | uint32_t reply[1]; |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 51 | Peripherals::s25FS512()->enableHWReset(); |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 52 | reply[0] = 0x80; |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 53 | FormatReply32(reply, sizeof(reply) / sizeof(uint32_t), replyStrs); |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 54 | return 0; |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 55 | } |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 56 | |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 57 | int S25FS512_SpiWriteRead(char argStrs[32][32], char replyStrs[32][32]) { |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 58 | uint8_t args[16]; |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 59 | uint8_t reply[16]; |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 60 | uint8_t writeNumber; |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 61 | uint8_t readNumber; |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 62 | // get the number of bytes to write |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 63 | ProcessArgs(argStrs, args, 1); |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 64 | writeNumber = args[0]; |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 65 | ProcessArgs(argStrs, args, writeNumber + 2); |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 66 | readNumber = args[writeNumber + 1]; |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 67 | FormatReply(reply, readNumber, replyStrs); |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 68 | return 0; |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 69 | } |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 70 | |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 71 | int S25FS512_SpiWriteRead4Wire(char argStrs[32][32], char replyStrs[32][32]) { |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 72 | uint8_t args[16]; |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 73 | uint8_t reply[16]; |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 74 | uint8_t writeNumber; |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 75 | uint8_t readNumber; |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 76 | // get the number of bytes to write |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 77 | ProcessArgs(argStrs, args, 1); |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 78 | writeNumber = args[0]; |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 79 | ProcessArgs(argStrs, args, writeNumber + 2); |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 80 | readNumber = args[writeNumber + 1]; |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 81 | FormatReply(reply, readNumber, replyStrs); |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 82 | return 0; |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 83 | } |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 84 | |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 85 | int S25FS512_ReadPage(char argStrs[32][32], char replyStrs[32][32]) { |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 86 | uint32_t args[2]; |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 87 | uint32_t reply[1]; |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 88 | ProcessArgs32(argStrs, args, sizeof(args) / sizeof(uint32_t)); |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 89 | reply[0] = 0x80; |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 90 | FormatReply32(reply, sizeof(reply) / sizeof(uint32_t), replyStrs); |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 91 | return 0; |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 92 | } |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 93 | |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 94 | //int S25FS512_ReadPagesBinary(char argStrs[32][32], char replyStrs[32][32]) { |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 95 | // uint32_t args[2]; |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 96 | // uint32_t reply[1]; |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 97 | // uint8_t pageData[256]; |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 98 | // |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 99 | // uint32_t startPage; |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 100 | // uint32_t endPage; |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 101 | // uint32_t page; |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 102 | // |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 103 | // ProcessArgs32(argStrs, args, sizeof(args) / sizeof(uint32_t)); |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 104 | // startPage = args[0]; |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 105 | // endPage = args[1]; |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 106 | // for (page = startPage; page <= endPage; page++) { |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 107 | // Peripherals::s25FS512()->readPages_Helper(page, page, pageData, 0); |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 108 | // putBytes256Block(pageData, 1); |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 109 | // } |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 110 | // reply[0] = 0x80; |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 111 | // FormatReply32(reply, sizeof(reply) / sizeof(uint32_t), replyStrs); |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 112 | // return 0; |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 113 | //} |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 114 | extern char dataFileName[32]; |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 115 | int S25FS512_ReadPagesBinary(char argStrs[32][32], char replyStrs[32][32]) { |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 116 | uint32_t args[2]; |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 117 | uint32_t reply[1]; |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 118 | uint8_t pageData[256]; |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 119 | |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 120 | uint32_t startPage; |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 121 | uint32_t endPage; |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 122 | uint32_t page; |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 123 | |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 124 | ProcessArgs32(argStrs, args, sizeof(args) / sizeof(uint32_t)); |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 125 | startPage = args[0]; |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 126 | endPage = args[1]; |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 127 | FILE *fp = NULL; |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 128 | fp = fopen(dataFileName, "rb"); |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 129 | for (page = startPage-0x12; page <= endPage-0x12; page++) { |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 130 | memset(pageData, 0xffffffff, sizeof(pageData)); |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 131 | printf("reading from page %d\r\n", page); |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 132 | if (fp != NULL) { |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 133 | fseek(fp,page*256,SEEK_SET); |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 134 | uint8_t count = 0; |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 135 | while(!feof(fp)) |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 136 | { |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 137 | printf("."); |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 138 | pageData[count++] = (unsigned char) fgetc(fp); |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 139 | if (count == 0) break; |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 140 | }; |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 141 | } |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 142 | printf("\r\nEND\r\n"); |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 143 | putBytes256Block(pageData, 1); |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 144 | } |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 145 | if (fp != NULL) fclose(fp); |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 146 | reply[0] = 0x80; |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 147 | FormatReply32(reply, sizeof(reply) / sizeof(uint32_t), replyStrs); |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 148 | return 0; |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 149 | } |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 150 | |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 151 | int S25FS512_ReadId(char argStrs[32][32], char replyStrs[32][32]) { |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 152 | char str[32]; |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 153 | uint8_t data[128]; |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 154 | Peripherals::s25FS512()->readIdentification(data, sizeof(data)); |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 155 | Peripherals::s25FS512()->readIdentification(data, sizeof(data)); |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 156 | sprintf(str, "%02X%02X%02X%02X", data[0], data[1], data[2], data[3]); |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 157 | strcpy(replyStrs[0], str); |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 158 | return 0; |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 159 | } |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 160 | int SDCard_IsReady(char argStrs[32][32], char replyStrs[32][32]) { |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 161 | |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 162 | DigitalIn *detect = Peripherals::SDDetect(); |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 163 | |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 164 | bool isReady = false; |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 165 | |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 166 | if(detect->read()) |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 167 | { |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 168 | isReady = false; |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 169 | strcpy(replyStrs[0], "not_ok"); |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 170 | return 0; |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 171 | } |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 172 | |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 173 | Peripherals::sdFS()->init(); |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 174 | FILE *fp = fopen("/sd/test", "r"); |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 175 | if ( fp != NULL) |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 176 | isReady = true; |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 177 | else |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 178 | { |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 179 | FILE *fp = fopen("/sd/test", "w"); |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 180 | if ( fp != NULL) |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 181 | isReady = true; |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 182 | } |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 183 | |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 184 | if (fp != NULL) fclose(fp); |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 185 | |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 186 | if (isReady) |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 187 | strcpy(replyStrs[0], "ok"); |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 188 | else |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 189 | strcpy(replyStrs[0], "not_ok"); |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 190 | return 0; |
Emre.Eken@IST-LT-35101.maxim-ic.internal | 0:8e4630a71eb1 | 191 | } |