Dummy program to demonstrate problems: working code
Dependencies: SLCD mbed-rtos mbed
Fork of MNG_TC by
interleave.h
00001 void interleave( unsigned char *input, unsigned char *output ){ 00002 00003 unsigned int outState = 0; 00004 unsigned int outByte = 0; 00005 00006 for( unsigned int i = 0 ; i < 36 ; ++i ){ 00007 for(unsigned int j = 0 ; j < 30 ; ++j){ 00008 unsigned int x = j*36+i; 00009 unsigned char tempBit = ((input[x >> 3]) >> (7-(x % 8))) & 1; 00010 switch(outState){ 00011 case 0: 00012 outState = 1; 00013 output[outByte] = tempBit << 7; 00014 break; 00015 case 1: 00016 outState = 2; 00017 output[outByte] += tempBit << 6; 00018 break; 00019 case 2: 00020 outState = 3; 00021 output[outByte] += tempBit << 5; 00022 break; 00023 case 3: 00024 outState = 4; 00025 output[outByte] += tempBit << 4; 00026 break; 00027 case 4: 00028 outState = 5; 00029 output[outByte] += tempBit << 3; 00030 break; 00031 case 5: 00032 outState = 6; 00033 output[outByte] += tempBit << 2; 00034 break; 00035 case 6: 00036 outState = 7; 00037 output[outByte] += tempBit << 1; 00038 break; 00039 case 7: 00040 outState = 0; 00041 output[outByte] += tempBit; 00042 ++outByte; 00043 break; 00044 } 00045 } 00046 for(unsigned int j = 0 ; j < 2 ; ++j){ 00047 switch(outState){ 00048 case 0: 00049 output[outByte] = 0; 00050 outState = 1; 00051 break; 00052 case 1: 00053 outState = 2; 00054 break; 00055 case 2: 00056 outState = 3; 00057 break; 00058 case 3: 00059 outState = 4; 00060 break; 00061 case 4: 00062 outState = 5; 00063 break; 00064 case 5: 00065 outState = 6; 00066 break; 00067 case 6: 00068 outState = 7; 00069 break; 00070 case 7: 00071 outState = 0; 00072 ++outByte; 00073 break; 00074 } 00075 } 00076 } 00077 }
Generated on Thu Jul 21 2022 03:45:37 by 1.7.2