working version of song control with initialization from sd card
Dependencies: MFRC522 NRF2401P SDFileSystem SPI_TFT_ILI9341 TFT_fonts mbed
Fork of Song_Control by
hub.cpp@1:c2232b1eaf31, 2016-01-24 (annotated)
- Committer:
- epgmdm
- Date:
- Sun Jan 24 16:15:53 2016 +0000
- Revision:
- 1:c2232b1eaf31
- Child:
- 2:d1eae91343a9
Basic structure has Hub,Locker,Battery and Test
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
epgmdm | 1:c2232b1eaf31 | 1 | /** |
epgmdm | 1:c2232b1eaf31 | 2 | * All the code associated to run the mbed as a hub. |
epgmdm | 1:c2232b1eaf31 | 3 | * Link with locker |
epgmdm | 1:c2232b1eaf31 | 4 | */ |
epgmdm | 1:c2232b1eaf31 | 5 | #include "mbed.h" |
epgmdm | 1:c2232b1eaf31 | 6 | #include "utils.h" |
epgmdm | 1:c2232b1eaf31 | 7 | #define debug |
epgmdm | 1:c2232b1eaf31 | 8 | |
epgmdm | 1:c2232b1eaf31 | 9 | // Flags |
epgmdm | 1:c2232b1eaf31 | 10 | // Variables |
epgmdm | 1:c2232b1eaf31 | 11 | // tx nRF2401 |
epgmdm | 1:c2232b1eaf31 | 12 | |
epgmdm | 1:c2232b1eaf31 | 13 | long long addrLcker=0xBBBBBBBBBB; |
epgmdm | 1:c2232b1eaf31 | 14 | extern int channel; |
epgmdm | 1:c2232b1eaf31 | 15 | |
epgmdm | 1:c2232b1eaf31 | 16 | // Initializaton |
epgmdm | 1:c2232b1eaf31 | 17 | /** |
epgmdm | 1:c2232b1eaf31 | 18 | * Initialise for a locker |
epgmdm | 1:c2232b1eaf31 | 19 | * fp is the config file if additonal information is needed. |
epgmdm | 1:c2232b1eaf31 | 20 | */ |
epgmdm | 1:c2232b1eaf31 | 21 | void initialiseHub(FILE *fp){ |
epgmdm | 1:c2232b1eaf31 | 22 | #ifdef debug |
epgmdm | 1:c2232b1eaf31 | 23 | printf("Initialise Hub\n\r"); |
epgmdm | 1:c2232b1eaf31 | 24 | #endif |
epgmdm | 1:c2232b1eaf31 | 25 | |
epgmdm | 1:c2232b1eaf31 | 26 | // Read in hub address and channel |
epgmdm | 1:c2232b1eaf31 | 27 | if (fscanf (fp,"%x %*c %*s",&channel )!=1) writeError("Hub config: cannot read channel"); |
epgmdm | 1:c2232b1eaf31 | 28 | if (fscanf (fp,"%llx %*c %*s",&addrLcker )!=1) writeError("Hub config: cannot read hub address"); |
epgmdm | 1:c2232b1eaf31 | 29 | |
epgmdm | 1:c2232b1eaf31 | 30 | #ifdef debug |
epgmdm | 1:c2232b1eaf31 | 31 | printf(" Channel:%x, Hub Address %llx \n\r",channel, addrLcker); |
epgmdm | 1:c2232b1eaf31 | 32 | #endif |
epgmdm | 1:c2232b1eaf31 | 33 | |
epgmdm | 1:c2232b1eaf31 | 34 | |
epgmdm | 1:c2232b1eaf31 | 35 | } |
epgmdm | 1:c2232b1eaf31 | 36 | // Interupt routines |
epgmdm | 1:c2232b1eaf31 | 37 | |
epgmdm | 1:c2232b1eaf31 | 38 | |
epgmdm | 1:c2232b1eaf31 | 39 | // Loop through slow routines |
epgmdm | 1:c2232b1eaf31 | 40 | |
epgmdm | 1:c2232b1eaf31 | 41 | void loopHub(){ |
epgmdm | 1:c2232b1eaf31 | 42 | |
epgmdm | 1:c2232b1eaf31 | 43 | } |