Code for Technion Formula car sensors reader
Dependencies: mbed Buffer FATFileSystem
Fork of SX1272PingPong 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 "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: main.cpp
- Revision:
- 10:7af820d1e1df
- Parent:
- 9:e764990e45df
- Child:
- 13:edb9b443c1dd
--- a/main.cpp Tue Dec 16 12:52:01 2014 +0000 +++ b/main.cpp Thu Nov 26 12:20:56 2015 +0000 @@ -58,10 +58,33 @@ /* * Global variables declarations */ -typedef RadioState States_t; -volatile States_t State = LOWPOWER; +typedef enum +{ + LOWPOWER = 0, + IDLE, + + RX, + RX_TIMEOUT, + RX_ERROR, + + TX, + TX_TIMEOUT, + + CAD, + CAD_DONE +}AppStates_t; -SX1276MB1xAS Radio( OnTxDone, OnTxTimeout, OnRxDone, OnRxTimeout, OnRxError, NULL, NULL ); +volatile AppStates_t State = LOWPOWER; + +/*! + * Radio events function pointer + */ +static RadioEvents_t RadioEvents; + +/* + * Global variables declarations + */ +SX1276MB1xAS Radio( NULL ); const uint8_t PingMsg[] = "PING"; const uint8_t PongMsg[] = "PONG"; @@ -78,6 +101,14 @@ bool isMaster = true; debug( "\n\n\r SX1276 Ping Pong Demo Application \n\n\r" ); + + // Initialize Radio driver + RadioEvents.TxDone = OnTxDone; + RadioEvents.RxDone = OnRxDone; + RadioEvents.RxError = OnRxError; + RadioEvents.TxTimeout = OnTxTimeout; + RadioEvents.RxTimeout = OnRxTimeout; + Radio.Init( &RadioEvents ); // verify the connection with the board while( Radio.Read( REG_VERSION ) == 0x00 )