Treehouse Mbed Team / Mbed 2 deprecated APS_DCM1SL

Dependencies:   mbed

Committer:
mfwic
Date:
Sat Mar 09 21:01:45 2019 +0000
Revision:
42:3ae73b61f657
Parent:
41:bd54c88e3334
Child:
43:291bbdba48f3
Removed V24, I24, I48.; Commented out en_out and wr_out.; Compiles

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mfwic 0:44a3005d4f20 1 //-------------------------------------------------------------------------------
mfwic 0:44a3005d4f20 2 //
mfwic 0:44a3005d4f20 3 // Treehouse Designs Inc.
mfwic 0:44a3005d4f20 4 // Colorado Springs, Colorado
mfwic 0:44a3005d4f20 5 //
Slord2142 41:bd54c88e3334 6 // Copyright (c) 2018 by Treehouse Designs Inc.
mfwic 0:44a3005d4f20 7 // Copyright (c) 2018 by Agility Power Systems Inc.
mfwic 0:44a3005d4f20 8 //
mfwic 0:44a3005d4f20 9 // This code is the property of Treehouse Designs, Inc. (Treehouse) and
mfwic 0:44a3005d4f20 10 // Agility Power Systems Inc. (Agility) and may not be redistributed
mfwic 0:44a3005d4f20 11 // in any form without prior written permission from
mfwic 0:44a3005d4f20 12 // both copyright holders, Treehouse and Agility.
mfwic 0:44a3005d4f20 13 //
mfwic 0:44a3005d4f20 14 // The above copyright notice and this permission notice shall be included in
mfwic 0:44a3005d4f20 15 // all copies or substantial portions of the Software.
mfwic 0:44a3005d4f20 16 //
mfwic 0:44a3005d4f20 17 //
mfwic 0:44a3005d4f20 18 //-------------------------------------------------------------------------------
mfwic 0:44a3005d4f20 19 //
mfwic 0:44a3005d4f20 20 // REVISION HISTORY:
mfwic 0:44a3005d4f20 21 //
mfwic 0:44a3005d4f20 22 // $Author: $
mfwic 0:44a3005d4f20 23 // $Rev: $
mfwic 0:44a3005d4f20 24 // $Date: $
mfwic 0:44a3005d4f20 25 // $URL: $
mfwic 0:44a3005d4f20 26 //
mfwic 0:44a3005d4f20 27 //-------------------------------------------------------------------------------
mfwic 0:44a3005d4f20 28
mfwic 0:44a3005d4f20 29 #include "mbed.h"
mfwic 42:3ae73b61f657 30 #include "math.h"
mfwic 42:3ae73b61f657 31 #include "globals.h"
mfwic 42:3ae73b61f657 32 #include "parameters.h"
mfwic 0:44a3005d4f20 33 #include "all_io.h"
mfwic 42:3ae73b61f657 34 #include "stdio.h"
mfwic 42:3ae73b61f657 35 #include "stdlib.h"
mfwic 42:3ae73b61f657 36 #include "serial.h"
mfwic 42:3ae73b61f657 37 #include "adc.h"
mfwic 42:3ae73b61f657 38 #include "adc_defs.h"
mfwic 42:3ae73b61f657 39 #include "menu.h"
mfwic 42:3ae73b61f657 40 #include "boards.h"
mfwic 42:3ae73b61f657 41 #include "command.h"
mfwic 42:3ae73b61f657 42 #include "clocks.h"
Slord2142 41:bd54c88e3334 43
Slord2142 41:bd54c88e3334 44
Slord2142 41:bd54c88e3334 45 //DigitalOut myled(LED1);
Slord2142 41:bd54c88e3334 46 Ticker slowClk;
Slord2142 41:bd54c88e3334 47 Ticker fastClk;
Slord2142 41:bd54c88e3334 48
mfwic 42:3ae73b61f657 49 unsigned short my12=0;
mfwic 42:3ae73b61f657 50 volatile bool updateReady = FALSE;
mfwic 42:3ae73b61f657 51 unsigned int loopTime = 0;
mfwic 42:3ae73b61f657 52 bool raw = FALSE;
mfwic 42:3ae73b61f657 53 bool running = FALSE;
mfwic 42:3ae73b61f657 54 bool testing = FALSE;
mfwic 42:3ae73b61f657 55 bool buck = TRUE;
mfwic 42:3ae73b61f657 56
mfwic 42:3ae73b61f657 57 double CURRENT_48_OFFSET = 33940;
mfwic 42:3ae73b61f657 58 double CURRENT_24_OFFSET = 33580;
mfwic 42:3ae73b61f657 59 double CURRENT_12_OFFSET = 33256;
mfwic 1:9f8583ba2431 60
Slord2142 41:bd54c88e3334 61 volatile bool dosFlip = FALSE;
Slord2142 41:bd54c88e3334 62 volatile bool dofFlip = FALSE;
Slord2142 41:bd54c88e3334 63
Slord2142 41:bd54c88e3334 64 void slowFlip() {
Slord2142 41:bd54c88e3334 65 dosFlip = TRUE;
Slord2142 41:bd54c88e3334 66 }
Slord2142 41:bd54c88e3334 67
Slord2142 41:bd54c88e3334 68 void fastFlip() {
Slord2142 41:bd54c88e3334 69 dofFlip = TRUE;
Slord2142 41:bd54c88e3334 70 }
mfwic 25:8bcc8bea0e31 71
Slord2142 41:bd54c88e3334 72 int main() {
Slord2142 41:bd54c88e3334 73
Slord2142 41:bd54c88e3334 74 initOut();
Slord2142 41:bd54c88e3334 75
Slord2142 41:bd54c88e3334 76 slowClk.attach(&slowFlip, 0.0003);
Slord2142 41:bd54c88e3334 77 fastClk.attach(&fastFlip, 0.00001);
Slord2142 41:bd54c88e3334 78
Slord2142 41:bd54c88e3334 79 while(1){
Slord2142 41:bd54c88e3334 80 checkFlip();
Slord2142 41:bd54c88e3334 81 }
Slord2142 41:bd54c88e3334 82
Slord2142 41:bd54c88e3334 83 }