void SimpleCanvas::setBitmapSize(int sizeX, int sizeY) { HBITMAP newBM = CreateCompatibleBitmap(DC(), sizeX, sizeY); SetBitmapDimensionEx(newBM, sizeX, sizeY, 0); if (mOffScreenBM) { // Copy as much of the old contents as possible into the new bitmap HDC tempDC = CreateCompatibleDC(DC()); HGDIOBJ defaultBM = SelectObject(tempDC, newBM); // Perform the copy from old to new SIZE oldBMSize; GetBitmapDimensionEx(mOffScreenBM, &oldBMSize); BitBlt(tempDC, 0, 0, oldBMSize.cx, oldBMSize.cy, offScreenDC(), 0, 0, SRCCOPY); // Select clean up and select new bitmap SelectObject(tempDC, defaultBM); DeleteDC(tempDC); HGDIOBJ oldBM = SelectObject(offScreenDC(), newBM); assert(oldBM == mOffScreenBM); DeleteObject(mOffScreenBM); } else { SelectObject(offScreenDC(), newBM); } mOffScreenBM = newBM; }
void analyze_ttydata() { static char cmdbuf[33]; static uint8_t cmdlen; uint8_t idx, ucCommand; while(USB_Rx_Buffer->nbytes) { ucCommand = rb_get(USB_Rx_Buffer); //DC(ucCommand); // echo if(ucCommand == '\n' || ucCommand == '\r') { if(!cmdlen) // empty return continue; cmdbuf[cmdlen] = 0; if(!callfn(cmdbuf)) { DC('?'); for(idx = 0; fntab[idx].name; idx++) { DC(' '); DC(fntab[idx].name); } DNL(); } cmdlen = 0; } else { if(cmdlen < sizeof(cmdbuf)-1) cmdbuf[cmdlen++] = ucCommand; } } }
void fht_display_buf(uint8_t ptr[]) { #ifdef FHTDEBUG #warning FHT USB DEBUGGING IS ACTIVE uint8_t odc = display_channel; display_channel = DISPLAY_USB; uint16_t *p = (uint16_t *)&ticks; DU(*p, 5); DC(' '); DH2(fht80b_state); DC(' '); #else if(!(tx_report & REP_FHTPROTO)) return; #endif DC('T'); for(uint8_t i = 0; i < 5; i++) DH2(ptr[i]); if(tx_report & REP_RSSI) DH2(250); DNL(); #ifdef FHTDEBUG display_channel = odc; #endif }
ObjToLexEntry *ObjToLexEntryGet1A(Obj *obj, Obj *value_prop, char *features, char *not_usagefeat, int subcat, int paruniv, int *theta_filled, Discourse *dc) { int save_style; char *p; ObjToLexEntry *ole; if ((ole = ObjToLexEntryGet1B(obj, value_prop, features, not_usagefeat, subcat, paruniv, theta_filled, dc))) { return(ole); } /* Try other styles. */ save_style = DC(dc).style; for (p = FT_STYLE FS_NULL; *p; p++) { if (*p == save_style) continue; DC(dc).style = *p; if ((ole = ObjToLexEntryGet1B(obj, value_prop, features, not_usagefeat, subcat, paruniv, theta_filled, dc))) { return(ole); } } DC(dc).style = save_style; return(NULL); }
void RfAnalyze_Task(void) { uint8_t datatype = 0; bucket_t *b; uint8_t oby = 0; if(lowtime) { if(tx_report & REP_LCDMON) { #ifdef HAS_LCD lcd_txmon(hightime, lowtime); #else uint8_t rssi = cc1100_readReg(CC1100_RSSI); // 0..256 rssi = (rssi >= 128 ? rssi-128 : rssi+128); // Swap if(rssi < 64) // Drop low and high 25% rssi = 0; else if(rssi >= 192) rssi = 15; else rssi = (rssi-80)>>3; DC('a'+rssi); #endif } if(tx_report & REP_MONITOR) { DC('r'); if(tx_report & REP_BINTIME) DC(hightime); DC('f'); if(tx_report & REP_BINTIME) DC(lowtime); } lowtime = 0; }
void rf_moritz_task(void) { uint8_t enc[MAX_MORITZ_MSG]; uint8_t rssi; if(!moritz_on) return; // see if a CRC OK pkt has been arrived if(bit_is_set( CC1100_IN_PORT, CC1100_IN_PIN )) { //errata #1 does not affect us, because we wait until packet is completely received enc[0] = CC1100_READREG( CC1100_RXFIFO ) & 0x7f; // read len if (enc[0]>=MAX_MORITZ_MSG) enc[0] = MAX_MORITZ_MSG-1; CC1100_ASSERT; cc1100_sendbyte( CC1100_READ_BURST | CC1100_RXFIFO ); for (uint8_t i=0; i<enc[0]; i++) { enc[i+1] = cc1100_sendbyte( 0 ); } // RSSI is appended to RXFIFO rssi = cc1100_sendbyte( 0 ); // And Link quality indicator, too /* LQI = */ cc1100_sendbyte( 0 ); CC1100_DEASSERT; moritz_handleAutoAck(enc); if (tx_report & REP_BINTIME) { DC('z'); for (uint8_t i=0; i<=enc[0]; i++) DC( enc[i] ); } else { DC('Z'); for (uint8_t i=0; i<=enc[0]; i++) DH2( enc[i] ); if (tx_report & REP_RSSI) DH2(rssi); DNL(); } return; } if(CC1100_READREG( CC1100_MARCSTATE ) == 17) { CCSTROBE( CC1100_SFRX ); CCSTROBE( CC1100_SIDLE ); CCSTROBE( CC1100_SRX ); } }
VOID CHalWaveDevice::DebugPrintStatus( VOID ) ///////////////////////////////////////////////////////////////////////////// { ULONG ulStreamStatus = m_RegStreamStatus.Read(); ULONG ulStreamControl = m_RegStreamControl.Read(); (void) ulStreamStatus; (void)ulStreamControl; DC('['); DX16( (USHORT)(ulStreamStatus & REG_STREAMSTAT_L2PTR_MASK), COLOR_NORMAL ); DC(','); DX16( (USHORT)(ulStreamControl & REG_STREAMCTL_PCPTR_MASK), COLOR_NORMAL ); DC(']'); }
void shoes_slot_scroll_to(shoes_canvas *canvas, int dy, int rel) { if (rel) canvas->slot->scrolly += dy; else canvas->slot->scrolly = dy; if (canvas->slot->scrolly > canvas->endy - canvas->height) canvas->slot->scrolly = canvas->endy - canvas->height; if (canvas->slot->scrolly < 0) canvas->slot->scrolly = 0; if (DC(canvas->app->slot) == DC(canvas->slot)) canvas->app->slot->scrolly = canvas->slot->scrolly; shoes_native_slot_scroll_top(canvas->slot); shoes_slot_repaint(canvas->slot); }
void lcd_contrast(uint8_t hb) { uint8_t contrast = erb((uint8_t*)EE_CONTRAST); if(hb == 0xFE) { contrast--; } else if (hb == 0xFD) { contrast++; } else if (hb == 0xFC) { //keep the eeprom value } else { contrast = hb; } if(contrast < 40) contrast = 40; if(contrast > 80) contrast = 80; ewb((uint8_t*)EE_CONTRAST, contrast); lcd_sendcmd (LCD_CMD_SETCON); lcd_senddata (contrast); DS_P( PSTR("Contrast:") ); DU(100-(contrast-40)*100/40, 3); DC('%'); DNL(); }
//-------------------------------------------------------------------- void ccreg(char *in) { uint8_t hb, out, addr; if(in[1] == 'w' && fromhex(in+2, &addr, 1) && fromhex(in+4, &hb, 1)) { cc1100_writeReg(addr, hb); ccStrobe( CC1100_SCAL ); ccRX(); DH2(addr); DH2(hb); DNL(); } else if(fromhex(in+1, &hb, 1)) { if(hb == 0x99) { for(uint8_t i = 0; i < 0x30; i++) { DH2(cc1100_readReg(i)); if((i&7) == 7) DNL(); } } else { out = cc1100_readReg(hb); DC('C'); // prefix DH2(hb); // register number DS_P( PSTR(" = ") ); DH2(out); // result, hex DS_P( PSTR(" / ") ); DU(out,2); // result, decimal DNL(); } } }
ObjToLexEntry *ObjToLexEntryTransGet2(Obj *obj, Obj *value, char *feat, int paruniv, int *theta_filled, Discourse *dc) { int save_style; ObjToLexEntry *ole; ole = ObjToLexEntryGet1(obj, value, feat, F_NULL, paruniv, theta_filled, dc); if (ole == NULL && DC(dc).style != F_NULL) { save_style = DC(dc).style; DC(dc).style = F_NULL; ole = ObjToLexEntryGet1(obj, value, feat, F_NULL, paruniv, theta_filled, dc); DC(dc).style = save_style; } return(ole); }
void RptAddConcept(Rpt *rpt, Obj *obj, Discourse *dc) { char buf[PHRASELEN]; GenConceptString(obj, N("empty-article"), F_NOUN, F_NULL, DC(dc).lang, F_NULL, F_NULL, F_NULL, PHRASELEN, 0, 1, dc, buf); RptAdd(rpt, buf, RPT_JUST_LEFT); }
void ntp_digestpacket() { if(uip_len < sizeof(ntp_packet_t)) return; ntp_packet_t *p = (ntp_packet_t*)uip_appdata; uint8_t *f = (uint8_t *)&ntp_sec; f[0] = p->tx_ts.u8[3]; f[1] = p->tx_ts.u8[2]; f[2] = p->tx_ts.u8[1]; f[3] = p->tx_ts.u8[0]; ntp_hsec = (uint16_t)(p->tx_ts.u8[4]*125)/256; if(eth_debug) { DC('n'); DC('r'); ntp_func(0); } }
void lcd_brightness(uint8_t hb) { int16_t brightness = erb((uint8_t*)EE_BRIGHTNESS); if(hb == 0xFE) { brightness += 0x20; } else if (hb == 0xFD) { brightness -= 0x20; } else if (hb == 0xFC) { //keep the eeprom value } else { brightness = hb; } if(brightness < 0) brightness = 0; if(brightness > 255) brightness = 255; ewb((uint8_t*)EE_BRIGHTNESS, brightness); LCD_BL_PWM = brightness; DS_P( PSTR("Brightns:") ); DU(brightness*100/255, 3); DC('%'); DNL(); }
void moritz_sendAck(uint8_t* enc) { uint8_t ackPacket[12]; ackPacket[0] = 11; /* len*/ ackPacket[1] = enc[1]; /* msgcnt */ ackPacket[2] = 0; /* flag */ ackPacket[3] = 2; /* type = Ack */ for(int i=0;i<3;++i) /* src = enc_dst*/ ackPacket[4+i] = enc[7+i]; for(int i=0;i<3;++i) /* dst = enc_src */ ackPacket[7+i] = enc[4+i]; ackPacket[10] = 0; /* groupid */ ackPacket[11] = 0; /* payload */ my_delay_ms(20); /* by experiments */ moritz_sendraw(ackPacket, 0); //Inform FHEM that we send an autoack DC('Z'); for (uint8_t i=0; i < ackPacket[0]+1; i++) DH2( ackPacket[i] ); if (tx_report & REP_RSSI) DH2( 0 ); //fake some rssi DNL(); }
/* * [X [X [D un] [X [N tuteur]]] [Y [R de] [X [H toi]]]] -> * [X [D ton] [X [N tuteur]]] */ PNode *TransformGenPossessive(PNode *pn, Discourse *dc, /* RESULTS */ int *change) { PNode *pn_possdet, *r; if (pn->feature == F_NP && pn->pn1 && pn->pn1->feature == F_NP && pn->pn1->pn1 && pn->pn1->pn1->feature == F_DETERMINER && pn->pn2 && pn->pn2->feature == F_PP && pn->pn2->pn1 && pn->pn2->pn1->feature == F_PREPOSITION && LexEntryConceptIsAncestor(N("prep-of"), PNodeLeftmostLexEntry(pn->pn2->pn1)) && pn->pn2->pn2 && pn->pn2->pn2->feature == F_NP && pn->pn2->pn2->pn1 && pn->pn2->pn2->pn1->feature == F_PRONOUN) { if (DC(dc).lang == F_ENGLISH) { pn_possdet = GenMakeEnglishPossDet(pn->pn2->pn2->pn1->lexitem->features, dc); } else { pn_possdet = GenMakeFrenchPossDet(pn->pn2->pn2->pn1->lexitem->features, pn->pn1->pn1->lexitem->features, dc); } if (pn_possdet) { pn->pn1->pn1 = pn_possdet; pn->pn2 = NULL; r = pn->pn1; *change = 1; return(r); } } return(pn); }
void CDiskWizPassphrasePage::OnPaint() { CDC memDC; CPaintDC DC(this); HBITMAP oldBitmap; RECT sidebarRect; DC.SelectPalette(&mParentDiskWiz->mSidebarPalette, FALSE); DC.RealizePalette(); memDC.CreateCompatibleDC(&DC); memDC.SelectPalette(&mParentDiskWiz->mSidebarPalette, FALSE); memDC.RealizePalette(); mSidebarGraphic.GetWindowRect(&sidebarRect); ScreenToClient(&sidebarRect); // MFC bug - CDC::SelectObject returns incorrect pointers/handles so don't // fool with it. oldBitmap = (HBITMAP) SelectObject(memDC, mParentDiskWiz->mSidebarBitmap); DC.BitBlt(sidebarRect.left, sidebarRect.top, sidebarRect.right, sidebarRect.bottom, &memDC, 0, 0, SRCCOPY); memDC.SelectObject(oldBitmap); memDC.DeleteDC(); }
void wxsDrawingWindow::OnPaint(wxPaintEvent& event) { if ( !m_DuringFetch ) { wxPaintDC PaintDC(this); PrepareDC(PaintDC); if ( m_IsBlockFetch || NoNeedToRefetch() ) { if ( m_Bitmap ) { wxBitmap BmpCopy = m_Bitmap->GetSubBitmap(wxRect(0,0,m_Bitmap->GetWidth(),m_Bitmap->GetHeight())); wxBufferedDC DC(&PaintDC,BmpCopy); PaintExtra(&DC); } } else { StartFetchingSequence(); } } else { event.Skip(); } }
//-------------------------------------------------------------------- void ccreg(char *in) { uint8_t hb, out; if(fromhex(in+1, &hb, 1)) { if(hb == 0x99) { for(uint8_t i = 0; i < 0x30; i++) { DH2(cc1100_readReg(i)); if((i&7) == 7) DNL(); } } else { out = cc1100_readReg(hb); DC('C'); // prefix DH2(hb); // register number DS_P( PSTR(" = ") ); DH2(out); // result, hex DS_P( PSTR(" / ") ); DU(out,2); // result, decimal DNL(); } } }
void wxsDrawingWindow::FastRepaint() { wxClientDC ClientDC(this); PrepareDC(ClientDC); wxBitmap BmpCopy = m_Bitmap->GetSubBitmap(wxRect(0,0,m_Bitmap->GetWidth(),m_Bitmap->GetHeight())); wxBufferedDC DC(&ClientDC,BmpCopy); PaintExtra(&DC); }
void ntp_sendpacket() { if(eth_debug) { DC('n'); DC('s'); ntp_func(0); } if(ntp_conn == 0) return; uip_udp_conn = ntp_conn; fill_packet((ntp_packet_t*)uip_appdata); uip_send(uip_appdata, sizeof(ntp_packet_t)); uip_process(UIP_UDP_SEND_CONN); uip_arp_out(); network_send(); }
bool SimpleCanvas::onPaint() { if (!mOffScreenBM) setBitmapSize(clientSizeX(), clientSizeY()); // Copy the off-screen bitmap onto the screen SIZE sizeOfBM; GetBitmapDimensionEx(mOffScreenBM, &sizeOfBM); BitBlt(DC(), 0, 0, sizeOfBM.cx, sizeOfBM.cy, offScreenDC(), 0, 0, SRCCOPY); // Fill any unused area with some default colour RECT fillX = { sizeOfBM.cx, 0, std::max((int)sizeOfBM.cx, clientSizeX()), clientSizeY() }; RECT fillY = { 0, sizeOfBM.cy, clientSizeX(), std::max((int)sizeOfBM.cy, clientSizeY()) }; FillRect(DC(), &fillX, 0); FillRect(DC(), &fillY, 0); return true; }
HDC SimpleCanvas::offScreenDC() { if (!mOffScreenDC) { mOffScreenDC = CreateCompatibleDC(DC()); if (!mOffScreenDC) throw std::runtime_error("CreateCompatibleDC failed"); } return mOffScreenDC; }
uint8_t callfn(char *buf) { for(uint8_t idx = 0; ; idx++) { uint8_t n = __LPM(&fntab[idx].name); void (*fn)(char *) = (void (*)(char *))__LPM_word(&fntab[idx].fn); if(!n) break; if(buf == 0) { DC(' '); DC(n); } else if(buf[0] == n) { fn(buf); return 1; } } return 0; }
void CGraphListCtrl::DrawItem( CGraphBlockViewWnd* pWnd ) { CPaintDC DC(this); int nItem = GetItem(pWnd); if (nItem > -1) { DrawItem(nItem, &DC); } }
static void display_mac(uint8_t *a) { uint8_t cnt = 6; while(cnt--) { DH2(*a++); if(cnt) DC(':'); } }
void byoSnake::OnPaint(wxPaintEvent& event) { wxSize size = GetClientSize(); wxBitmap buffer(wxImage(size.GetWidth(),size.GetHeight())); wxBufferedPaintDC DC(this,buffer); DrawBorder(&DC); DrawSnake(&DC); DrawApple(&DC); DrawStats(&DC); }
static void display_ee_bytes(uint8_t *a, uint8_t cnt) { while(cnt--) { DH2(erb(a++)); if(cnt) DC(':'); } }
bool StateEvaluationTreePanel::renderToBMP(wxString const &Filename) { wxBitmap Bitmap(CurrentSize.GetWidth(), CurrentSize.GetHeight()); wxMemoryDC DC(Bitmap); render(DC); DC.SelectObject(wxNullBitmap); return Bitmap.SaveFile(Filename, wxBITMAP_TYPE_BMP); }
static void display_ip4(uint8_t *a) { uint8_t cnt = 4; while(cnt--) { DU(*a++,1); if(cnt) DC('.'); } }