Esempio n. 1
0
void TclWriter::writeHeaderFile(UMLClassifier * c, QFile & fileh)
{
    // open stream for writing
    QTextStream stream(&fileh);
    mStream = &stream;

    // reset the indent level
    m_indentLevel = 0;

    // write header blurb
    QString str = getHeadingFile(".tcl");
    if (!str.isEmpty()) {
        str.replace(QRegExp("%filename%"), fileName_);
        str.replace(QRegExp("%filepath%"), fileh.fileName());
        writeCode(str);
    }
    // set current namespace
    writeCode("namespace eval " + mNamespace + " {");
    m_indentLevel++;

    // check on already existing
    writeComm("Do not load twice");
    writeCode("if {[namespace exist " + className_ + "]} return");

    // source used superclass files
    UMLClassifierList superclasses = c->getSuperClasses();
    if (superclasses.count() > 0) {
        writeComm
        ("Source found and used class files and import class command if necessary");

        foreach (UMLClassifier * classifier , superclasses ) {
            writeUse(classifier);
        }
Esempio n. 2
0
/*
setPositionXY:
Xs --> X start  address   0~17
Xe --> X end    address   0~17
Ys --> Y start  address   0~171
Ye --> Y end    address   0~171
*/
void E_ink_ESP8266::setPositionXY(INT8U Xs, INT8U Xe,INT8U Ys,INT8U Ye)
{
  writeComm(0x44);//set RAM x address start/end  command
  writeData(Xs); 
  writeData(Xe); 
  writeComm(0x45);//set RAM y address start/end  command
  writeData(Ys); 
  writeData(Ye);
  writeComm(0x4E);//set RAM x address count to Xs;
  writeData(Xs);
  writeComm(0x4F);//set RAM y address count to Ys;
  writeData(Ys);
}
Esempio n. 3
0
/*
display Two-Dimensional Code in the Eink screen:
x:the X start address,X value can be 0 to 14;
y:the Y start  address, Y vlue can  be 171 to 15;
the charater erea is from x to x+6 in X position and from y to y-24 in Y position
*/
void E_ink_ESP8266::displayTwoDimensionalCode(INT8U x,INT8U y)
{
  INT16U i;
  writeComm(0x11);    /*data enter mode command */
  writeData(0x05);    /*set Y-mode:X increment and y decrement */
  setPositionXY(x,x+7,y,y-24);  
  converDimensionalCode();
  writeComm(0x24);
  for(i=0;i<200;i++)
  {
    writeData(matrixdata_conver[i]);
  }
}
Esempio n. 4
0
void send_command(HANDLE * fd, struct receive_tcp_frame * tcp_frame)
{
    struct api_frame frm;
    struct api_at_command cmd;
    char frame_buffer[BUF_SIZE];
    size_t frame_size;
	#ifdef _DEBUG_
    int i;
	#endif
    /* Prepare Cmd */
    cmd.frame_id = tcp_frame->frame_id;
    cmd.command[0] = tcp_frame->command[0];
    cmd.command[1] = tcp_frame->command[1];
    memcpy(cmd.parameter, tcp_frame->data, tcp_frame->data_size);
    cmd.size = tcp_frame->data_size;
    /* Prepare Frame */
    frm.cmdid = 0x08;
    /* Build Frame Data */
    make_frame_data_at_command(&cmd, &frm);
    frame_size=make_frame(&frm, (uint8_t*)frame_buffer, BUF_SIZE);
    /* Send Frame */
    ERR(writeComm(fd, (uint8_t*)frame_buffer, frame_size), "write");
    #ifdef _DEBUG_
    fprintf(stderr, "DEBUG: Sent XBee frame [");
    for(i = 0 ; i < frame_size; ++i)
        fprintf(stderr, "%02X ", frame_buffer[i]);
    fprintf(stderr, "]\n");
    #endif
}
Esempio n. 5
0
void send_to_frame(HANDLE * fd, struct receive_tcp_frame * tcp_frame)
{
    struct api_frame frm;
    struct api_transmit_64 trans;
    char frame_buffer[BUF_SIZE];
    size_t frame_size;
	#ifdef _DEBUG_
    int i;
	#endif
    /* Prepare Trans */
    memcpy(trans.dest_address, tcp_frame->address, 8);
    trans.frame_id = tcp_frame->frame_id;
    trans.options = 0;
    memcpy(trans.rf_data, tcp_frame->data, (tcp_frame->data_size>100?100:tcp_frame->data_size));
    trans.size = (tcp_frame->data_size>100?100:tcp_frame->data_size);
    /* Prepare Frame */
    frm.cmdid = 0x00;
    /* Build frame data */
    make_frame_data_transmit_64(&trans, &frm);
    frame_size=make_frame(&frm, (uint8_t*)frame_buffer, BUF_SIZE);
    /* Send Frame */
    ERR(writeComm(fd, (uint8_t*)frame_buffer, frame_size), "write");
    #ifdef _DEBUG_
    fprintf(stderr, "DEBUG: Sent XBee frame [");
    for(i = 0 ; i < frame_size; ++i)
        fprintf(stderr, "%02X ", frame_buffer[i]);
    fprintf(stderr, "]\n");
    #endif
}
Esempio n. 6
0
/*-------------
refresh the screen, need to be called by application every time  the screen changed
--------------*/
void E_ink_ESP8266::refreshScreen(void)
{
  writeComm(0x20);
  closeBump();
  delay(5000);
  
  
}
Esempio n. 7
0
 /*
display character in the Eink screen:
x:the X start address,X value can be 0 to 14;
y:the Y start  address, Y vlue can  be 171 to 7;
the charater diplay erea is from x to x+3 in X position and from y to y-7 in Y position
unicode_char:the character machine code
*/
void E_ink_ESP8266::displayChar(INT8U x,INT8U y,INT16U unicode_Char)
{
  INT16U i;
  getCharMatrixData(unicode_Char);
  converCharMatrixData();
  //setPositionXY(x,x+3,y,y-7);
  setPositionXY(x,x+3,y,y-7);
  writeComm(0x11);     /*data enter mode command */
  writeData(0x05);     /*set Y-mode:X address is increment and y address decrement */                       
  writeComm(0x24);
  for(i=16;i<32;i++)
  {
      writeData(matrixdata_conver[i]);
   }
   for(i=0;i<16;i++)
  {

      writeData(matrixdata_conver[i]);
  }
}
Esempio n. 8
0
/*-------------
clear the original screen, need to be called before writing any data or command to screen ;
------------*/
void E_ink_ESP8266::clearScreen(void)
{
   INT16U i;
   initEink();
   writeComm(0x24);
   for(i=0;i<3096;i++)
   {
     writeData(0xff);
   }
   delay(1000); 
 }
Esempio n. 9
0
void E_ink_ESP8266::configureLUTRegister(void)
{
  INT8U i;
  INT8U init_data[]={
  0x00,0x00,0x00,0x55,0x00,0x00,0x55,0x55,0x00,0x55,0x55,0x55,0xAA,0xAA,0xAA,0xAA,
  0x15,0x15,0x15,0x15,0x05,0x05,0x05,0x05,0x01,0x01,0x01,0x01,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
  0x22,0xFB,0x22,0x1B,0x00,0x00,0x00,0x00,0x00,0x00,};
  writeComm(0x32);  //write data to LUT register
  for(i=0;i<90;i++)
    writeData(init_data[i]); 
}
Esempio n. 10
0
void setAPI(HANDLE * fd)
{
    size_t size;
    char buf[1024];
    COMMERR(writeComm(fd, (uint8_t*)"+++", 3), "writeComm");
    COMMERR(size=readComm(fd, (uint8_t*)buf, 3), "readComm");
    if(strncmp(buf, "OK", 2)!=0){ QUIT("Module Not Responding\n");}
	buf[size] = 0;
    fprintf(stderr, "XBee Command Mode : %s\n", buf);
    /*ERR(write(fd, "ATMY FFFF\r", 10), "write");
    ERR(size=read(fd, buf, 1024), "read");
    if(strcmp(buf, "OK\r")!=0){ fprintf(stderr, "Module Not Responding\n"); exit(1);}
    fprintf(stderr, "XBee Disable 16Bit : %s\n", buf);*/
    COMMERR(writeComm(fd, (uint8_t*)"ATAP 1\r", 7), "writeComm");
    COMMERR(size=readComm(fd, (uint8_t*)buf, 3), "readComm");
    if(strncmp(buf, "OK", 2)!=0){ QUIT("Module Not Responding\n");}
	buf[size] = 0;
    fprintf(stderr, "XBee API Mode : %s\n", buf);
    COMMERR(writeComm(fd, (uint8_t*)"ATCN\r", 5), "writeComm");
    COMMERR(size=readComm(fd, (uint8_t*)buf, 3), "readComm");
    if(strncmp(buf, "OK", 2)!=0){ QUIT("Module Not Responding\n");}
	buf[size] = 0;
    fprintf(stderr, "XBee Exit Command Mode : %s\n", buf);
}
Esempio n. 11
0
void E_ink_ESP8266::closeBump(void)
{
  writeComm(0x22);   
  writeData(0x03);
  writeComm(0x20);
}
Esempio n. 12
0
/* -------------------------------------------------------------
private class function, called by public fuction: clearScreen(), to init the screen;
--------------------------------------------------------------*/
void E_ink_ESP8266::initEink(void) //initial code
{
  writeComm(0x10);//exit deep sleep mode
  writeData(0x00);
  writeComm(0x11);//data enter mode
  writeData(0x03);
  writeComm(0x44);//set RAM x address start/end, in page 36
  writeData(0x00);//RAM x address start at 00h;
  writeData(0x11);//RAM x address end at 11h(17)->72: [because 1F(31)->128 and 12(18)->76] 
  writeComm(0x45);//set RAM y address start/end, in page 37
  writeData(0x00);//RAM y address start at 00h;
  writeData(0xAB);//RAM y address start at ABh(171)->172: [because B3(179)->180]
  writeComm(0x4E);//set RAM x address count to 0;
  writeData(0x00);
  writeComm(0x4F);//set RAM y address count to 0;
  writeData(0x00);
  writeComm(0xF0);//booster feedback used, in page 37
  writeData(0x1F);
  writeComm(0x22);//display updata sequence option ,in page 33
  writeData(0xC0);//enable sequence: clk -> CP
  
  configureLUTRegister();
  
  writeComm(0x2C);//vcom
  writeData(0xA0);
  writeComm(0x3C);//board
  writeData(0x63);
  writeComm(0x22);//display updata sequence option ,in page 33
  writeData(0xC4);//enable sequence: clk -> CP -> LUT -> initial display -> pattern display
}