Changeset 4745
- Timestamp:
- 08/16/07 21:16:32 (6 years ago)
- Location:
- experimental/components/DigitalModem/trunk/DigitalModem
- Files:
-
- 2 modified
-
atsrc/DigitalModulator_testsuite.h (modified) (2 diffs)
-
src/DigitalModem.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
experimental/components/DigitalModem/trunk/DigitalModem/atsrc/DigitalModulator_testsuite.h
r4744 r4745 15 15 { 16 16 public: 17 void test_01() { 17 18 void test_ConvertBitsToSymbol_01() { 19 char b[2] = {BIT0, BIT1}; 20 21 unsigned short s; 22 23 SetModulationScheme( SigProc::BPSK ); 24 25 for (unsigned int i=0; i<2; i++) { 26 ConvertBitsToSymbol(b+i*bitsPerSymbol, s); 27 TS_ASSERT_EQUALS( s, i ); 28 } 29 } 30 31 void test_ConvertBitsToSymbol_02() { 32 char b[8] = {BIT0, BIT0, 33 BIT0, BIT1, 34 BIT1, BIT0, 35 BIT1, BIT1}; 36 37 unsigned short s; 38 39 SetModulationScheme( SigProc::QPSK ); 40 41 for (unsigned int i=0; i<4; i++) { 42 ConvertBitsToSymbol(b+i*bitsPerSymbol, s); 43 TS_ASSERT_EQUALS( s, i ); 44 } 45 } 46 47 void test_ConvertBitsToSymbol_03() { 48 char b[24] = {BIT0, BIT0, BIT0, 49 BIT0, BIT0, BIT1, 50 BIT0, BIT1, BIT0, 51 BIT0, BIT1, BIT1, 52 BIT1, BIT0, BIT0, 53 BIT1, BIT0, BIT1, 54 BIT1, BIT1, BIT0, 55 BIT1, BIT1, BIT1}; 56 57 unsigned short s; 58 59 SetModulationScheme( SigProc::PSK8 ); 60 61 for (unsigned int i=0; i<8; i++) { 62 ConvertBitsToSymbol(b+i*bitsPerSymbol, s); 63 TS_ASSERT_EQUALS( s, i ); 64 } 18 65 } 19 66 }; … … 22 69 // definition, otherwise the python script does not recognize it 23 70 // as a test class 24 class DigitalModulator_Test Demodulation : public CxxTest::TestSuite,71 class DigitalModulator_TestModulation : public CxxTest::TestSuite, 25 72 public DigitalModem 26 73 { -
experimental/components/DigitalModem/trunk/DigitalModem/src/DigitalModem.cpp
r4744 r4745 205 205 206 206 for (unsigned int i=0; i<bitsPerSymbol; i++) { 207 s &= (bitsIn[bitsPerSymbol-i-1] > 0) ? 1 : 0;208 s >>= 1;209 } 210 } 211 212 207 s <<= 1; 208 s |= (bitsIn[i] > 0) ? 1 : 0; 209 } 210 } 211 212