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
Diff: src/lut.cpp
- Revision:
- 11:01dcfb29fbc4
- Parent:
- 9:816b9a4e4f21
- Child:
- 17:454afe56eedb
--- a/src/lut.cpp Fri Dec 07 17:39:01 2018 +0000
+++ b/src/lut.cpp Fri Dec 07 20:42:41 2018 +0000
@@ -31,66 +31,22 @@
#include "globals.h"
#include "lut.h"
-//unsigned int binCode[6];
-/*
-#define MAX_LUT_ENTRIES 1024
-
-uint8_t binC[MAX_LUT_ENTRIES] { 0, 1, 3, 5, 7, 9, 11, 13, 15, 17, 19};
-uint8_t thermC[MAX_LUT_ENTRIES]{ 0, 0, 1, 1, 2, 2, 3, 3, 4, 5};
-*/
+unsigned int binCode[WEIGHT_BIN_WIDTH+1];
+unsigned int thermCode[BOARDS_THERMCODE_WIDTH+1];
#include "lut_data_en_v1.h"
#include "lut_data_slot_v1.h"
/*******************************************************************************
-dec2bin_fix - Converts decimal to binary with fixed width as specified.
-*******************************************************************************/
-void dec2bin_fix(unsigned int dec, unsigned int n){
- int k;
-
- for (int c = 5; c >= 0; c--){
- k = dec >> c;
- if (k & 1)
- binCode[n] = 1;
- else
- binCode[n] = 0;
- n--;
- }
-}
-
-/*******************************************************************************
-dec2therm_fix - Converts decimal to thermometer code with fixed width as specified.
-*******************************************************************************/
-void dec2therm_fix(unsigned int dec, unsigned int n){
- for (int i = 0; i <= n; i++){
- thermCode[i] = 0;
- }
-
- for (int i = 0; i <= dec; i++){
- thermCode[i] = 1;
- }
-}
-
-/*******************************************************************************
-getLUTcode - gets output codes from LUT using row reference.
-*******************************************************************************/
-void getLUTcode(unsigned short row){
-
- dec2bin_fix(binC[row], (unsigned int)WEIGHT_BIN_WIDTH);
- dec2therm_fix(thermC[row], (unsigned int)BOARDS_THERMCODE_WIDTH);
-
-}
-
-/*******************************************************************************
getLUT_binCode - gets output codes from LUT using row reference.
*******************************************************************************/
unsigned int getLUT_binCode(unsigned short row){
- return binC[row];
+ return binC[row/LUT_SCALE_FACTOR];
}
/*******************************************************************************
getLUT_binCode - gets output codes from LUT using row reference.
*******************************************************************************/
unsigned int getLUT_thermCode(unsigned short row){
- return thermC[row];
+ return thermC[row/LUT_SCALE_FACTOR];
}
\ No newline at end of file