This is code is part of a Technion course project in advanced IoT, implementing a device to receive and present 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 receive sensors data from another L072CZ-LRWAN1 installed on a Formula racing car (built by students at Technion - Israel Institute of Technology), and sends it to a GUI presenting the data (GUI project: github.com/ward-mattar/TechnionFormulaGUI).
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_Receiver"
- Select a Platform like so:
- Click button at top-left
- Add Board
- Search "NUCLEO F103RB" 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
Diff: SDCard/SDFileSystem.h
- Revision:
- 12:046346a16ff4
diff -r 9d7409ebfa57 -r 046346a16ff4 SDCard/SDFileSystem.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SDCard/SDFileSystem.h Sat May 19 15:42:38 2018 +0000 @@ -0,0 +1,66 @@ +/* mbed Microcontroller Library - SDFileSystem + * Copyright (c) 2008-2009, sford + */ + +// VERY DRAFT CODE!!! + +#ifndef SDFILESYSTEM_H +#define SDFILESYSTEM_H +#include <cstdint> +#include "mbed.h" +#include "FATFileSystem.h" + +/* Class: SDFileSystem + * Access the filesystem on an SD Card using SPI + * + * Example: + * > SDFileSystem sd(p5, p6, p7, p12, "sd"); + * > + * > int main() { + * > FILE *fp = fopen("/sd/myfile.txt", "w"); + * > fprintf(fp, "Hello World!\n"); + * > fclose(fp); + * > } + */ +class SDFileSystem : public FATFileSystem { +public: + + /* Constructor: SDFileSystem + * Create the File System for accessing an SD Card using SPI + * + * Variables: + * mosi - SPI mosi pin connected to SD Card + * miso - SPI miso pin conencted to SD Card + * sclk - SPI sclk pin connected to SD Card + * cs - DigitalOut pin used as SD Card chip select + * name - The name used to access the filesystem + */ + SDFileSystem(PinName mosi, PinName miso, PinName sclk, PinName cs, const char* name); + virtual int disk_initialize(); + virtual int disk_write(const char *buffer, int block_number); + virtual int disk_read(char *buffer, int block_number); + virtual int disk_status(); + virtual int disk_sync(); +virtual std::uint32_t disk_sectors(); + +protected: + + int _cmd(int cmd, int arg); + int _cmdx(int cmd, int arg); + int _cmd8(); + int _cmd58(); + int initialise_card(); + int initialise_card_v1(); + int initialise_card_v2(); + + + int _read(char *buffer, int length); + int _write(const char *buffer, int length); + int _sd_sectors(); + int _sectors; + + SPI _spi; + DigitalOut _cs; +}; + +#endif