test
How can I remove this one?
sdcard.h@0:76d6402d766d, 2019-03-19 (annotated)
- Committer:
- dzbios
- Date:
- Tue Mar 19 14:47:28 2019 +0000
- Revision:
- 0:76d6402d766d
test
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dzbios | 0:76d6402d766d | 1 | /* vim: set ai et ts=4 sw=4: */ |
dzbios | 0:76d6402d766d | 2 | #ifndef __SDCARD_H__ |
dzbios | 0:76d6402d766d | 3 | #define __SDCARD_H__ |
dzbios | 0:76d6402d766d | 4 | |
dzbios | 0:76d6402d766d | 5 | #include "stm32f4xx_hal.h" |
dzbios | 0:76d6402d766d | 6 | |
dzbios | 0:76d6402d766d | 7 | #define SDCARD_SPI_PORT hspi1 |
dzbios | 0:76d6402d766d | 8 | #define SDCARD_CS_Pin GPIO_PIN_3 // Arduino shield: D3 |
dzbios | 0:76d6402d766d | 9 | #define SDCARD_CS_GPIO_Port GPIOB |
dzbios | 0:76d6402d766d | 10 | |
dzbios | 0:76d6402d766d | 11 | extern SPI_HandleTypeDef SDCARD_SPI_PORT; |
dzbios | 0:76d6402d766d | 12 | |
dzbios | 0:76d6402d766d | 13 | // call before initializing any SPI devices |
dzbios | 0:76d6402d766d | 14 | void SDCARD_Unselect(); |
dzbios | 0:76d6402d766d | 15 | |
dzbios | 0:76d6402d766d | 16 | // all procedures return 0 on success, < 0 on failure |
dzbios | 0:76d6402d766d | 17 | |
dzbios | 0:76d6402d766d | 18 | extern int SDCARD_Init(void); |
dzbios | 0:76d6402d766d | 19 | int SDCARD_GetBlocksNumber(uint32_t* num); |
dzbios | 0:76d6402d766d | 20 | int SDCARD_ReadSingleBlock(uint32_t blockNum, uint8_t* buff); // sizeof(buff) == 512! |
dzbios | 0:76d6402d766d | 21 | int SDCARD_WriteSingleBlock(uint32_t blockNum, const uint8_t* buff); // sizeof(buff) == 512! |
dzbios | 0:76d6402d766d | 22 | |
dzbios | 0:76d6402d766d | 23 | // Read Multiple Blocks |
dzbios | 0:76d6402d766d | 24 | int SDCARD_ReadBegin(uint32_t blockNum); |
dzbios | 0:76d6402d766d | 25 | int SDCARD_ReadData(uint8_t* buff); // sizeof(buff) == 512! |
dzbios | 0:76d6402d766d | 26 | int SDCARD_ReadEnd(); |
dzbios | 0:76d6402d766d | 27 | |
dzbios | 0:76d6402d766d | 28 | // Write Multiple Blocks |
dzbios | 0:76d6402d766d | 29 | int SDCARD_WriteBegin(uint32_t blockNum); |
dzbios | 0:76d6402d766d | 30 | int SDCARD_WriteData(const uint8_t* buff); // sizeof(buff) == 512! |
dzbios | 0:76d6402d766d | 31 | int SDCARD_WriteEnd(); |
dzbios | 0:76d6402d766d | 32 | |
dzbios | 0:76d6402d766d | 33 | // TODO: read lock flag? CMD13, SEND_STATUS |
dzbios | 0:76d6402d766d | 34 | |
dzbios | 0:76d6402d766d | 35 | #endif // __SDCARD_H__ |
dzbios | 0:76d6402d766d | 36 |