Treehouse Mbed Team / Mbed 2 deprecated APS_1U5x

Dependencies:   mbed

Committer:
mfwic
Date:
Mon Oct 18 22:07:14 2021 +0000
Revision:
27:650cffb6c8ff
Parent:
25:8bcc8bea0e31
Test publish

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mfwic 4:db38665c3727 1 //-------------------------------------------------------------------------------
mfwic 4:db38665c3727 2 //
mfwic 4:db38665c3727 3 // Treehouse Designs Inc.
mfwic 4:db38665c3727 4 // Colorado Springs, Colorado
mfwic 4:db38665c3727 5 //
mfwic 4:db38665c3727 6 // Copyright (c) 2016 by Treehouse Designs Inc.
mfwic 4:db38665c3727 7 // Copyright (c) 2018 by Agility Power Systems Inc.
mfwic 4:db38665c3727 8 //
mfwic 4:db38665c3727 9 // This code is the property of Treehouse Designs, Inc. (Treehouse) and
mfwic 4:db38665c3727 10 // Agility Power Systems Inc. (Agility) and may not be redistributed
mfwic 4:db38665c3727 11 // in any form without prior written permission from
mfwic 4:db38665c3727 12 // both copyright holders, Treehouse and Agility.
mfwic 4:db38665c3727 13 //
mfwic 4:db38665c3727 14 // The above copyright notice and this permission notice shall be included in
mfwic 4:db38665c3727 15 // all copies or substantial portions of the Software.
mfwic 4:db38665c3727 16 //
mfwic 4:db38665c3727 17 //
mfwic 4:db38665c3727 18 //-------------------------------------------------------------------------------
mfwic 4:db38665c3727 19 //
mfwic 4:db38665c3727 20 // REVISION HISTORY:
mfwic 4:db38665c3727 21 //
mfwic 4:db38665c3727 22 // $Author: $
mfwic 4:db38665c3727 23 // $Rev: $
mfwic 4:db38665c3727 24 // $Date: $
mfwic 4:db38665c3727 25 // $URL: $
mfwic 4:db38665c3727 26 //
mfwic 4:db38665c3727 27 //-------------------------------------------------------------------------------
mfwic 4:db38665c3727 28
mfwic 4:db38665c3727 29 #include "mbed.h"
mfwic 5:09be5bbb5020 30 #include "stdint.h"
mfwic 6:39442d493098 31 #include "globals.h"
mfwic 4:db38665c3727 32 #include "lut.h"
mfwic 4:db38665c3727 33
mfwic 11:01dcfb29fbc4 34 unsigned int binCode[WEIGHT_BIN_WIDTH+1];
mfwic 11:01dcfb29fbc4 35 unsigned int thermCode[BOARDS_THERMCODE_WIDTH+1];
mfwic 9:816b9a4e4f21 36
mfwic 25:8bcc8bea0e31 37 #include "lut_data_en_v1p5_1.h"
mfwic 25:8bcc8bea0e31 38 #include "lut_data_slot_v1p5_1.h"
mfwic 18:78e982f31c6b 39
mfwic 27:650cffb6c8ff 40 //#include "lut_data_en_v1p5_2.h"
mfwic 27:650cffb6c8ff 41 //#include "lut_data_slot_v1p5_2.h"
mfwic 25:8bcc8bea0e31 42
mfwic 27:650cffb6c8ff 43 //#include "lut_data_en_v1p5_3.h"
mfwic 27:650cffb6c8ff 44 //#include "lut_data_slot_v1p5_3.h"
mfwic 25:8bcc8bea0e31 45
mfwic 27:650cffb6c8ff 46 //#include "lut_data_en_v1p5_12.h"
mfwic 27:650cffb6c8ff 47 //#include "lut_data_slot_v1p5_12.h"
mfwic 25:8bcc8bea0e31 48
mfwic 27:650cffb6c8ff 49 //#include "lut_data_en_v1p5_13.h"
mfwic 27:650cffb6c8ff 50 //#include "lut_data_slot_v1p5_13.h"
mfwic 25:8bcc8bea0e31 51
mfwic 25:8bcc8bea0e31 52 /*******************************************************************************
mfwic 25:8bcc8bea0e31 53 getLUT_binCodeArray - gets output codes from LUT using row reference.
mfwic 25:8bcc8bea0e31 54 *******************************************************************************/
mfwic 25:8bcc8bea0e31 55 void getLUT_binCodeArray(unsigned short row){
mfwic 25:8bcc8bea0e31 56 switch(max_boards) {
mfwic 25:8bcc8bea0e31 57 case 1 :
mfwic 25:8bcc8bea0e31 58 if(row<MAX_LUT_ENTRIES_1){
mfwic 25:8bcc8bea0e31 59 for(unsigned int b=0;b<max_boards;b++){
mfwic 25:8bcc8bea0e31 60 bCodeRow[b] = binC_1[row];
mfwic 25:8bcc8bea0e31 61 }
mfwic 25:8bcc8bea0e31 62 }else{
mfwic 25:8bcc8bea0e31 63 for(unsigned int b=0;b<max_boards;b++){
mfwic 25:8bcc8bea0e31 64 bCodeRow[b] = binC_1[MAX_LUT_ENTRIES_1-1];
mfwic 25:8bcc8bea0e31 65 }
mfwic 25:8bcc8bea0e31 66 }
mfwic 25:8bcc8bea0e31 67 break;
mfwic 27:650cffb6c8ff 68 /*case 2 :
mfwic 25:8bcc8bea0e31 69 if(row<MAX_LUT_ENTRIES_2){
mfwic 25:8bcc8bea0e31 70 for(unsigned int b=0;b<max_boards;b++){
mfwic 25:8bcc8bea0e31 71 bCodeRow[b] = binC_2[row][b];
mfwic 25:8bcc8bea0e31 72 }
mfwic 25:8bcc8bea0e31 73 }else{
mfwic 25:8bcc8bea0e31 74 for(unsigned int b=0;b<max_boards;b++){
mfwic 25:8bcc8bea0e31 75 bCodeRow[b] = binC_2[MAX_LUT_ENTRIES_2-1][b];
mfwic 25:8bcc8bea0e31 76 }
mfwic 25:8bcc8bea0e31 77 }
mfwic 25:8bcc8bea0e31 78 break;
mfwic 25:8bcc8bea0e31 79 case 3 :
mfwic 25:8bcc8bea0e31 80 if(row<MAX_LUT_ENTRIES_3){
mfwic 25:8bcc8bea0e31 81 for(unsigned int b=0;b<max_boards;b++){
mfwic 25:8bcc8bea0e31 82 bCodeRow[b] = binC_3[row][b];
mfwic 25:8bcc8bea0e31 83 }
mfwic 25:8bcc8bea0e31 84 }else{
mfwic 25:8bcc8bea0e31 85 for(unsigned int b=0;b<max_boards;b++){
mfwic 25:8bcc8bea0e31 86 bCodeRow[b] = binC_3[MAX_LUT_ENTRIES_3-1][b];
mfwic 25:8bcc8bea0e31 87 }
mfwic 25:8bcc8bea0e31 88 }
mfwic 25:8bcc8bea0e31 89 break;
mfwic 25:8bcc8bea0e31 90 default :
mfwic 25:8bcc8bea0e31 91 if(row<MAX_LUT_ENTRIES_3){
mfwic 25:8bcc8bea0e31 92 for(unsigned int b=0;b<max_boards;b++){
mfwic 25:8bcc8bea0e31 93 bCodeRow[b] = binC_3[row][b];
mfwic 25:8bcc8bea0e31 94 }
mfwic 25:8bcc8bea0e31 95 }else{
mfwic 25:8bcc8bea0e31 96 for(unsigned int b=0;b<max_boards;b++){
mfwic 25:8bcc8bea0e31 97 bCodeRow[b] = binC_3[MAX_LUT_ENTRIES_3-1][b];
mfwic 25:8bcc8bea0e31 98 }
mfwic 27:650cffb6c8ff 99 }*/
mfwic 25:8bcc8bea0e31 100 }
mfwic 25:8bcc8bea0e31 101 }
mfwic 5:09be5bbb5020 102
mfwic 6:39442d493098 103 /*******************************************************************************
mfwic 6:39442d493098 104 getLUT_binCode - gets output codes from LUT using row reference.
mfwic 6:39442d493098 105 *******************************************************************************/
mfwic 6:39442d493098 106 unsigned int getLUT_binCode(unsigned short row){
mfwic 25:8bcc8bea0e31 107 unsigned int binC;
mfwic 27:650cffb6c8ff 108 /*switch(max_boards) {
mfwic 25:8bcc8bea0e31 109 case 12 :
mfwic 25:8bcc8bea0e31 110 if(row<MAX_LUT_ENTRIES_12){
mfwic 25:8bcc8bea0e31 111 binC = binC_12[row];
mfwic 25:8bcc8bea0e31 112 }else{
mfwic 25:8bcc8bea0e31 113 binC = binC_12[MAX_LUT_ENTRIES_12-1];
mfwic 25:8bcc8bea0e31 114 }
mfwic 25:8bcc8bea0e31 115 break;
mfwic 25:8bcc8bea0e31 116 case 13 :
mfwic 25:8bcc8bea0e31 117 if(row<MAX_LUT_ENTRIES_13){
mfwic 25:8bcc8bea0e31 118 binC = binC_13[row];
mfwic 25:8bcc8bea0e31 119 }else{
mfwic 25:8bcc8bea0e31 120 binC = binC_13[MAX_LUT_ENTRIES_13-1];
mfwic 25:8bcc8bea0e31 121 }
mfwic 25:8bcc8bea0e31 122 break;
mfwic 25:8bcc8bea0e31 123 default :
mfwic 25:8bcc8bea0e31 124 if(row<MAX_LUT_ENTRIES_13){
mfwic 25:8bcc8bea0e31 125 binC = binC_13[row];
mfwic 25:8bcc8bea0e31 126 }else{
mfwic 25:8bcc8bea0e31 127 binC = binC_13[MAX_LUT_ENTRIES_13-1];
mfwic 25:8bcc8bea0e31 128 }
mfwic 27:650cffb6c8ff 129 }*/
mfwic 25:8bcc8bea0e31 130 return binC;
mfwic 6:39442d493098 131 }
mfwic 4:db38665c3727 132
mfwic 6:39442d493098 133 /*******************************************************************************
mfwic 6:39442d493098 134 getLUT_binCode - gets output codes from LUT using row reference.
mfwic 6:39442d493098 135 *******************************************************************************/
mfwic 6:39442d493098 136 unsigned int getLUT_thermCode(unsigned short row){
mfwic 25:8bcc8bea0e31 137 unsigned int thermC;
mfwic 25:8bcc8bea0e31 138 switch(max_boards) {
mfwic 25:8bcc8bea0e31 139 case 1 :
mfwic 25:8bcc8bea0e31 140 if(row<MAX_LUT_ENTRIES_1){
mfwic 25:8bcc8bea0e31 141 thermC = thermC_1[row];
mfwic 25:8bcc8bea0e31 142 }else{
mfwic 25:8bcc8bea0e31 143 thermC = thermC_1[MAX_LUT_ENTRIES_1-1];
mfwic 25:8bcc8bea0e31 144 }
mfwic 25:8bcc8bea0e31 145 break;
mfwic 27:650cffb6c8ff 146 /*case 2 :
mfwic 25:8bcc8bea0e31 147 if(row<MAX_LUT_ENTRIES_2){
mfwic 25:8bcc8bea0e31 148 thermC = thermC_2[row];
mfwic 25:8bcc8bea0e31 149 }else{
mfwic 25:8bcc8bea0e31 150 thermC = thermC_2[MAX_LUT_ENTRIES_2-1];
mfwic 25:8bcc8bea0e31 151 }
mfwic 25:8bcc8bea0e31 152 break;
mfwic 25:8bcc8bea0e31 153 case 3 :
mfwic 25:8bcc8bea0e31 154 if(row<MAX_LUT_ENTRIES_3){
mfwic 25:8bcc8bea0e31 155 thermC = thermC_3[row];
mfwic 25:8bcc8bea0e31 156 }else{
mfwic 25:8bcc8bea0e31 157 thermC = thermC_3[MAX_LUT_ENTRIES_3-1];
mfwic 25:8bcc8bea0e31 158 }
mfwic 25:8bcc8bea0e31 159 break;
mfwic 25:8bcc8bea0e31 160 case 12 :
mfwic 25:8bcc8bea0e31 161 if(row<MAX_LUT_ENTRIES_12){
mfwic 25:8bcc8bea0e31 162 thermC = thermC_12[row];
mfwic 25:8bcc8bea0e31 163 }else{
mfwic 25:8bcc8bea0e31 164 thermC = thermC_12[MAX_LUT_ENTRIES_12-1];
mfwic 25:8bcc8bea0e31 165 }
mfwic 25:8bcc8bea0e31 166 break;
mfwic 25:8bcc8bea0e31 167 case 13 :
mfwic 25:8bcc8bea0e31 168 if(row<MAX_LUT_ENTRIES_13){
mfwic 25:8bcc8bea0e31 169 thermC = thermC_13[row];
mfwic 25:8bcc8bea0e31 170 }else{
mfwic 25:8bcc8bea0e31 171 thermC = thermC_13[MAX_LUT_ENTRIES_13-1];
mfwic 25:8bcc8bea0e31 172 }
mfwic 25:8bcc8bea0e31 173 break;
mfwic 25:8bcc8bea0e31 174 default :
mfwic 25:8bcc8bea0e31 175 if(row<MAX_LUT_ENTRIES_13){
mfwic 25:8bcc8bea0e31 176 thermC = thermC_13[row];
mfwic 25:8bcc8bea0e31 177 }else{
mfwic 25:8bcc8bea0e31 178 thermC = thermC_13[MAX_LUT_ENTRIES_13-1];
mfwic 27:650cffb6c8ff 179 }*/
mfwic 25:8bcc8bea0e31 180 }
mfwic 25:8bcc8bea0e31 181 return thermC;
mfwic 4:db38665c3727 182 }