Esempio n. 1
0
void receiverMain() {
    int i;
    char offset;
    char status;

    //doCycle();
    //doOscillate();

    nrf_init();
    delay();

    nrf_rxmode();
    delay();

    Delay10KTCYx(100);

    offset = 0;
    STATUS_LED = 0;
    while(1) {
        //STATUS_LED =
        nrf_receive(&rx_buf);

        updateBuffer();
        updateLEDs();
    }
}
Esempio n. 2
0
void msl::on_pushButton_RGB_off_clicked()
{
	int h, s, v;
	this->colorDialog->currentColor().getHsv(&h, &s, &v);
	this->colorDialog->setCurrentColor(QColor::fromHsv(h, s, 0));
    updateLEDs();
}
Esempio n. 3
0
void taskUpdateRxMain(void)
{
    processRx();
    updateLEDs();

    isRXDataNew = true;

#ifdef BARO
    // updateRcCommands() sets rcCommand[], updateAltHoldState depends on valid rcCommand[] data.
    if (haveUpdatedRcCommandsOnce) {
        if (sensors(SENSOR_BARO)) {
            updateAltHoldState();
        }
    }
#endif

#ifdef SONAR
    // updateRcCommands() sets rcCommand[], updateAltHoldState depends on valid rcCommand[] data.
    if (haveUpdatedRcCommandsOnce) {
        if (sensors(SENSOR_SONAR)) {
            updateSonarAltHoldState();
        }
    }
#endif
}
Esempio n. 4
0
void msl::on_pushButton_off_clicked()
{

	this->colorDialog->setCurrentColor(QColor::fromHsv(0, 0, 0));
	this->ui.verticalSlider_uv->setValue(0);
	this->ui.verticalSlider_white->setValue(0);
    updateLEDs();
}
Esempio n. 5
0
void MainWindow::timerEvent(QTimerEvent *) {
    miksys->buttonState = ui->softButton->isChecked();
    updateLEDs(miksys->LEDstate);
    if (miksys->frame % 2 == 0) ui->display->repaint();
    miksys->frame++;
    showInfo();
    ui->frequency->setText(QString("Freq: %1 MHz").arg(freq));
}
Esempio n. 6
0
void clearLEDs(void) {
/*	this function is pretty self-explanatory */
	uint8_t counter;
	for (counter = 0; counter < 16; counter++) {
		valueLEDs[counter] = 0;
	}
	displayFader();
	updateLEDs(currentLEDstate1, currentLEDstate2);
}
Esempio n. 7
0
void msl::colorChanged(const QColor & color)
{
	//Get RGB values of the current color
	int r, g, b, h, s, v;

	color.getRgb(&r, &g, &b);
	color.getHsv(&h, &s, &v);

	updateLEDs();
}
Esempio n. 8
0
void doCycle(void) {
    short offset;

    offset = 0;
    while(1) {
        writeSource(offset);
        updateLEDs();
        Delay10KTCYx(50);
        offset++;
        if (offset >= STRIP_LENGTH) offset = 0;
    }
}
Esempio n. 9
0
void doOscillate(void) {
    short offset;
    char dir = 1;

    offset = 0;
    while(1) {
        writeSource(offset);
        updateLEDs();
        offset+= dir;
        if (offset > STRIP_LENGTH) {
            offset = STRIP_LENGTH;
            dir = -1;
        } else if (offset < 0) {
            offset = 0;
            dir = 1;
        }
    }
}
Esempio n. 10
0
int main(void)
{
	DDRB = 0xFF; // all set to output
	DDRD = 0xFF; // all set to output
	DDRC = 0xFF; // cathodes set as output

	//swich off all layers by applying voltage to the cathode pins thereby preventing current flow
	PORTC |= (1 << LAYER1) | (1 << LAYER2) | (1 << LAYER3);

	//initialize the timers (in this case just timer0)
	init_timers();
	init_leds();
	while (1)
	{
		//all the work is done in the interrupt service routine
		_delay_ms(5);
		updateLEDs();
	}
	return 1;
}
Esempio n. 11
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    this->setFixedSize(this->size());
    miksys = new MIKSYS();
    QObject::connect(ui->display, SIGNAL(addByteToKeyboardQueue(unsigned char)), miksys, SLOT(addByteToKeyboardQueue(unsigned char)));
    miksys->serial_in = fopen("../miksys_soft/serial_in", "r");
    miksys->serial_out = fopen("../miksys_soft/serial_out", "w");
    ui->display->setMIKSYS(miksys);
    core = new FastCore(miksys, (char*)"../miksys_soft/ustartup/startup.bin");
    updateLEDs(miksys->buttonState);
    timerId = -1;
    showInfo();
    running = false;
    RunThread* t = new RunThread();
    t->w = this;
    freq = 0;
    t->start();
}
Esempio n. 12
0
int main()
{
    // Mute the speaker
    speaker=0.0;
    
    while(1) { //This is the game loo`p
            paintFrame(); //Render the scene
            updateLEDs(); // Pain the scene
            wait_ms(50);  // Wait 50ms, so there are 20 fps
            
            double rotSpeed=0; //Angular speed
            speaker=0.0;//Mute the speaker each frame
            
            //These buttons allow to turn left/right
            if(ain2.read() < 0.1){
                rotSpeed= 0.05;
            }
            if(ain.read() < 0.1){
                rotSpeed= -0.05;
            }
            //If the clicky button is down, try to move forward
            if(pushbutton){
                if(map[round(playerX+playerDirX/50)][round(playerY+playerDirY/50)]==0){ //If the taarget coordinates are empty, move
                    playerX+=playerDirX/20;
                    playerY+=playerDirY/20;
                }else{
                    speaker=1; //If not, notify with a beep
                }
            }
            
            //Update the direction and plane vectors according to the angular speed
            double oldDirX = playerDirX;
            playerDirX = playerDirX * cos(-rotSpeed) - playerDirY * sin(-rotSpeed);
            playerDirY = oldDirX * sin(-rotSpeed) + playerDirY * cos(-rotSpeed);
            double oldPlaneX = playerPlaneX;
            playerPlaneX = playerPlaneX * cos(-rotSpeed) - playerPlaneY * sin(-rotSpeed);
            playerPlaneY = oldPlaneX * sin(-rotSpeed) + playerPlaneY * cos(-rotSpeed);
    }
}
Esempio n. 13
0
void taskUpdateRxMain(void)
{
    processRx();
    isRXDataNew = true;

#if !defined(BARO) && !defined(SONAR)
    // updateRcCommands sets rcCommand, which is needed by updateAltHoldState and updateSonarAltHoldState
    updateRcCommands();
#endif
    updateLEDs();

#ifdef BARO
    if (sensors(SENSOR_BARO)) {
        updateAltHoldState();
    }
#endif

#ifdef SONAR
    if (sensors(SENSOR_SONAR)) {
        updateSonarAltHoldState();
    }
#endif
}
void changeLED(int led, int state){
  //Used for single LED manipulation
	
	
//----------------->code cut here<-----------------

//These are used in the bitwise math that we use to change individual LEDs
//For more details http://en.wikipedia.org/wiki/Bitwise_operation
	int bits[] = {B00000001, B00000010, B00000100, B00001000,
              B00010000, B00100000, B01000000, B10000000};
	int masks[] = {B11111110, B11111101, B11111011, B11110111,
               B11101111, B11011111, B10111111, B01111111};
/*
 * changeLED(int led, int state) - changes an individual LED 
 * LEDs are 0 to 7 and state is either 0 - OFF or 1 - ON
 */
 	
  	 ledState = ledState & masks[led];  //clears ledState of the bit we are addressing

   //if the bit is on we will add it to ledState
     if(state == ON){ledState = ledState | bits[led];} 
     	updateLEDs(ledState);              //send the new LED state to the shift register
 }
