[4.4.2] Remove 15 m/s limit on estimated vario (#12788)
[betaflight.git] / src / main / drivers / sdcard.h
blob11c9fac4d3e6ad98b1d404b3501a3c953f7aaf26
1 /*
2 * This file is part of Cleanflight and Betaflight.
4 * Cleanflight and Betaflight are free software. You can redistribute
5 * this software and/or modify this software under the terms of the
6 * GNU General Public License as published by the Free Software
7 * Foundation, either version 3 of the License, or (at your option)
8 * any later version.
10 * Cleanflight and Betaflight are distributed in the hope that they
11 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
12 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * See the GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this software.
18 * If not, see <http://www.gnu.org/licenses/>.
21 #pragma once
23 #include <stdint.h>
24 #include <stdbool.h>
26 #include "pg/sdcard.h"
28 typedef struct sdcardMetadata_s {
29 uint32_t numBlocks; /* Card capacity in 512-byte blocks*/
30 uint16_t oemID;
31 uint8_t manufacturerID;
33 char productName[5];
35 uint32_t productSerial;
36 uint8_t productRevisionMajor;
37 uint8_t productRevisionMinor;
39 uint16_t productionYear;
40 uint8_t productionMonth;
41 } sdcardMetadata_t;
43 typedef enum {
44 SDCARD_BLOCK_OPERATION_READ,
45 SDCARD_BLOCK_OPERATION_WRITE,
46 SDCARD_BLOCK_OPERATION_ERASE
47 } sdcardBlockOperation_e;
49 typedef enum {
50 SDCARD_OPERATION_IN_PROGRESS,
51 SDCARD_OPERATION_BUSY,
52 SDCARD_OPERATION_SUCCESS,
53 SDCARD_OPERATION_FAILURE
54 } sdcardOperationStatus_e;
56 typedef void(*sdcard_operationCompleteCallback_c)(sdcardBlockOperation_e operation, uint32_t blockIndex, uint8_t *buffer, uint32_t callbackData);
58 typedef void(*sdcard_profilerCallback_c)(sdcardBlockOperation_e operation, uint32_t blockIndex, uint32_t duration);
60 void sdcard_preInit(const sdcardConfig_t *config);
61 void sdcard_init(const sdcardConfig_t *config);
63 bool sdcard_readBlock(uint32_t blockIndex, uint8_t *buffer, sdcard_operationCompleteCallback_c callback, uint32_t callbackData);
65 sdcardOperationStatus_e sdcard_beginWriteBlocks(uint32_t blockIndex, uint32_t blockCount);
66 sdcardOperationStatus_e sdcard_writeBlock(uint32_t blockIndex, uint8_t *buffer, sdcard_operationCompleteCallback_c callback, uint32_t callbackData);
68 bool sdcard_isInserted(void);
69 bool sdcard_isInitialized(void);
70 bool sdcard_isFunctional(void);
72 bool sdcard_poll(void);
73 const sdcardMetadata_t* sdcard_getMetadata(void);
75 void sdcard_setProfilerCallback(sdcard_profilerCallback_c callback);