This is code is part of a Technion course project in advanced IoT, implementing a device to read and transmit sensors data from a Formula racing car built by students at Technion - Israel Institute of Technology.
Fork of DISCO-L072CZ-LRWAN1_LoRa_PingPong by
This is code is part of a Technion course project in advanced IoT, implementing a device to read and transmit sensors data from a Formula racing car built by students at Technion - Israel Institute of Technology.
How to install
- Create an account on Mbed: https://os.mbed.com/account/signup/
- Import project into Compiler
- In the Program Workspace select "Formula_Nucleo_Reader"
- Select a Platform like so:
- Click button at top-left
- Add Board
- Search "B-L072Z-LRWAN1" and then "Add to your Mbed Compiler"
- Finally click "Compile", if the build was successful, the binary would download automatically
- To install it on device simply plug it in to a PC, open device drive and drag then drop binary file in it
FATFileSystem/ChaN/diskio.h@12:02d779e8c4f6, 2018-05-19 (annotated)
- Committer:
- wardm
- Date:
- Sat May 19 11:41:10 2018 +0000
- Revision:
- 12:02d779e8c4f6
Code for Technion Formula car sensors reader transmit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
wardm | 12:02d779e8c4f6 | 1 | /*-----------------------------------------------------------------------/ |
wardm | 12:02d779e8c4f6 | 2 | / Low level disk interface modlue include file (C)ChaN, 2014 / |
wardm | 12:02d779e8c4f6 | 3 | /-----------------------------------------------------------------------*/ |
wardm | 12:02d779e8c4f6 | 4 | |
wardm | 12:02d779e8c4f6 | 5 | #ifndef _DISKIO_DEFINED |
wardm | 12:02d779e8c4f6 | 6 | #define _DISKIO_DEFINED |
wardm | 12:02d779e8c4f6 | 7 | |
wardm | 12:02d779e8c4f6 | 8 | #ifdef __cplusplus |
wardm | 12:02d779e8c4f6 | 9 | extern "C" { |
wardm | 12:02d779e8c4f6 | 10 | #endif |
wardm | 12:02d779e8c4f6 | 11 | |
wardm | 12:02d779e8c4f6 | 12 | #define _USE_WRITE 1 /* 1: Enable disk_write function */ |
wardm | 12:02d779e8c4f6 | 13 | #define _USE_IOCTL 1 /* 1: Enable disk_ioctl fucntion */ |
wardm | 12:02d779e8c4f6 | 14 | |
wardm | 12:02d779e8c4f6 | 15 | #include "integer.h" |
wardm | 12:02d779e8c4f6 | 16 | |
wardm | 12:02d779e8c4f6 | 17 | |
wardm | 12:02d779e8c4f6 | 18 | /* Status of Disk Functions */ |
wardm | 12:02d779e8c4f6 | 19 | typedef BYTE DSTATUS; |
wardm | 12:02d779e8c4f6 | 20 | |
wardm | 12:02d779e8c4f6 | 21 | /* Results of Disk Functions */ |
wardm | 12:02d779e8c4f6 | 22 | typedef enum { |
wardm | 12:02d779e8c4f6 | 23 | RES_OK = 0, /* 0: Successful */ |
wardm | 12:02d779e8c4f6 | 24 | RES_ERROR, /* 1: R/W Error */ |
wardm | 12:02d779e8c4f6 | 25 | RES_WRPRT, /* 2: Write Protected */ |
wardm | 12:02d779e8c4f6 | 26 | RES_NOTRDY, /* 3: Not Ready */ |
wardm | 12:02d779e8c4f6 | 27 | RES_PARERR /* 4: Invalid Parameter */ |
wardm | 12:02d779e8c4f6 | 28 | } DRESULT; |
wardm | 12:02d779e8c4f6 | 29 | |
wardm | 12:02d779e8c4f6 | 30 | |
wardm | 12:02d779e8c4f6 | 31 | /*---------------------------------------*/ |
wardm | 12:02d779e8c4f6 | 32 | /* Prototypes for disk control functions */ |
wardm | 12:02d779e8c4f6 | 33 | |
wardm | 12:02d779e8c4f6 | 34 | |
wardm | 12:02d779e8c4f6 | 35 | DSTATUS disk_initialize (BYTE pdrv); |
wardm | 12:02d779e8c4f6 | 36 | DSTATUS disk_status (BYTE pdrv); |
wardm | 12:02d779e8c4f6 | 37 | DRESULT disk_read (BYTE pdrv, BYTE* buff, DWORD sector, UINT count); |
wardm | 12:02d779e8c4f6 | 38 | DRESULT disk_write (BYTE pdrv, const BYTE* buff, DWORD sector, UINT count); |
wardm | 12:02d779e8c4f6 | 39 | DRESULT disk_ioctl (BYTE pdrv, BYTE cmd, void* buff); |
wardm | 12:02d779e8c4f6 | 40 | |
wardm | 12:02d779e8c4f6 | 41 | |
wardm | 12:02d779e8c4f6 | 42 | /* Disk Status Bits (DSTATUS) */ |
wardm | 12:02d779e8c4f6 | 43 | |
wardm | 12:02d779e8c4f6 | 44 | #define STA_NOINIT 0x01 /* Drive not initialized */ |
wardm | 12:02d779e8c4f6 | 45 | #define STA_NODISK 0x02 /* No medium in the drive */ |
wardm | 12:02d779e8c4f6 | 46 | #define STA_PROTECT 0x04 /* Write protected */ |
wardm | 12:02d779e8c4f6 | 47 | |
wardm | 12:02d779e8c4f6 | 48 | |
wardm | 12:02d779e8c4f6 | 49 | /* Command code for disk_ioctrl fucntion */ |
wardm | 12:02d779e8c4f6 | 50 | |
wardm | 12:02d779e8c4f6 | 51 | /* Generic command (Used by FatFs) */ |
wardm | 12:02d779e8c4f6 | 52 | #define CTRL_SYNC 0 /* Complete pending write process (needed at _FS_READONLY == 0) */ |
wardm | 12:02d779e8c4f6 | 53 | #define GET_SECTOR_COUNT 1 /* Get media size (needed at _USE_MKFS == 1) */ |
wardm | 12:02d779e8c4f6 | 54 | #define GET_SECTOR_SIZE 2 /* Get sector size (needed at _MAX_SS != _MIN_SS) */ |
wardm | 12:02d779e8c4f6 | 55 | #define GET_BLOCK_SIZE 3 /* Get erase block size (needed at _USE_MKFS == 1) */ |
wardm | 12:02d779e8c4f6 | 56 | #define CTRL_TRIM 4 /* Inform device that the data on the block of sectors is no longer used (needed at _USE_TRIM == 1) */ |
wardm | 12:02d779e8c4f6 | 57 | |
wardm | 12:02d779e8c4f6 | 58 | /* Generic command (Not used by FatFs) */ |
wardm | 12:02d779e8c4f6 | 59 | #define CTRL_POWER 5 /* Get/Set power status */ |
wardm | 12:02d779e8c4f6 | 60 | #define CTRL_LOCK 6 /* Lock/Unlock media removal */ |
wardm | 12:02d779e8c4f6 | 61 | #define CTRL_EJECT 7 /* Eject media */ |
wardm | 12:02d779e8c4f6 | 62 | #define CTRL_FORMAT 8 /* Create physical format on the media */ |
wardm | 12:02d779e8c4f6 | 63 | |
wardm | 12:02d779e8c4f6 | 64 | /* MMC/SDC specific ioctl command */ |
wardm | 12:02d779e8c4f6 | 65 | #define MMC_GET_TYPE 10 /* Get card type */ |
wardm | 12:02d779e8c4f6 | 66 | #define MMC_GET_CSD 11 /* Get CSD */ |
wardm | 12:02d779e8c4f6 | 67 | #define MMC_GET_CID 12 /* Get CID */ |
wardm | 12:02d779e8c4f6 | 68 | #define MMC_GET_OCR 13 /* Get OCR */ |
wardm | 12:02d779e8c4f6 | 69 | #define MMC_GET_SDSTAT 14 /* Get SD status */ |
wardm | 12:02d779e8c4f6 | 70 | |
wardm | 12:02d779e8c4f6 | 71 | /* ATA/CF specific ioctl command */ |
wardm | 12:02d779e8c4f6 | 72 | #define ATA_GET_REV 20 /* Get F/W revision */ |
wardm | 12:02d779e8c4f6 | 73 | #define ATA_GET_MODEL 21 /* Get model name */ |
wardm | 12:02d779e8c4f6 | 74 | #define ATA_GET_SN 22 /* Get serial number */ |
wardm | 12:02d779e8c4f6 | 75 | |
wardm | 12:02d779e8c4f6 | 76 | #ifdef __cplusplus |
wardm | 12:02d779e8c4f6 | 77 | } |
wardm | 12:02d779e8c4f6 | 78 | #endif |
wardm | 12:02d779e8c4f6 | 79 | |
wardm | 12:02d779e8c4f6 | 80 | #endif |