background image

 

DATA1 : KEYPAD_UP = 0x30, KEYPAD_DOWN = 0x31 
DATA2 : KEY_A = 30, KEY_B = 48, KEY_C = 46, KEY_D = 32, KEY_E = 18, KEY_F = 33, KEY_G = 34, 

    KEY_H = 35, KEY_I = 23, KEY_J = 36, KEY_K = 37, KEY_L = 38, KEY_M = 50, KEY_N = 49, 

KEY_O = 24, KEY_P = 25, KEY_F1 = 59, KEY_F2 = 60, KEY_F10 = 68, KEY_F11 = 87 

DATA3 : DATA_RESERVED = 0x20 

 

/* 
 * Function name : OperThread 
 * Description   : This function is a parsing packets in ring buffer. 
 */ 
void Serial_Daemon::OperThread() 

    int ptr_start, ptr_end; 
    unsigned int crc_buf; 
    /* check STX and ETX in packet */ 
    m_abyBuffer.FindChar(STX,ptr_start); 
    m_abyBuffer.FindChar(ETX,ptr_end); 
    if((ptr_start >= ptr_end) && (ptr_end - ptr_start != 8)){ 
        return; 
    } 
    

 중략 

 

    /* Pasing packet */ 
    if(g_Packet_Buffer[1] != MOD_GET){ 
        return; 
    } 
    if(g_Packet_Buffer[2] != SEL_KEYPAD){ 
        return; 
    } 
    crc_buf = crc16_append(g_Packet_Buffer,6); 
    if((g_Packet_Buffer[6] !=(char)((crc_buf>>8)&0xff)) ||  
(g_Packet_Buffer[7]!=(char)(crc_buf&0xff))){  //CRC Check 
        return; 
    } 
    if(g_Packet_Buffer[3] == KEYPAD_DOWN){ 
        Keydown_Event(g_Packet_Buffer); 
    } 
    if(g_Packet_Buffer[3] == KEYPAD_UP){ 
        Keyup_Event(g_Packet_Buffer); 
    } 

 

/* 
 * Function name : Keydown_Event 
 * Description   : This functin is keydown event. 
 *                 If you want to output consecutive key values, add a sync event. 
 */ 
void Serial_Daemon::Keydown_Event(char key_down[10]) 

    struct input_event event; 
    char Receive_Packetf[10] = {0, }; 
    strcpy(Receive_Packetf,key_down); 
    //Input key event 
    memset(&event,0,sizeof(event)); 
    event.type = EV_KEY; 
    event.code = Receive_Packetf[4]; 

Содержание DTP10-L

Страница 1: ...1 11 DTP10 L API manual Form 140108F 171206 January 2018 DAINCUBE Corp Web www daincube com E mail sales daincube com Tel 82 32 329 9783 4 Fax 82 32 329 9785 401 701 Bucheon TechnoPark 4 Danji 655 Pye...

Страница 2: ...ed The information in this document is provided as is and is subject to change without notice Trademarks All used product names logos or trademarks are property of their respective owners Product supp...

Страница 3: ...Revision history Revision Data Comment Version 0 1 Preliminary 2018 01 11 Preliminary version...

Страница 4: ...n 5 2 2 Write to serial port 6 2 3 Read from serial port and write ring buffer 7 3 Defines of ETC values 8 3 1 Description 8 4 How to control ETC driver 8 4 1 Example using LED 8 4 2 Examples using Bu...

Страница 5: ...CM0 port must be opened and function used are as follows fd open SERPORT 0_RDWR O_NOCTTY if fd 0 Serial Port Open Fail else Serial Port Open Success If the serial port is successfully opened set addit...

Страница 6: ...unction is control Right LED 1 void Serial_Daemon on_Btn_LED1_clicked char LED_Packet 10 0 unsigned int crc_buf unsigned long dwBytes 0 static char i 0 LED_Packet 0 STX STX LED_Packet 1 MOD_SET MOD ge...

Страница 7: ...Function name Receive_Event Description This function takes packet and stacks it in the ring buffer void Serial_Daemon Receive_Event char Receive_Packet BUFF_MAX int temp memset Receive_Packet 0 sizeo...

Страница 8: ...serial packet as below STX MOD SEL DATA1 DATA2 DATA3 CRC_H CRC_L ETX 0x02 0x11 0x3A 0x63 0x33 0x20 0xXX 0xXX 0x03 1BYTE 1BYTE 1BYTE 1BYTE 1BYTE 1BYTE 1BYTE 1BYTE 1BYTE MOD MOD_GET 0x10 MOD_SET 0x11 S...

Страница 9: ...data 0x2 Red color LED_Packet 4 LED_RED else if data 0x4 All color LED_Packet 4 LED_ALL_ON else LED Off LED_Packet 4 LED_OFF crc_buf crc16_append LED_Packet 6 LED_Packet 6 char crc_buf 8 0xff LED_Pack...

Страница 10: ...OFF buf_printf 4 DATA_RESERVED Data2 Reserved 0x20 buf_printf 5 DATA_RESERVED Data3 Reserved 0x20 crc_buf crc16_append buf_printf 6 buf_printf 6 char crc_buf 8 0xff buf_printf 7 char crc_buf 0xff buf_...

Страница 11: ...nd ptr_end ptr_start 8 return Pasing packet if g_Packet_Buffer 1 MOD_GET return if g_Packet_Buffer 2 SEL_KEYPAD return crc_buf crc16_append g_Packet_Buffer 6 if g_Packet_Buffer 6 char crc_buf 8 0xff g...

Страница 12: ...efined key code you can control LED and buzzer However it will work only active mode Do not work inactive mode hide mode hidden mode etc Therefore you can refer to the event filter section of serial d...

Страница 13: ...type QEvent KeyRelease data 0x0 LED_Set sel data usleep 1000 BUZ_Set BUZZ_OFF usleep 1000 switch Keyevent key case Qt Key_A case Qt Key_D case Qt Key_G sel RIGHT_LED1 break case Qt Key_B case Qt Key_...

Отзывы: