Esempio n. 1
0
+((x&0x000F0000LU)?1:0)\
+((x&0x00F00000LU)?1:0))
#define MCODE_C(x) (((x&0x00000002LU)?1:0)\
+((x&0x00000020LU)?2:0)\
+((x&0x00000200LU)?4:0)\
+((x&0x00002000LU)?8:0)\
+((x&0x00020000LU)?16:0)\
+((x&0x00200000LU)?32:0))
#define MCODE_6(x) (((x&0x00F00000LU)?4:0)\
+ ((((x&0x00F00000LU)?1:0) & ((x&0x00000002LU)?0:1))?2:0))
#define MCODE(d)((uint8) (d==0)?7:MCODE_L(0x##d##LU)\
+ (MCODE_C(0x##d##LU) << 8 - MCODE_L(0x##d##LU))\
- MCODE_6(0x##d##LU))

const uint8 code MCODES[] = {
    /* 0x22 " */ MCODE(131131),
    /* 0x23 # */ MCODE(0),
    /* 0x24 $ */ MCODE(0),
    /* 0x25 % */ MCODE(0),
    /* 0x26 & */ MCODE(0),
    /* 0x27 ' */ MCODE(133331),
    /* 0x28 ( */ MCODE(31331),
    /* 0x29 ) */ MCODE(313313),
    /* 0x2A * */ MCODE(0),
    /* 0x2B + */ MCODE(13131),
    /* 0x2C , */ MCODE(331133),
    /* 0x2D - */ MCODE(311113),
    /* 0x2E . */ MCODE(131313),
    /* 0x2F / */ MCODE(31131),
    /* 0x30 0 */ MCODE(33333),
    /* 0x31 1 */ MCODE(13333),
Esempio n. 2
0
#define UNITSIZE_IN_MS (150)
#define WARMUP_PAUSE_IN_MS (3000)
#define ENDOFTEXT_PAUSE_IN_MS (3000)
#define LONG_RETRY_PAUSE_IN_MS (30000)
#define LONG_CARRIER_DURATION_IN_MS (4000)


#define MCODE(LEN, PATTERN) ( (PATTERN << 3) | ( LEN & 0x7 ) )
#define M_LEN(X) ( X & 0x7 )
#define M_PATTERN(X) ( X >> 3 )

// Translation lookup table.
// Please note, chars with langth 6 do not fit into 8 bits because of 3 bit length

const unsigned char CMorse::_morseTable[] = { 
    '0', MCODE(5,  0b11111 ),
    '1', MCODE(5,  0b01111 ),
    '2', MCODE(5,  0b00111 ),
    '3', MCODE(5,  0b00011 ),
    '4', MCODE(5,  0b00001 ),
    '5', MCODE(5,  0b00000 ),
    '6', MCODE(5,  0b10000 ),
    '7', MCODE(5,  0b11000 ),
    '8', MCODE(5,  0b11100 ),
    '9', MCODE(5,  0b11110 ),
    '/', MCODE(5,  0b10010 ),
    'A', MCODE(2,  0b01 ),
    'B', MCODE(4,  0b1000 ),
    'C', MCODE(4,  0b1010 ),
    'D', MCODE(3,  0b100 ),
    'E', MCODE(1,  0b0 ),