Exemple #1
0
// Initialization for ST7735R screens (green or red tabs)
void lcd_init_screen(unsigned char options) 
{
	commonInit(Rcmd1);
	if (options == INITR_GREENTAB) 
	{
		commandList(Rcmd2green);
		colstart = 2;
		rowstart = 1;
	} 
	else 
	{
		// colstart, rowstart left at default '0' values
		commandList(Rcmd2red);
	}

	commandList(Rcmd3);

  // if black, change MADCTL color filter
  if (options == INITR_BLACKTAB) 
  {
    lcd_writecommand(ST7735_MADCTL);
    // TODO: OLD lcd_writedata(0xC0);
    lcd_writedata( 0x60 );
  }

  tabcolor = options;
}
// Initialization for ST7735R screens (green or red tabs)
void Adafruit_ST7735::initR(uint8_t options) {
  commonInit(Rcmd1);
  if(options == INITR_GREENTAB) {
    commandList(Rcmd2green);
    colstart = 2;
    rowstart = 1;
  } else {
    // colstart, rowstart left at default '0' values
    commandList(Rcmd2red);
  }
  commandList(Rcmd3);
}
	int32 Application::Run()
	{
		MSG msg = { 0 };
		auto startTimePoint = std::chrono::system_clock::now();
		auto endTimePoint = startTimePoint;
		static float totalTimeSeconds = 0.0f;

		while (!m_RequestQuit)
		{
			if (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
			{
				TranslateMessage(&msg);
				DispatchMessage(&msg);
				if (msg.message == WM_QUIT)
				{
					m_RequestQuit = true;
				}
			}
			else
			{
				startTimePoint = std::chrono::system_clock::now();
				std::chrono::duration<float> timeDeltaSeconds = endTimePoint - startTimePoint;
				endTimePoint = startTimePoint;

				totalTimeSeconds += timeDeltaSeconds.count();

				m_Scene->Update(totalTimeSeconds, timeDeltaSeconds.count());

				CommandList& commandList(m_Renderer->StartRender());
				m_Scene->Render(commandList);
				m_Renderer->EndRender(commandList);
			}
		}
		return static_cast<int32>(msg.wParam);
	}
Exemple #4
0
int executeCommand(programOptions po)
{
	switch (programOptionsGetMode(po))
	{
	case MODE_ADD:
		return commandAdd(po);
		break;
	case MODE_DELETE:
		return commandDelete(po);
		break;
	case MODE_EXTRACT:
		return commandExtract(po);
		break;
	case MODE_UPDATE:
		return commandUpdate(po);
		break;
	case MODE_CREATE:
		return commandCreate(po);
		break;
	case MODE_LIST:
		return commandList(po);
		break;
	case MODE_DIFF:
		return commandDiff(po);
		break;
	case MODE_HELP:
		return commandHelp(po);
		break;
	default:
		break;
	}
	return 0;
}
/**
 * Initialization for ST7735R screens (green or red tabs)
 */
void Adafruit_ST7735::initR(DisplayType options) {
   commandList(Rcmd1);

   if(options == INITR_GREENTAB) {
      commandList(Rcmd2green);
      colstart = 2;
      rowstart = 1;
   } else if(options == INITR_144GREENTAB) {
      fHeight = ST7735_TFTHEIGHT_128;
      fWidth  = ST7735_TFTWIDTH_128;
      commandList(Rcmd2green144);
      colstart = 2;
      rowstart = 3;
   } else if(options == INITR_MINI160x80) {
      fHeight = ST7735_TFTHEIGHT_160;
      fWidth  = ST7735_TFTWIDTH_80;
      commandList(Rcmd2green160x80);
      colstart = 24;
      rowstart = 0;
   } else {
      // colstart, rowstart left at default '0' values
      commandList(Rcmd2red);
   }
   commandList(Rcmd3);

   // if black, change MADCTL color filter
   if ((options == INITR_BLACKTAB) || (options == INITR_MINI160x80)) {
      writecommand(ST7735_MADCTL);
      writedata8(0xC0);
   }

   tabcolor = options;

   setRotation(0);
}
/*!
  Searches for a command with given name. Returns null if none found.
*/
TasCommand* TasTarget::findCommand(const QString& commandName)
{
    TasCommand* match = 0;
    QListIterator<TasCommand*> i(commandList());
    while (i.hasNext()){
        TasCommand* command = i.next();
        if(command->name() == commandName){
            match = command;
            break;
        }
    }
    return match;
}
Exemple #7
0
//------------ST7735_InitR------------
// Initialization for ST7735R screens (green or red tabs).
// Input: option one of the enumerated options depending on tabs
// Output: none
void ST7735_InitR(enum initRFlags option) {
  commonInit(Rcmd1);
  if(option == INITR_GREENTAB) {
    commandList(Rcmd2green);
    ColStart = 2;
    RowStart = 1;
  } else {
    // colstart, rowstart left at default '0' values
    commandList(Rcmd2red);
  }
  commandList(Rcmd3);

  // if black, change MADCTL color filter
  if (option == INITR_BLACKTAB) {
    writecommand(ST7735_MADCTL);
    writedata(0xC0);
  }
  TabColor = option;
  ST7735_SetCursor(0,0);
  StTextColor = ST7735_YELLOW;
  ST7735_FillScreen(0);                 // set screen to black
}
Exemple #8
0
Fichier : task.c Projet : qqttrr/os
void proceedCommand(std::string tokens) {
    std::deque<std::string> commandList(0);
    commandList = split(tokens, ' ', commandList);
    while (commandList.front().size() == 0 || commandList.front() == " ") {
        commandList.pop_front();
    }
    const int len = commandList.size() + 1;
    char *arguments[len];
    for (int i = 0; i < commandList.size(); ++i) {
        arguments[i] = (char *) commandList[i].c_str();
    }
    arguments[len - 1] = NULL;
    execvp(arguments[0], arguments);
}
const char * UResLaserIfObst::snprint(const char * preString, char * buff, int buffCnt)
{
  const int MSL = 30;
  char s[MSL];
  char * p1 = buff;
  int n = 0;
  //
  snprintf(p1, buffCnt - n, "%s Handles interface tags: %s\n",
           preString, commandList());
  n = strlen(p1);
  p1 = &buff[n];
  updTime.getTimeAsString(s, true);
  snprintf(p1, buffCnt - n, "%s Holds %d obstacle groups, last update at %s\n",
           preString, groupsCnt, s);
  return buff;
}
Exemple #10
0
int main(void)
{
	int   ret;
	char  esc = 0;

    loop = 0;

	for( ret = 0; ret < MAX_HVPS ; ret++ )
		System[ret].ID = -1;

	con_init();
	commandList();
	con_end();

	return 0;
}
Exemple #11
0
void commonInit(const unsigned char *cmdList) 
{
	colstart  = rowstart = 0; // May be overridden in init func

	lcd_spi_init();

	// Reset screen (TODO: Optimize this to reset faster)
	LCD_PORT |= LCD_RESET_BIT;
	delay_ms(500);
	LCD_PORT &= ~LCD_RESET_BIT;
	delay_ms(500);
	LCD_PORT |= LCD_RESET_BIT;
	delay_ms(500);

	if(cmdList) 
		commandList(cmdList);
}
Exemple #12
0
// Initialization code common to both 'B' and 'R' type displays
void static commonInit(const uint8_t *cmdList) {
  ColStart  = RowStart = 0; // May be overridden in init func

  // toggle RST low to reset; CS low so it'll listen to us
  // UCA3STE is temporarily used as GPIO
  P9SEL0 &= ~0x0C;
  P9SEL1 &= ~0x0C;                      // configure P9.2 (D/C), P9.3 (Reset), and P9.4 (TFT_CS) as GPIO
  P9DIR |= 0x1C;                        // make P9.2 (D/C), P9.3 (Reset), and P9.4 (TFT_CS) out
  TFT_CS &= ~TFT_CS_BIT;
  RESET |= RESET_BIT;
  Delay1ms(500);
  RESET &= ~RESET_BIT;
  Delay1ms(500);
  RESET |= RESET_BIT;
  Delay1ms(500);

  // initialize eUSCI
  UCA3CTLW0 = 0x0001;                   // hold the eUSCI module in reset mode
  // configure UCA3CTLW0 for:
  // bit15      UCCKPH = 1; data shifts in on first edge, out on following edge
  // bit14      UCCKPL = 0; clock is low when inactive
  // bit13      UCMSB = 1; MSB first
  // bit12      UC7BIT = 0; 8-bit data
  // bit11      UCMST = 1; master mode
  // bits10-9   UCMODEx = 00; UCSTE active low
  // bit8       UCSYNC = 1; synchronous mode
  // bits7-6    UCSSELx = 2; eUSCI clock SMCLK
  // bits5-2    reserved
  // bit1       UCSTEM = 0; UCSTE pin enables slave
  // bit0       UCSWRST = 1; reset enabled
  UCA3CTLW0 = 0xA981;
  // set the baud rate for the eUSCI which gets its clock from SMCLK
  // Clock_Init48MHz() from ClockSystem.c sets SMCLK = HFXTCLK/4 = 12 MHz
  // if the SMCLK is set to 12 MHz, divide by 3 for 4 MHz baud clock
  UCA3BRW = 3;
  // modulation is not used in SPI mode, so clear UCA3MCTLW
  UCA3MCTLW = 0;
  P9SEL0 |= 0xE0;
  P9SEL1 &= ~0xE0;
  P9SEL0 &= ~0x0C;
  P9SEL1 &= ~0x0C;                      // configure P9.7, P9.5, and P9.4 as primary module function
  UCA3CTLW0 &= ~0x0001;                 // enable eUSCI module
  UCA3IE &= ~0x0003;                    // disable interrupts

  if(cmdList) commandList(cmdList);
}
Exemple #13
0
void Updater::ToDoProcess()
{
    QStringList commandList(ToDo.split("\n", QString::SkipEmptyParts));


    if(!commandList.isEmpty())
    {
        for(int i = 0; i < commandList.size(); ++i)
        {
            QStringList argList(commandList.at(i).split(" ", QString::SkipEmptyParts));

            QDir dir;

            if(argList.at(0) == "mkdir")
                for(int mkDirIndex = 1; mkDirIndex < argList.size(); mkDirIndex++)
                {
                    QFileInfo dirInfo(argList.at(mkDirIndex));
                    dir.mkdir(QDir::toNativeSeparators(dirInfo.absoluteFilePath().simplified()));
                }
            else if(argList.at(0) == "rmdir")
                for(int rmDirIndex = 1; rmDirIndex < argList.size(); rmDirIndex++)
                {
                    QDir dirToRemove(argList.at(rmDirIndex).simplified());
                    QFileInfoList infoList(dirToRemove.entryInfoList(QDir::AllEntries | QDir::NoDotAndDotDot));
                    for(int j = 0; j < infoList.size(); j++)
                        QFile::remove(argList.at(rmDirIndex).simplified()+"/"+infoList.at(j).fileName());
                    dir.rmdir(argList.at(rmDirIndex).simplified());
                }
            else if(argList.at(0) == "del")
                for(int delFileIndex = 1; delFileIndex < argList.size(); delFileIndex++)
                    QFile::remove(argList.at(delFileIndex).simplified());
            else if(argList.at(0) == "renameFile")
            {
                if(QFile::exists(argList.at(2).simplified()))
                    QFile::remove(argList.at(2).simplified());
                QFile::rename(argList.at(1).simplified(), argList.at(2).simplified());
            }
            else if(argList.at(0) == "renameDir")
                dir.rename(argList.at(1).simplified(), argList.at(2).simplified());
        }
    }
    finish();
}
// Initialization code common to both 'B' and 'R' type displays
void Adafruit_ST7735::commonInit(const uint8_t *cmdList) {

  constructor(ST7735_TFTWIDTH, ST7735_TFTHEIGHT);
  colstart  = rowstart = 0; // May be overridden in init func

  pinMode(_rs, OUTPUT);
  pinMode(_cs, OUTPUT);
  csport    = portOutputRegister(digitalPinToPort(_cs));
  cspinmask = digitalPinToBitMask(_cs);
  rsport    = portOutputRegister(digitalPinToPort(_rs));
  rspinmask = digitalPinToBitMask(_rs);

  if(hwSPI) { // Using hardware SPI
    SPI.begin();
    SPI.setClockDivider(SPI_CLOCK_DIV4); // 4 MHz (half speed)
    SPI.setBitOrder(MSBFIRST);
    SPI.setDataMode(SPI_MODE0);
  } else {
    pinMode(_sclk, OUTPUT);
    pinMode(_sid , OUTPUT);
    clkport     = portOutputRegister(digitalPinToPort(_sclk));
    clkpinmask  = digitalPinToBitMask(_sclk);
    dataport    = portOutputRegister(digitalPinToPort(_sid));
    datapinmask = digitalPinToBitMask(_sid);
    *clkport   &= ~clkpinmask;
    *dataport  &= ~datapinmask;
  }

  // toggle RST low to reset; CS low so it'll listen to us
  *csport &= ~cspinmask;
  if (_rst) {
    pinMode(_rst, OUTPUT);
    digitalWrite(_rst, HIGH);
    delay(500);
    digitalWrite(_rst, LOW);
    delay(500);
    digitalWrite(_rst, HIGH);
    delay(500);
  }

  if(cmdList) commandList(cmdList);
}
/**
 * Initialization for ST7735B screens
 */
void Adafruit_ST7735::initB(void) {
   commandList(Bcmd);

   setRotation(0);
}