Treehouse Mbed Team / Mbed 2 deprecated APS_DCM1SL2

Dependencies:   mbed

inc/globals.h

Committer:
mfwic
Date:
2018-12-07
Revision:
9:816b9a4e4f21
Parent:
8:d3d7dca419b3
Child:
10:6c3233b03658

File content as of revision 9:816b9a4e4f21:

//-------------------------------------------------------------------------------
// 
//  Treehouse Designs Inc.
//  Colorado Springs, Colorado
// 
//  Copyright (c) 2016 by Treehouse Designs Inc. 
//  Copyright (c) 2018 by Agility Power Systems Inc. 
// 
//  This code is the property of Treehouse Designs, Inc. (Treehouse) and
//  Agility Power Systems Inc. (Agility) and may not be redistributed
//  in any form without prior written permission from 
//  both copyright holders, Treehouse and Agility.
//
//  The above copyright notice and this permission notice shall be included in
//  all copies or substantial portions of the Software.
// 
//   
//-------------------------------------------------------------------------------
// 
//  REVISION HISTORY:
//  
//   $Author: $
//   $Rev: $
//   $Date: $
//   $URL: $
// 
//-------------------------------------------------------------------------------

#ifndef GLOBALS_H
#define GLOBALS_H

//#define DEBUG_TEST 1
#ifdef DEBUG_TEST
#define DEBUG 1
#else
#define DEBUG 0
#endif

#define TRUE  1
#define FALSE 0

#define GET FALSE
#define SET TRUE

#define NO_PROMPT FALSE
#define WITH_PROMPT TRUE

#define ON  1
#define OFF 0

#define UPDATE_REFRESH_DELAY_US 500000.0
const unsigned int LOOP_COUNTER = 500000.0/500;

#define ADC_MAX_VALUE 65536
const unsigned int ADC_SCALE_FACTOR = ADC_MAX_VALUE/2;
#define MAX_LUT_ENTRIES 1024
const unsigned int ADC_RESULT_SCALE_FACTOR = ADC_MAX_VALUE/MAX_LUT_ENTRIES;

#define VOLTAGE_TARG_VALUE 1.65
#define VOLTAGE_ACTUAL_VALUE 1.52
const double VOLTAGE_CORRECTION = VOLTAGE_TARG_VALUE/VOLTAGE_ACTUAL_VALUE/ADC_SCALE_FACTOR;
const double VOLTAGE_48_FACTOR = 48.0*VOLTAGE_CORRECTION;
const double VOLTAGE_24_FACTOR = 24.0*VOLTAGE_CORRECTION;
const double VOLTAGE_12_FACTOR = 12.0*VOLTAGE_CORRECTION;

#define CURRENT_ACTUAL_VALUE 1.7091
#define CURRENT_TARG_VALUE 1.65
//const double CURRENT_OFFSET = (CURRENT_ACTUAL_VALUE/CURRENT_TARG_VALUE)*ADC_SCALE_FACTOR;
const double CURRENT_48_OFFSET = 33940;
const double CURRENT_24_OFFSET = 33580;
const double CURRENT_12_OFFSET = 33380;
//#define CURRENT_OFFSET 33940
//#define CURRENT_DIV_FACTOR -390
#define CURRENT_48_DIV_FACTOR -368
#define CURRENT_24_DIV_FACTOR -308
#define CURRENT_12_DIV_FACTOR -324
#define CURRENT_CONTROL_OFFSET 0.25

#define DATA_ROW 1

#define BOARD_ENABLE_DELAY_MS 50

#define ALLON 0x1FFF
const int allon[] = {1,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,1};
#define ALLOFF 0x0000
const int alloff[] = {0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0};

#define MAX_BOARDS 12
#define MAX_REGISTERS 1

#define WEIGHT_BIN_WIDTH 5
#define BOARDS_THERMCODE_WIDTH 11

extern int menuLevel;

#define LEVEL_MAIN 0

extern void processCommand(void);

#endif