Esempio n. 15
0
int main(void) {
	SystemInit();
	clearLEDs();
	uint8_t currentLED = 0;	
	uint8_t buttonState = 0;
	uint8_t mode = 0; 
	int8_t direction = 0;
	for(;;) { 
	/* uses an idle function to absorb extra time--at OCR0A = 15, should run at 120 Hz (every 8.3 ms) */
		while(tick == 0) { } //idle
		tick = 0;
		buttonState = test_for_press_only();
	
		if (buttonState & 0x01) {
			valueLEDs[currentLED] = 0;
			if (currentLED == 0) {
				currentLED = 15;
			}
			else {
				currentLED--;
			}
			valueLEDs[currentLED] = 10;
		}
		if (buttonState & 0x02) {
			valueLEDs[currentLED] = 0;
			if (currentLED == 15) {
				currentLED = 0;
			}
			else {
				currentLED++;
			}
			valueLEDs[currentLED] = 10;
		}
		displayFader();
		updateLEDs(currentLEDstate1, currentLEDstate2);
	}
}
Esempio n. 16
0
void MainWindow::nextStep() {
    miksys->buttonState = ui->softButton->isChecked();
    core->update();
    core->handleNext();
    updateLEDs(miksys->LEDstate);
}
Esempio n. 17
0
void msl::on_verticalSlider_white_valueChanged(int value)
{
	if (value)
		this->ui.verticalSlider_uv->setValue(0);
	updateLEDs();
}
Esempio n. 18
0
void LCDServer::parseTokens(const QStringList &tokens, QTcpSocket *socket)
{
    //
    //  parse commands coming in from the socket
    //

    if (tokens[0] == "HALT" ||
       tokens[0] == "QUIT" ||
       tokens[0] == "SHUTDOWN")
    {
        shutDown();
    }
    else if (tokens[0] == "HELLO")
    {
        sendConnected(socket);
    }
    else if (tokens[0] == "SWITCH_TO_TIME")
    {
        switchToTime(socket);
    }
    else if (tokens[0] == "SWITCH_TO_MUSIC")
    {
        switchToMusic(tokens, socket);
    }
    else if (tokens[0] == "SWITCH_TO_VOLUME")
    {
        switchToVolume(tokens, socket);
    }
    else if (tokens[0] == "SWITCH_TO_GENERIC")
    {
        switchToGeneric(tokens, socket);
    }
    else if (tokens[0] == "SWITCH_TO_MENU")
    {
        switchToMenu(tokens, socket);
    }
    else if (tokens[0] == "SWITCH_TO_CHANNEL")
    {
        switchToChannel(tokens, socket);
    }
    else if (tokens[0] == "SWITCH_TO_NOTHING")
    {
        switchToNothing(socket);
    }
    else if (tokens[0] == "SET_VOLUME_LEVEL")
    {
        setVolumeLevel(tokens, socket);
    }
    else if (tokens[0] == "SET_GENERIC_PROGRESS")
    {
        setGenericProgress(tokens, socket);
    }
    else if (tokens[0] == "SET_MUSIC_PROGRESS")
    {
        setMusicProgress(tokens, socket);
    }
    else if (tokens[0] == "SET_MUSIC_PLAYER_PROP")
    {
        setMusicProp(tokens, socket);
    }
    else if (tokens[0] == "SET_CHANNEL_PROGRESS")
    {
        setChannelProgress(tokens, socket);
    }
    else if (tokens[0] == "UPDATE_LEDS")
    {
        updateLEDs(tokens, socket);
    }
    else if (tokens[0] == "STOP_ALL")
    {
        if (m_lcd)
            m_lcd->stopAll();
    }
    else if (tokens[0] == "RESET")
    {
        // reset lcd & reload settings
        if (m_lcd)
            m_lcd->reset();
    }
    else
    {
        QString did_not_parse = tokens.join(" ");

        if (debug_level > 0)
            LOG(VB_GENERAL, LOG_ERR, "LCDServer::failed to parse this: " +
                did_not_parse);

        sendMessage(socket, "HUH?");
    }
}
Esempio n. 19
0
/// \brief Connect general signals and device management signals.
void OpenHantekMainWindow::connectSignals() {
	// Connect general signals
	connect(this, SIGNAL(settingsChanged()), this, SLOT(applySettings()));
	//connect(this->dsoWidget, SIGNAL(stopped()), this, SLOT(stopped()));
	connect(this->dsoControl, SIGNAL(statusMessage(QString, int)), this->statusBar(), SLOT(showMessage(QString, int)));
	connect(this->dsoControl, SIGNAL(samplesAvailable(const std::vector<std::vector<double> > *, double, bool, QMutex *)), this->dataAnalyzer, SLOT(analyze(const std::vector<std::vector<double> > *, double, bool, QMutex *)));
	
	// Connect signals to DSO controller and widget
	connect(this->horizontalDock, SIGNAL(samplerateChanged(double)), this, SLOT(samplerateSelected()));
	connect(this->horizontalDock, SIGNAL(timebaseChanged(double)), this, SLOT(timebaseSelected()));
	connect(this->horizontalDock, SIGNAL(frequencybaseChanged(double)), this->dsoWidget, SLOT(updateFrequencybase(double)));
	connect(this->horizontalDock, SIGNAL(recordLengthChanged(unsigned long)), this, SLOT(recordLengthSelected(unsigned long)));
	//connect(this->horizontalDock, SIGNAL(formatChanged(HorizontalFormat)), this->dsoWidget, SLOT(horizontalFormatChanged(HorizontalFormat)));
	
	connect(this->triggerDock, SIGNAL(modeChanged(Dso::TriggerMode)), this->dsoControl, SLOT(setTriggerMode(Dso::TriggerMode)));
	connect(this->triggerDock, SIGNAL(modeChanged(Dso::TriggerMode)), this->dsoWidget, SLOT(updateTriggerMode()));
	connect(this->triggerDock, SIGNAL(modeChanged(Dso::TriggerMode)), this->hardControl, SLOT(updateLEDs()));
	connect(this->triggerDock, SIGNAL(sourceChanged(bool, unsigned int)), this->dsoControl, SLOT(setTriggerSource(bool, unsigned int)));
	connect(this->triggerDock, SIGNAL(sourceChanged(bool, unsigned int)), this->dsoWidget, SLOT(updateTriggerSource()));
	connect(this->triggerDock, SIGNAL(sourceChanged(bool, unsigned int)), this->hardControl, SLOT(updateLEDs()));
	connect(this->triggerDock, SIGNAL(slopeChanged(Dso::Slope)), this->dsoControl, SLOT(setTriggerSlope(Dso::Slope)));
	connect(this->triggerDock, SIGNAL(slopeChanged(Dso::Slope)), this->dsoWidget, SLOT(updateTriggerSlope()));
	connect(this->triggerDock, SIGNAL(slopeChanged(Dso::Slope)), this->hardControl, SLOT(updateLEDs()));
	connect(this->dsoWidget, SIGNAL(triggerPositionChanged(double)), this->dsoControl, SLOT(setPretriggerPosition(double)));
	connect(this->dsoWidget, SIGNAL(triggerLevelChanged(unsigned int, double)), this->dsoControl, SLOT(setTriggerLevel(unsigned int, double)));
	
	connect(this->voltageDock, SIGNAL(usedChanged(unsigned int, bool)), this, SLOT(updateUsed(unsigned int)));
	connect(this->voltageDock, SIGNAL(usedChanged(unsigned int, bool)), this->dsoWidget, SLOT(updateVoltageUsed(unsigned int, bool)));
	connect(this->voltageDock, SIGNAL(usedChanged(unsigned int, bool)), this->hardControl, SLOT(updateLEDs()));
	connect(this->voltageDock, SIGNAL(couplingChanged(unsigned int, Dso::Coupling)), this->dsoControl, SLOT(setCoupling(unsigned int, Dso::Coupling)));
	connect(this->voltageDock, SIGNAL(couplingChanged(unsigned int, Dso::Coupling)), this->dsoWidget, SLOT(updateVoltageCoupling(unsigned int)));
	connect(this->voltageDock, SIGNAL(couplingChanged(unsigned int, Dso::Coupling)), this->hardControl, SLOT(updateLEDs()));
	connect(this->voltageDock, SIGNAL(modeChanged(Dso::MathMode)), this->dsoWidget, SLOT(updateMathMode()));
	connect(this->voltageDock, SIGNAL(gainChanged(unsigned int, double)), this, SLOT(updateVoltageGain(unsigned int)));
	connect(this->voltageDock, SIGNAL(gainChanged(unsigned int, double)), this->dsoWidget, SLOT(updateVoltageGain(unsigned int)));
	connect(this->dsoWidget, SIGNAL(offsetChanged(unsigned int, double)), this, SLOT(updateOffset(unsigned int)));
	
	connect(this->spectrumDock, SIGNAL(usedChanged(unsigned int, bool)), this, SLOT(updateUsed(unsigned int)));
	connect(this->spectrumDock, SIGNAL(usedChanged(unsigned int, bool)), this->dsoWidget, SLOT(updateSpectrumUsed(unsigned int, bool)));
	connect(this->spectrumDock, SIGNAL(magnitudeChanged(unsigned int, double)), this->dsoWidget, SLOT(updateSpectrumMagnitude(unsigned int)));
	
	// Started/stopped signals from oscilloscope	
	connect(this->dsoControl, SIGNAL(samplingStarted()), this, SLOT(started()));
	connect(this->dsoControl, SIGNAL(samplingStarted()), this->hardControl, SLOT(started()));
	connect(this->dsoControl, SIGNAL(samplingStopped()), this, SLOT(stopped()));
	connect(this->dsoControl, SIGNAL(samplingStopped()), this->hardControl, SLOT(stopped()));
	
	//connect(this->dsoControl, SIGNAL(recordLengthChanged(unsigned long)), this, SLOT(recordLengthChanged()));
	connect(this->dsoControl, SIGNAL(recordTimeChanged(double)), this, SLOT(recordTimeChanged(double)));
	connect(this->dsoControl, SIGNAL(samplerateChanged(double)), this, SLOT(samplerateChanged(double)));
	
	connect(this->dsoControl, SIGNAL(availableRecordLengthsChanged(QList<unsigned int>)), this->horizontalDock, SLOT(availableRecordLengthsChanged(QList<unsigned int>)));
	connect(this->dsoControl, SIGNAL(samplerateLimitsChanged(double, double)), this->horizontalDock, SLOT(samplerateLimitsChanged(double, double)));

	// Hard Events
	connect(this->hardControl, SIGNAL(new_event(int, int)), this, SLOT(hard_event(int, int)));
	connect(this->hardControl, SIGNAL(new_event(int, int)), this->dsoWidget, SLOT(hard_event(int, int)));
	connect(this->hardControl, SIGNAL(new_event(int, int)), this->horizontalDock, SLOT(hard_event(int, int)));
	connect(this->hardControl, SIGNAL(new_event(int, int)), this->triggerDock, SLOT(hard_event(int, int)));
	connect(this->hardControl, SIGNAL(new_event(int, int)), this->voltageDock, SLOT(hard_event(int, int)));
}
Esempio n. 20
0
void Foo::update()
{
	updateSteps();
	updateFoos();
	updateLEDs();
}
Esempio n. 21
0
void main() {
    int i = 0;
    int j = 0;
    char test[2] = {'2', '\0'};

    systemSetup(&globalData);

#if FRONT_NOT_BACK
    TRISAbits.RA0 = 0;
    ANSELAbits.ANSA0 = 0;

    printMainMenu(&globalData);
#else
    //    TRISDbits.RD4 = 0;
    //    ANSELDbits.ANSD4 = 0;
    //    PORTDbits.RD4 = 1;
#endif



    while (1) {
#if FRONT_NOT_BACK


        // get the updated cards
        if (globalData.runGetUpdatedCards == 1) {
            getUpdatedCards();
            globalData.runGetUpdatedCards = FALSE;
        }
#else
        // move the reader -- if we had one -- to the proper location


        /*
         * run LED driver
         */
        if (globalData.updateLEDFlag) {
            globalData.updateLEDFlag = FALSE;
            updateLEDs();
        }
#endif

        // process pending i2c tasks
        if (globalData.sendI2C == 1) {
            sendBytes(i2cData.dataOut, i2cData.outLength);
            globalData.sendI2C = FALSE;
        }
        if (globalData.gotI2C == 1) {
            processI2C();
            globalData.gotI2C = 0;
        }

#if FRONT_NOT_BACK
        if (!globalData.keyFlag) {
            // Check keystroke
            keypad(&globalData);
        }

        if (globalData.keyFlag && !globalData.displayedKey || globalData.myRequestStatus != 0) {
            globalData.keyFlag = FALSE;
            globalData.displayedKey = TRUE;

            switch (globalData.displayPage) {
                case 0: // main menu
                    processPrintCursor(&globalData, 3, BLUE, WHITE);
                    if (globalData.newDisplay == 1) {
                        globalData.newDisplay = 0;
                        switch (globalData.cursorPos) {
                            case 0: // go to singleplayer
                                globalData.displayPage = 1;
                                printSelectGame(&globalData);
                                break;
                            case 1: // multi
                                globalData.displayPage = 2;
                                printSelectGame(&globalData);
                                break;
                            case 2: // build
                                globalData.displayPage = 3;
                                printBuild(&globalData);
                                break;
                            case 0xFF: // back
                                globalData.displayPage = 0;
                                break;
                            default:
                                globalData.displayPage = 0;
                                printMainMenu(&globalData);
                                break;
                        }
                    }
                    break;
                case 1: // display sp game menu
                    processPrintCursor(&globalData, 4, GREEN, BLACK);
                    if (globalData.newDisplay == 1) {
                        globalData.newDisplay = 0;
                        switch (globalData.cursorPos) {
                            case 0: // go to monster game
                                globalData.displayPage = 4;
                                singlePlayer(&globalData);
                                break;
                            case 1: // go to clue
                                globalData.displayPage = 5;
                                clean(BLACK);
                                prints(0, 35, WHITE, BLACK, "In Progress", 1);
                                break;
                            case 2: // go to error
                                globalData.displayPage = 6;
                                printBSOD();
                                break;
                            case 3: // go to error
                                clean(BLACK);
                                prints(0, 35, WHITE, BLACK, "In Progress", 1);
                                globalData.displayPage = 7;
                                break;
                            default:
                                globalData.displayPage = 0;
                                printMainMenu(&globalData);
                                break;
                        }
                        globalData.cursorPos = 0;
                    }
                    break;
                case 2: // display mp game menu
                    processPrintCursor(&globalData, 4, GREEN, BLACK);
                    if (globalData.newDisplay == 1) {
                        globalData.newDisplay = 0;
                        switch (globalData.cursorPos) {
                            case 0: // go to monster game
                                globalData.displayPage = 4;
                                printSelectGame(&globalData);
                                break;
                            case 1: // go to clue
                                globalData.displayPage = 5;
                                clean(BLACK);
                                prints(0, 35, WHITE, BLACK, "In Progress", 1);
                                break;
                            case 2: // go to error
                                globalData.displayPage = 6;
                                printBSOD();
                                break;
                            case 3: // go to error
                                clean(BLACK);
                                prints(0, 35, WHITE, BLACK, "In Progress", 1);
                                globalData.displayPage = 7;
                                break;
                            default:
                                globalData.displayPage = 0;
                                printMainMenu(&globalData);
                                break;
                        }
                        globalData.cursorPos = 0;
                    }
                    break;
                case 3: // build cards
                    processPrintCursor(&globalData, 4, RED, BLACK);
                    if (globalData.newDisplay == 1) {
                        globalData.newDisplay = 0;
                        switch (globalData.cursorPos) {
                            case 0: // go to monster game
                                buildCard(&globalData, 0);
                                prints(140, 35, BLACK, RED, "DONE", 1);
                                globalData.displayPage = 0;
                                printMainMenu(&globalData);
                                break;
                            case 1: // go to clue
                                buildCard(&globalData, 1);
                                prints(140, 35, BLACK, RED, "DONE", 1);
                                globalData.displayPage = 0;
                                printMainMenu(&globalData);
                                break;
                            case 2: // go to error
                                buildCard(&globalData, 2);
                                prints(140, 35, BLACK, RED, "DONE", 1);
                                globalData.displayPage = 0;
                                printMainMenu(&globalData);
                                break;
                            case 3: // go to error
                                buildCard(&globalData, 3);
                                clean(BLACK);
                                prints(140, 35, BLACK, RED, "DONE", 1);
                                globalData.displayPage = 0;
                                printMainMenu(&globalData);
                                break;
                            default:
                                globalData.displayPage = 0;
                                printMainMenu(&globalData);
                                break;
                        }
                        globalData.cursorPos = 0;
                    }
                    break;
                case 4: // singleplayer monster
                    singlePlayer(&globalData);
                    break;
                case 5: // clue sp
                    break;
                case 6: // bsod
                    break;
                case 7: // in progress, b goes back
                    if (globalData.keyPress == 0x0B) {
                        globalData.displayPage = 0;
                        printMainMenu(&globalData);
                    }
                    break;
            }
        }


        //        if (!globalData.keyFlag) {
        //            keypad(&globalData);
        //        }

        //        mainMenu(&globalData);

        //
        //        if (globalData.keyFlag && !globalData.displayedKey) { // TODO this goes into a display function
        //            globalData.keyFlag = FALSE;
        //            globalData.displayedKey = TRUE;
        //
        ////            processDisplay(globalData);
        //
        //        }


#else
        //Doing an inventory command from the Build card menu
        if (globalData.readCard != 0) {

            //            globalData.getInventory = TRUE;
            //        }
            //        if (globalData.getInventory == TRUE) {
            // get the inventory of cards
            inventoryRFID();

            // Print out each on to the LCD
            for (i = 0; i < readerData.availableUIDs; i++) {
                if (readerData.readUID[i][0] != ',') {
                    // Get rid of commas
                    processUID(readerData.readUID[i]);
                    //                    printrs(0, 24 + 8 * i, BLACK, RED, readerData.readUID[i], 1); // print first UID
                }
            }

            // got inventory, tell frontend
            i2cData.dataOut[0] = CARD_CHANGE;
            i2cData.outLength = 1;
            globalData.sendI2C = TRUE;
            i2cData.transmissionNum = 0; // begin counting slots

            // Tell UID to be quiet - Works but needs to have at least one uid in this state
            // quietRFID(readerData.readUID[0]);

            //            if (readerData.availableUIDs > 0) {
            //
            //                // block 0 high bits being 0x0000 indicates factory card, not custom
            //                // block 0 high bits being 0x0001 indicates custom card
            //                // block 0 low bits indicate the game the card is for. 0x0001 is the monster game
            //                writeRFID(readerData.readUID[0], 0x00, 0x0000, 0x0001); // 7654 3210
            //                writeRFID(readerData.readUID[0], 0x01, 0x0010, 0x0001); // hex 7-5 are for level 0x001 is level 1
            //                // hex 4 is for type 0 1 2 3
            //                // 0x0 fire, 0x1 water, 0x3 earth
            //                // last 4 are monster ID
            //
            //                //writes 8 chars in 2 addresses of memory (0x02 and 0x03 here)
            //                char8RFID(readerData.readUID[0], 0x02, "FIREDUDE");
            //                writeRFID(readerData.readUID[0], 0x04, 0x0003, 0x0201); // Move list by id, has moves 03, 02, and 01
            //                readRFID(readerData.readUID[0], 0x00);
            //                printrs(0, 32, BLACK, RED, readerData.readData, 1); // print 1st block
            //                readRFID(readerData.readUID[0], 0x01);
            //                printrs(0, 40, BLACK, RED, readerData.readData, 1); // print 2nd block
            //                readRFID(readerData.readUID[0], 0x02);
            //                printrs(0, 48, BLACK, RED, readerData.readData, 1); // print 3rd block
            //                readRFID(readerData.readUID[0], 0x03);
            //                printrs(0, 56, BLACK, RED, readerData.readData, 1); // print 4th block
            //                readRFID(readerData.readUID[0], 0x04);
            //                printrs(0, 64, BLACK, RED, readerData.readData, 1); // print 5th block
            //            }
            //
            //
            //            readRFID(readerData.readUID[0], 0x01);
            //            // Print out block on to the LCD
            //            for (j = 0; j < readerData.availableUIDs; j++) {
            //                if (readerData.readUID[j][0] != ',') {
            //                    // Get rid of commas
            //                    printrs(0, 24 + 8 * i + 8 * j, BLACK, RED, readerData.readUID[j], 1); // print first UID
            //                }
            //            }
            //
            //            prints(0, H - 8, BLACK, RED, "Press B to go back.", 1);
            //            // Turn off inventory flag

            //            globalData.getInventory = FALSE;
            globalData.readCard = 0;
        }
#endif
    }
    return;


}
Esempio n. 22
0
void msl::on_pushButton_UVmax_clicked()
{
	this->ui.verticalSlider_uv->setValue(255);
        updateLEDs();
}