Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
lut.cpp
00001 //------------------------------------------------------------------------------- 00002 // 00003 // Treehouse Designs Inc. 00004 // Colorado Springs, Colorado 00005 // 00006 // Copyright (c) 2016 by Treehouse Designs Inc. 00007 // Copyright (c) 2018 by Agility Power Systems Inc. 00008 // 00009 // This code is the property of Treehouse Designs, Inc. (Treehouse) and 00010 // Agility Power Systems Inc. (Agility) and may not be redistributed 00011 // in any form without prior written permission from 00012 // both copyright holders, Treehouse and Agility. 00013 // 00014 // The above copyright notice and this permission notice shall be included in 00015 // all copies or substantial portions of the Software. 00016 // 00017 // 00018 //------------------------------------------------------------------------------- 00019 // 00020 // REVISION HISTORY: 00021 // 00022 // $Author: $ 00023 // $Rev: $ 00024 // $Date: $ 00025 // $URL: $ 00026 // 00027 //------------------------------------------------------------------------------- 00028 00029 #include "mbed.h" 00030 #include "stdint.h" 00031 #include "globals.h" 00032 #include "lut.h" 00033 00034 unsigned int binCode[WEIGHT_BIN_WIDTH+1]; 00035 unsigned int thermCode[BOARDS_THERMCODE_WIDTH+1]; 00036 00037 #include "lut_data_en_v1p5_1.h" 00038 #include "lut_data_slot_v1p5_1.h" 00039 00040 //#include "lut_data_en_v1p5_2.h" 00041 //#include "lut_data_slot_v1p5_2.h" 00042 00043 //#include "lut_data_en_v1p5_3.h" 00044 //#include "lut_data_slot_v1p5_3.h" 00045 00046 //#include "lut_data_en_v1p5_12.h" 00047 //#include "lut_data_slot_v1p5_12.h" 00048 00049 //#include "lut_data_en_v1p5_13.h" 00050 //#include "lut_data_slot_v1p5_13.h" 00051 00052 /******************************************************************************* 00053 getLUT_binCodeArray - gets output codes from LUT using row reference. 00054 *******************************************************************************/ 00055 void getLUT_binCodeArray(unsigned short row){ 00056 switch(max_boards) { 00057 case 1 : 00058 if(row<MAX_LUT_ENTRIES_1){ 00059 for(unsigned int b=0;b<max_boards;b++){ 00060 bCodeRow[b] = binC_1[row]; 00061 } 00062 }else{ 00063 for(unsigned int b=0;b<max_boards;b++){ 00064 bCodeRow[b] = binC_1[MAX_LUT_ENTRIES_1-1]; 00065 } 00066 } 00067 break; 00068 /*case 2 : 00069 if(row<MAX_LUT_ENTRIES_2){ 00070 for(unsigned int b=0;b<max_boards;b++){ 00071 bCodeRow[b] = binC_2[row][b]; 00072 } 00073 }else{ 00074 for(unsigned int b=0;b<max_boards;b++){ 00075 bCodeRow[b] = binC_2[MAX_LUT_ENTRIES_2-1][b]; 00076 } 00077 } 00078 break; 00079 case 3 : 00080 if(row<MAX_LUT_ENTRIES_3){ 00081 for(unsigned int b=0;b<max_boards;b++){ 00082 bCodeRow[b] = binC_3[row][b]; 00083 } 00084 }else{ 00085 for(unsigned int b=0;b<max_boards;b++){ 00086 bCodeRow[b] = binC_3[MAX_LUT_ENTRIES_3-1][b]; 00087 } 00088 } 00089 break; 00090 default : 00091 if(row<MAX_LUT_ENTRIES_3){ 00092 for(unsigned int b=0;b<max_boards;b++){ 00093 bCodeRow[b] = binC_3[row][b]; 00094 } 00095 }else{ 00096 for(unsigned int b=0;b<max_boards;b++){ 00097 bCodeRow[b] = binC_3[MAX_LUT_ENTRIES_3-1][b]; 00098 } 00099 }*/ 00100 } 00101 } 00102 00103 /******************************************************************************* 00104 getLUT_binCode - gets output codes from LUT using row reference. 00105 *******************************************************************************/ 00106 unsigned int getLUT_binCode(unsigned short row){ 00107 unsigned int binC; 00108 /*switch(max_boards) { 00109 case 12 : 00110 if(row<MAX_LUT_ENTRIES_12){ 00111 binC = binC_12[row]; 00112 }else{ 00113 binC = binC_12[MAX_LUT_ENTRIES_12-1]; 00114 } 00115 break; 00116 case 13 : 00117 if(row<MAX_LUT_ENTRIES_13){ 00118 binC = binC_13[row]; 00119 }else{ 00120 binC = binC_13[MAX_LUT_ENTRIES_13-1]; 00121 } 00122 break; 00123 default : 00124 if(row<MAX_LUT_ENTRIES_13){ 00125 binC = binC_13[row]; 00126 }else{ 00127 binC = binC_13[MAX_LUT_ENTRIES_13-1]; 00128 } 00129 }*/ 00130 return binC; 00131 } 00132 00133 /******************************************************************************* 00134 getLUT_binCode - gets output codes from LUT using row reference. 00135 *******************************************************************************/ 00136 unsigned int getLUT_thermCode(unsigned short row){ 00137 unsigned int thermC; 00138 switch(max_boards) { 00139 case 1 : 00140 if(row<MAX_LUT_ENTRIES_1){ 00141 thermC = thermC_1[row]; 00142 }else{ 00143 thermC = thermC_1[MAX_LUT_ENTRIES_1-1]; 00144 } 00145 break; 00146 /*case 2 : 00147 if(row<MAX_LUT_ENTRIES_2){ 00148 thermC = thermC_2[row]; 00149 }else{ 00150 thermC = thermC_2[MAX_LUT_ENTRIES_2-1]; 00151 } 00152 break; 00153 case 3 : 00154 if(row<MAX_LUT_ENTRIES_3){ 00155 thermC = thermC_3[row]; 00156 }else{ 00157 thermC = thermC_3[MAX_LUT_ENTRIES_3-1]; 00158 } 00159 break; 00160 case 12 : 00161 if(row<MAX_LUT_ENTRIES_12){ 00162 thermC = thermC_12[row]; 00163 }else{ 00164 thermC = thermC_12[MAX_LUT_ENTRIES_12-1]; 00165 } 00166 break; 00167 case 13 : 00168 if(row<MAX_LUT_ENTRIES_13){ 00169 thermC = thermC_13[row]; 00170 }else{ 00171 thermC = thermC_13[MAX_LUT_ENTRIES_13-1]; 00172 } 00173 break; 00174 default : 00175 if(row<MAX_LUT_ENTRIES_13){ 00176 thermC = thermC_13[row]; 00177 }else{ 00178 thermC = thermC_13[MAX_LUT_ENTRIES_13-1]; 00179 }*/ 00180 } 00181 return thermC; 00182 }
Generated on Tue Dec 6 2022 18:48:20 by
1.7.2