Treehouse Mbed Team / Mbed 2 deprecated APS_DCM1SL

Dependencies:   mbed

Committer:
mfwic
Date:
Thu Mar 14 00:21:35 2019 +0000
Revision:
52:2b3b194144da
Parent:
51:abe8a392d50b
Added ifdef IS_MASTER & IS_SLAVE; Corrected Slave_RXstr; Added call to Slave_RXstr in loop.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mfwic 42:3ae73b61f657 1 //-------------------------------------------------------------------------------
mfwic 42:3ae73b61f657 2 //
mfwic 42:3ae73b61f657 3 // Treehouse Designs Inc.
mfwic 42:3ae73b61f657 4 // Colorado Springs, Colorado
mfwic 42:3ae73b61f657 5 //
mfwic 42:3ae73b61f657 6 // Copyright (c) 2016 by Treehouse Designs Inc.
mfwic 42:3ae73b61f657 7 // Copyright (c) 2018 by Agility Power Systems Inc.
mfwic 42:3ae73b61f657 8 //
mfwic 42:3ae73b61f657 9 // This code is the property of Treehouse Designs, Inc. (Treehouse) and
mfwic 42:3ae73b61f657 10 // Agility Power Systems Inc. (Agility) and may not be redistributed
mfwic 42:3ae73b61f657 11 // in any form without prior written permission from
mfwic 42:3ae73b61f657 12 // both copyright holders, Treehouse and Agility.
mfwic 42:3ae73b61f657 13 //
mfwic 42:3ae73b61f657 14 // The above copyright notice and this permission notice shall be included in
mfwic 42:3ae73b61f657 15 // all copies or substantial portions of the Software.
mfwic 42:3ae73b61f657 16 //
mfwic 42:3ae73b61f657 17 //
mfwic 42:3ae73b61f657 18 //-------------------------------------------------------------------------------
mfwic 42:3ae73b61f657 19 //
mfwic 42:3ae73b61f657 20 // REVISION HISTORY:
mfwic 42:3ae73b61f657 21 //
mfwic 42:3ae73b61f657 22 // $Author: $
mfwic 42:3ae73b61f657 23 // $Rev: $
mfwic 42:3ae73b61f657 24 // $Date: $
mfwic 42:3ae73b61f657 25 // $URL: $
mfwic 42:3ae73b61f657 26 //
mfwic 42:3ae73b61f657 27 //-------------------------------------------------------------------------------
mfwic 42:3ae73b61f657 28
mfwic 42:3ae73b61f657 29 #ifndef BOARDS_H
mfwic 42:3ae73b61f657 30 #define BOARDS_H
mfwic 42:3ae73b61f657 31
mfwic 42:3ae73b61f657 32 #include "adc_defs.h"
mfwic 42:3ae73b61f657 33
mfwic 52:2b3b194144da 34 extern volatile bool pulseReady;
mfwic 52:2b3b194144da 35
mfwic 52:2b3b194144da 36 const float TEMPERATURE_THRESH = 1000.0;
mfwic 52:2b3b194144da 37 const float FAN_PERIOD = 0.02f;
mfwic 52:2b3b194144da 38
mfwic 42:3ae73b61f657 39 #define VOLTAGE_TOLERANCE 0.1
mfwic 42:3ae73b61f657 40 const unsigned int V48_HI = (unsigned int)ADC_SCALE_FACTOR*(VOLTAGE_48_ACTUAL_VALUE/VOLTAGE_TARG_VALUE)*(1.0+VOLTAGE_TOLERANCE);
mfwic 42:3ae73b61f657 41 const unsigned int V48_LO = (unsigned int)ADC_SCALE_FACTOR*(VOLTAGE_48_ACTUAL_VALUE/VOLTAGE_TARG_VALUE)*(1.0-VOLTAGE_TOLERANCE);
mfwic 42:3ae73b61f657 42 const unsigned int V12_HI = (unsigned int)ADC_SCALE_FACTOR*(VOLTAGE_12_ACTUAL_VALUE/VOLTAGE_TARG_VALUE)*(1.0+VOLTAGE_TOLERANCE);
mfwic 42:3ae73b61f657 43 const unsigned int V12_LO = (unsigned int)ADC_SCALE_FACTOR*(VOLTAGE_12_ACTUAL_VALUE/VOLTAGE_TARG_VALUE)*(1.0-VOLTAGE_TOLERANCE);
mfwic 42:3ae73b61f657 44
mfwic 52:2b3b194144da 45 void setFan(unsigned int temperatureVal);
mfwic 52:2b3b194144da 46
mfwic 42:3ae73b61f657 47 void initBoards(struct adcValues);
mfwic 42:3ae73b61f657 48
mfwic 42:3ae73b61f657 49 extern bool buck;
mfwic 42:3ae73b61f657 50
mfwic 42:3ae73b61f657 51 extern unsigned int boardEnableBits;
mfwic 42:3ae73b61f657 52 extern unsigned int boardsActive;
mfwic 42:3ae73b61f657 53
mfwic 42:3ae73b61f657 54 extern unsigned int en_out_code;
mfwic 42:3ae73b61f657 55 extern unsigned int wr_out_code;
mfwic 42:3ae73b61f657 56
mfwic 42:3ae73b61f657 57
mfwic 42:3ae73b61f657 58 extern unsigned int bCodeRow[];
mfwic 42:3ae73b61f657 59
mfwic 42:3ae73b61f657 60 void setBoardControls(unsigned int);
mfwic 42:3ae73b61f657 61 unsigned int setBoardEnables(unsigned int);
mfwic 42:3ae73b61f657 62 unsigned int setBoardWeights(unsigned int);
mfwic 42:3ae73b61f657 63
mfwic 42:3ae73b61f657 64 int checkRange(int, int, int);
mfwic 42:3ae73b61f657 65
mfwic 42:3ae73b61f657 66 void toggleLatchSignal(void);
mfwic 42:3ae73b61f657 67
mfwic 42:3ae73b61f657 68 void startConverter(unsigned int);
mfwic 42:3ae73b61f657 69 void stopConverter(void);
mfwic 42:3ae73b61f657 70
mfwic 42:3ae73b61f657 71 struct statusValues checkLevels(struct adcValues);
mfwic 44:741ee27c8a34 72 unsigned short updateMasterControls(unsigned short);
mfwic 44:741ee27c8a34 73 void updateSlaveControls(unsigned short);
mfwic 42:3ae73b61f657 74 void XupdateControls(unsigned short);
mfwic 42:3ae73b61f657 75
Slord2142 51:abe8a392d50b 76 //extern DigitalOut Mstr_Tx1(PB_6);
Slord2142 51:abe8a392d50b 77 //DigitalOut Mstr_Tx2(PB_7);
Slord2142 51:abe8a392d50b 78 //InterruptIn Slave_Rx(PB_6);
Slord2142 51:abe8a392d50b 79 //extern InterruptIn Slave_Rx(PB_7);
Slord2142 49:65c714a5def2 80
mfwic 44:741ee27c8a34 81 extern const unsigned short i2c_addr_slave1;
mfwic 44:741ee27c8a34 82 extern const unsigned short i2c_addr_slave2;
mfwic 44:741ee27c8a34 83
mfwic 44:741ee27c8a34 84 void initI2C(void);
mfwic 44:741ee27c8a34 85 unsigned short getMasterCommands(void);
mfwic 44:741ee27c8a34 86 void sendSlaveCommands(unsigned short);
mfwic 44:741ee27c8a34 87
mfwic 42:3ae73b61f657 88 #endif