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
battery.cpp@9:72e93d9ddc8c, 2016-02-29 (annotated)
- Committer:
- dxyang
- Date:
- Mon Feb 29 14:53:35 2016 +0000
- Revision:
- 9:72e93d9ddc8c
- Parent:
- 1:c2232b1eaf31
added posh logging
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 battery. |
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 addrLocker=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 battery |
epgmdm | 1:c2232b1eaf31 | 19 | * fp is the config file if additonal information is needed. |
epgmdm | 1:c2232b1eaf31 | 20 | */ |
epgmdm | 1:c2232b1eaf31 | 21 | void initialiseBattery(FILE *fp){ |
epgmdm | 1:c2232b1eaf31 | 22 | #ifdef debug |
epgmdm | 1:c2232b1eaf31 | 23 | printf("Initialise Battery\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("Battery config: cannot read channel"); |
epgmdm | 1:c2232b1eaf31 | 28 | if (fscanf (fp,"%llx %*c %*s",&addrLocker )!=1) writeError("Battery config: cannot read address"); |
epgmdm | 1:c2232b1eaf31 | 29 | |
epgmdm | 1:c2232b1eaf31 | 30 | #ifdef debug |
epgmdm | 1:c2232b1eaf31 | 31 | printf(" Channel:%x, Address %llx \n\r",channel, addrLocker); |
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 loopBattery(){ |
epgmdm | 1:c2232b1eaf31 | 42 | |
epgmdm | 1:c2232b1eaf31 | 43 | } |