示例#1
0
int main(void)
{
    gpioConfig(N_LED_ORANGE_PORT, N_LED_ORANGE_PIN, GPIO_OUTPUT | GPIO_LOW);
    gpioConfig(N_LED_YELLOW_PORT, N_LED_YELLOW_PIN, GPIO_OUTPUT | GPIO_LOW);
    gpioConfig(N_LED_GREEN_PORT,  N_LED_GREEN_PIN,  GPIO_OUTPUT | GPIO_LOW);
    gpioConfig(N_LED_BLUE_PORT,   N_LED_BLUE_PIN,   GPIO_OUTPUT | GPIO_LOW);

    for (;;) {
        delay();
        gpioClear(N_LED_ORANGE_PORT, N_LED_ORANGE_PIN);
        delay();
        gpioClear(N_LED_YELLOW_PORT, N_LED_YELLOW_PIN);
        delay();
        gpioClear(N_LED_GREEN_PORT, N_LED_GREEN_PIN);
        delay();
        gpioClear(N_LED_BLUE_PORT, N_LED_BLUE_PIN);

        delay();
        gpioSet(N_LED_ORANGE_PORT, N_LED_ORANGE_PIN);
        delay();
        gpioSet(N_LED_YELLOW_PORT, N_LED_YELLOW_PIN);
        delay();
        gpioSet(N_LED_GREEN_PORT, N_LED_GREEN_PIN);
        delay();
        gpioSet(N_LED_BLUE_PORT, N_LED_BLUE_PIN);
    }

    return 0;
}
示例#2
0
int main(void) {

    int numBlinks = 10;

    gpioConfig(N_LED_BLUE_PORT,   N_LED_BLUE_PIN,   GPIO_OUTPUT | GPIO_LOW);
    gpioConfig(N_LED_GREEN_PORT,  N_LED_GREEN_PIN,  GPIO_OUTPUT | GPIO_LOW);
    gpioConfig(N_LED_YELLOW_PORT, N_LED_YELLOW_PIN, GPIO_OUTPUT | GPIO_LOW);

    for (;;) {


        /* -------- 100 MHz (external clock) -----------
         * Configure the Multipurpose Clock Generator output to use the external
         * clock locked with a PLL at the maximum frequency of 100MHZ
         *
         * For PLL, the dividers must be set first.
         *
         * System:  100 MHz
         * Bus:      50 MHz
         * Flexbus:  50 MHz
         * Flash:    25 MHz
         */
        clockSetDividers(DIVIDE_BY_1, DIVIDE_BY_2, DIVIDE_BY_4, DIVIDE_BY_4);
        clockConfigMcgOut(MCG_PLL_EXTERNAL_100MHZ);
        flashLed(N_LED_BLUE_PORT, N_LED_BLUE_PIN, numBlinks);


        /* -------- 24 MHz (slow internal clock) -----------
         * Configure the Multipurpose Clock Generator output to use the internal
         * 4MHz clock locked with FLL (internal clocks can only be locked with
         * the FLL) at 24MHz.
         *
         * For FLL, the clock dividers be set before or after. (but not before 
         * PLL)
         *
         * System:   24 MHz
         * Bus:       3 MHz
         * Flexbus:   3 MHz
         * Flash:     3 MHz
         */
        clockConfigMcgOut(MCG_FLL_INTERNAL_24MHZ);
        clockSetDividers(DIVIDE_BY_1, DIVIDE_BY_8, DIVIDE_BY_8, DIVIDE_BY_8);
        flashLed(N_LED_GREEN_PORT, N_LED_GREEN_PIN, numBlinks);
        

        /* --------  6 MHz (slow internal clock) -----------
         * With the output still at 24MHz, the dividers are quartered. Therefore,
         * the new output will be 6MHz.
         *
         * System:    6 MHz
         * Bus:       1.5 MHz
         * Flexbus:   1.5 MHz
         * Flash:     1.5 MHz
         */
        clockSetDividers(DIVIDE_BY_4, DIVIDE_BY_16, DIVIDE_BY_16, DIVIDE_BY_16);
        flashLed(N_LED_YELLOW_PORT, N_LED_YELLOW_PIN, numBlinks);
    }

    return 0;
}
示例#3
0
int main(void)
{
    clocksInit();
    systickInit();
    chSysInit();

    gpioConfig(N_LED_ORANGE_PORT, N_LED_ORANGE_PIN, GPIO_OUTPUT | GPIO_LOW);
    gpioConfig(N_LED_YELLOW_PORT, N_LED_YELLOW_PIN, GPIO_OUTPUT | GPIO_LOW);

    chThdCreateStatic(waThread1, sizeof(waThread1), NORMALPRIO, Thread1, NULL);

    hwInterruptsEnable();

    while (TRUE) {
        chThdSleepMilliseconds(123);
        gpioToggle(N_LED_ORANGE_PORT, N_LED_ORANGE_PIN);
    }

    return 0;
}
示例#4
0
文件: main.c 项目: cpantel/ciaa
void TecInit() {
  gpioConfig(TEC1, GPIO_INPUT);
  gpioConfig(TEC2, GPIO_INPUT);
}
示例#5
0
文件: main.c 项目: cpantel/ciaa
void MonitorInit() {
   gpioConfig(LED1, GPIO_OUTPUT);
}
示例#6
0
文件: main.c 项目: cpantel/ciaa
void BlinkLed1Init() {
   gpioConfig(LED1, GPIO_OUTPUT); 
}
示例#7
0
文件: main.c 项目: cpantel/ciaa
void ReadTec1Init() {
   gpioConfig(TEC1, GPIO_INPUT); 
}
示例#8
0
int main(void)
{
    int spiFd;
    int fdPot;
    uint32_t updateUserTick  = 0;

    ftmCfg_t ftmPWM = {
        .mode = FTM_MODE_PWM,
        .mod  = 0,
        .initCount     = 0,
        .channels      = { FTM_CH_0, FTM_CH_1,  FTM_CH_2,
                           FTM_CH_3, FTM_CH_4,  FTM_CH_5,
                           FTM_CH_NONE},
        .pwmFreq       = PWM_FREQ,

        .pwmCfgBits    = FTM_PWM_CFG_COMBINED_MODE_CHS_0_1
                       | FTM_PWM_CFG_COMBINED_MODE_CHS_2_3
                       | FTM_PWM_CFG_COMBINED_MODE_CHS_4_5
                       | FTM_PWM_CFG_COMPLEMENTARY_CH_0_1
                       | FTM_PWM_CFG_COMPLEMENTARY_CH_2_3
                       | FTM_PWM_CFG_COMPLEMENTARY_CH_4_5
                       | FTM_PWM_CFG_OUTPUT_MASK
                       | FTM_PWM_CFG_CENTER_ALINGNED
                       ,
        .triggerBits   = FTM_TRIGGER_INIT, /* TODO setup PDB off this trigger
                                            * to run ADC captures of current.
                                            */
        .deadTime      = 1, /* 1/10 uSec */
        .dutyScaled    = { 0.6 * UNITY, 0.6 * UNITY , 0.6 * UNITY ,
                           0.6 * UNITY, 0.6 * UNITY , 0.6 * UNITY},
        .activeLow     = { TRUE, FALSE, TRUE, FALSE, TRUE, FALSE },
    };

    ftmCfg_t ftmCh2QD = {
        .mode = FTM_MODE_QUADRATURE_DECODE,
        .mod  = QUAD_CALL_BACK_COUNT,
        .initCount = 0,
        .quadCfg = FTM_QUAD_CONFIG_FILTER_MED,
    };

    setClock();
    uart_install();
    spi_install();
    adc_install();


    /*
     * Register the standard I/O streams with a particular deivce driver.
     */
    int fd1 = fdevopen(stdout, "uart3", 0, 0);
    ioctl(fd1, IO_IOCTL_UART_BAUD_SET, 115200);
    assert(fd1 != -1);


    gpioConfig(FET_DRIVER_ENABLE_PORT, FET_DRIVER_ENABLE_PIN,
                                      GPIO_OUTPUT | GPIO_DSE | GPIO_PULLUP);
    gpioClear(FET_DRIVER_ENABLE_PORT, FET_DRIVER_ENABLE_PIN);

    gpioConfig(FET_DRIVER_RESET_PORT, FET_DRIVER_RESET_PIN,
                                       GPIO_OUTPUT | GPIO_DSE | GPIO_PULLUP);
    gpioClear(FET_DRIVER_RESET_PORT, FET_DRIVER_RESET_PIN);

    gpioConfig(ENCODER_INDEX_PORT, ENCODER_INDEX_PIN, GPIO_INPUT
                                                   | GPIO_PULLUP);

#if 0
    gpioConfig(HALL_A_PORT, HALL_A_PIN, GPIO_INPUT | GPIO_PULLDOWN);
    gpioConfig(HALL_B_PORT, HALL_B_PIN, GPIO_INPUT | GPIO_PULLDOWN);
    gpioConfig(HALL_C_PORT, HALL_C_PIN, GPIO_INPUT | GPIO_PULLDOWN);
#endif
    gpioConfig(IRQ_PORT, IRQ_PIN, GPIO_INPUT | GPIO_PULLDOWN);

        /* Install irq handler for driver and over current interrupts (PTA27)
         * and phase B,C Hall sensors */
    PORT_PCR(IRQ_PORT, IRQ_PIN) |= PORT_IRQC_INT_RISING_EDGE;

    PORT_PCR(ENCODER_INDEX_PORT, ENCODER_INDEX_PIN)
                                                   |= PORT_IRQC_INT_RISING_EDGE;
#if 0
    PORT_PCR(HALL_A_PORT, HALL_A_PIN) |= PORT_IRQC_INT_EITHER_EDGE;
    PORT_PCR(HALL_B_PORT, HALL_B_PIN) |= PORT_IRQC_INT_EITHER_EDGE;
    PORT_PCR(HALL_C_PORT, HALL_C_PIN) |= PORT_IRQC_INT_EITHER_EDGE;
#endif
    hwInstallISRHandler(ISR_GPIO_A, portAIsr);
    hwInstallISRHandler(ISR_GPIO_B, indexIsr);
#if 0
    hwInstallISRHandler(ISR_GPIO_D, portAIsr);
#endif

                                                                      /* LEDs */
    gpioConfig(N_LED_ORANGE_PORT, N_LED_ORANGE_PIN, GPIO_OUTPUT | GPIO_LOW);
    gpioConfig(N_LED_YELLOW_PORT, N_LED_YELLOW_PIN, GPIO_OUTPUT | GPIO_LOW);
    gpioConfig(N_LED_GREEN_PORT,  N_LED_GREEN_PIN,  GPIO_OUTPUT | GPIO_LOW);
    gpioConfig(N_LED_BLUE_PORT,   N_LED_BLUE_PIN,   GPIO_OUTPUT | GPIO_LOW);
                                                                 /* setup pit */
    pitInit(PIT_0, pit0ISR, 5000);

    hwSetISRPriority(IRQ_PIT0, 0x0F);


                                                                 /* setup ftm */
    ftmInit(FTM_0, callBackFtm0, &ftmPWM);
#if 0
    ftmInit(FTM_2, callBackFtm2, &ftmCh2QD);
#else
    ftmInit(FTM_2, 0, &ftmCh2QD);
#endif

    hwSetISRPriority(IRQ_FTM0, 0x0F);
    hwSetISRPriority(IRQ_FTM2, 0x0F);

    ftmWrite(FTM_2, 1000, 0);
                         /* Install spi into the device table before using it */
    spiFd = open("spi2", 0, 0);
    assert(spiFd != -1);

    ioctl(spiFd, IO_IOCTL_SPI_SET_PORT_PCRS, 0);
    ioctl(spiFd, IO_IOCTL_SPI_SET_BAUD, SPI_BAUDRATE_CLKDIV_32);
    ioctl(spiFd, IO_IOCTL_SPI_SET_SCLK_MODE, SPI_SCLK_MODE_2);
    ioctl(spiFd, IO_IOCTL_SPI_SET_FMSZ, 8);
    ioctl(spiFd, IO_IOCTL_SPI_SET_OPTS, SPI_OPTS_MASTER);
    ioctl(spiFd, IO_IOCTL_SPI_SET_CS, SPI_CS_0);
    ioctl(spiFd, IO_IOCTL_SPI_SET_CS_INACT_STATE, SPI_CS_0_INACT_HIGH);
    ioctl(spiFd, IO_IOCTL_SPI_SET_METHOD, SPI_METHOD_POLLED);


    initFetPreDriver(FTM_0, spiFd);


                                                                 /* ADC Setup */
    fdPot = open("adc0", 0, 0);
    if (fdPot==-1) {
        assert(0);
    }

    ioctl(fdPot, IO_IOCTL_ADC_CALIBRATE, TRUE);


    ioctl(fdPot, IO_IOCTL_ADC_SAMPLE_SIZE_SET, 1);
    ioctl(fdPot, IO_IOCTL_ADC_CALL_BACK_SET, (int)potCallBackHandler);
    ioctl(fdPot, IO_IOCTL_ADC_VREF_SELECT, IO_IOCTL_ADC_VREF_FLAGS_DEFAULT);
    ioctl(fdPot, IO_IOCTL_ADC_TRIGGER_SELECT, IO_IOCTL_ADC_TRIGGER_SELECT_SW);
    ioctl(fdPot, IO_IOCTL_ADC_CONVERSION_CONTINUOUS, TRUE);
    ioctl(fdPot, IO_IOCTL_ADC_CONVERSION_TIME_SELECT,
                 IO_IOCTL_ADC_CONVERSION_TIME_FLAGS_ADLSTS_ADCK_2);
    ioctl(fdPot, IO_IOCTL_ADC_AVERAGE_SELECT, IO_IOCTL_ADC_FLAGS_AVGS_4);
    ioctl(fdPot, IO_IOCTL_ADC_RESOLUTION_SELECT, IO_IOCTL_ADC_RES_FLAGS_12_BIT);
    ioctl(fdPot, IO_IOCTL_ADC_CLOCK_SELECT, IO_IOCTL_ADC_FLAGS_ADICLK_BUS);
    ioctl(fdPot, IO_IOCTL_ADC_DIFFERENTIAL_SET,
                (IO_IOCTL_ADC_CHANNEL_FLAGS_REGISTER_A
                  | IO_IOCTL_ADC_DIFF_FLAGS_SINGLE_ENDED));
    ioctl(fdPot, IO_IOCTL_ADC_CHANNEL_SELECT,
                 (IO_IOCTL_ADC_CHANNEL_FLAGS_REGISTER_A
                    | (IO_IOCTL_ADC0_CHANNEL_FLAGS_ADC0_DP0
      //              | (IO_IOCTL_ADC1_CHANNEL_FLAGS_ADC1_DM1
                       & IO_IOCTL_ADC_CHANNEL_FLAGS_CH_MASK)));

    hwSetISRPriority(IRQ_ADC0, 0x0A);

    while(1){

        switch (motorState) {
        default:
            /* Do nothing */
            break;
        case MOTOR_STATE_OFF:
            /* Turn off motor outputs */
            ftmSetOutputMask(FTM_0, MASK_ALL_OUTPUTS, TRUE);
            taskDelay(1000);
            motorState = MOTOR_STATE_ALIGN;
            break;
        case MOTOR_STATE_ALIGN:
            {
                svm_t svmAlign;
                svmAlign = resolveSVM(MOTOR_ALIGN_DRIVE, 0);
                ftmPwmWrite(FTM_0, FTM_CH_1, svmAlign.pwmADuty, FALSE);
                ftmPwmWrite(FTM_0, FTM_CH_3, svmAlign.pwmBDuty, FALSE);
                ftmPwmWrite(FTM_0, FTM_CH_5, svmAlign.pwmCDuty, FALSE);
                /* Turn on motor outputs */
                ftmSetOutputMask(FTM_0, MASK_NO_OUTPUTS, TRUE);
                taskDelay(250);
                printf("Aligning  %f %f %f \n", svmAlign.pwmADuty / 32768.0,
                       svmAlign.pwmBDuty /32768.0, svmAlign.pwmCDuty / 32768.0);
                printf("Set encoder count %d \n", ftmWrite(FTM_2, 1000, 0));
                motorOutput = MOTOR_ALIGN_DRIVE;
                motorState = MOTOR_STATE_RUN;
            }
            break;
        }

        if (updateFlags & UPDATE_HALT) {
            updateFlags &= ~UPDATE_HALT;
            break;
        }

#if 0
        if (tickGet() > updateStatusTick) {
            updateStatusTick = tickGet() + 5;
#if 0
            if (pwmRampUp) {
                motorOutput += 0.0005 * UNITY;
            } else {
                motorOutput -= 0.0005 * UNITY;
            }
            if (motorOutput > 0.4 * UNITY) {
                motorOutput = 0.4 * UNITY;
                updateStatusTick = tickGet() + 1000;
                pwmRampUp = FALSE;
            } else if (motorOutput < 0.1 * UNITY) {
                motorOutput = 0.1 * UNITY;
                pwmRampUp = TRUE;
                updateStatusTick = tickGet() + 1000;
            }
#endif
        }
#endif

        if (tickGet() > updateUserTick) {
            int count  = ftmRead(FTM_2);

            printf("%d,[%3.2f], %3.2f, %3.2f,  0000, "
                   "%d, <<%3.2f>>%3.2f, %3.2f, %3.2f\n",
                   // angleSetPoint / 32768.0,
                    count,
                    angleSetPoint / 32768.0,
                    mechTheta     / 32768.0,
                    theta         / 32768.0,
                    svmOutput.sinLUTIdx,
                    motorOutput / 32768.0,
                    svmOutput.pwmADuty/32768.0,
                    svmOutput.pwmBDuty/32768.0,
                    svmOutput.pwmCDuty/32768.0);

            updateUserTick = tickGet() + 20;
        }
    }

    close(fdPot);
    printf("Application Fatal Error! \n");
    while(1) {};
    return 0;
}
示例#9
0
文件: main.c 项目: cpantel/ciaa
void ShowElapsedTimeInit() {
   gpioConfig(LED1, GPIO_OUTPUT); 
}
示例#10
0
文件: main.c 项目: cpantel/ciaa
void BlinkLed3Init() {
   gpioConfig(LED3, GPIO_OUTPUT); 
}
示例#11
0
void  performCommandPLC()
{
	UINT8  ui8NameStrDL[15];
	
	UINT32  pos;
	UINT32  err = SUCCESS;
	UINT32  ui32dstDirPos;
	
	switch(ucHMI_addr)
	{
		case  PLC_TIME:
			stime.tm_sec = uiHMIWord[PLC_TIME+5];
			stime.tm_min = uiHMIWord[PLC_TIME+4];
			stime.tm_hour = uiHMIWord[PLC_TIME+3];
			stime.tm_mday = uiHMIWord[PLC_TIME+2];
			stime.tm_mon = uiHMIWord[PLC_TIME+1];
			stime.tm_year = uiHMIWord[PLC_TIME]-1900;
			timeSet(&stime);
			#if  C_LEVI_DEBUG
			    printf("time=%d/%d/%d %d:%d:%d  ",uiHMIWord[PLC_TIME],uiHMIWord[PLC_TIME+1],uiHMIWord[PLC_TIME+2],uiHMIWord[PLC_TIME+3],uiHMIWord[PLC_TIME+4],uiHMIWord[PLC_TIME+5]);
			#endif
			if((uiHMIWord[PLC_TIME]!=2000)||(uiHMIWord[PLC_TIME+1]!=01))
				ui8TimeFlag = 1;
			timeGet(&ptime);
			sio_psprintf(ui8NameStrDL, "%02d%02d%02dDC.CSV", (UINT32)(ptime->tm_year-100)%100, ptime->tm_mon,ptime->tm_mday);
			xdcfCurRootDirSet(ui8TermModule);
			//mp3_GetFileList();
			
			pos = myFindFile(ui8NameStrDL);
			myGetSingleDayDL(pos, &ui32SuccessNum);
			break;
		case  PLC_PARA_BUF:
			memcpy((UINT8 *)&curDevice, (UINT8 *)&uiHMIWord[PLC_PARA_BUF], C_PLC_PARA_NUM*sizeof(UINT16));
			#if  C_LEVI_DEBUG
			    printf("device=%d, class=%d  ",uiHMIWord[PLC_MODULE_NO],uiHMIWord[PLC_MODULE_NO+1]);
			#endif
			getModuleName(ui16CurModule, ui8TermModule);
			
			writePara();
			//readPara();
			break;
		case  PLC_MODULE_NO:
			#if  C_LEVI_DEBUG
			    printf("device=%d, class=%d  ",uiHMIWord[PLC_MODULE_NO],uiHMIWord[PLC_MODULE_NO+1]);
			#endif
			ui16CurModule = uiHMIWord[PLC_MODULE_NO];
			ui16CurClass = uiHMIWord[PLC_MODULE_NO+1];
			getModuleName(ui16CurModule, ui8TermModule);
			
			readPara();
			writePara();			
			readParadelaytime();			
			writeParadelaytime();
			break;			
	  case TESTSTEP0:
	  	test_step0=(~uiHMIWord[TESTSTEP0])&0xffff;
	  	test_step1=(~uiHMIWord[TESTSTEP1])&0xff;
	  	test_mode=(uiHMIWord[TestMode]&0x01);
	  	printf("test_step0=%d, test_step1=%d, test_mode=%d ",test_step0,test_step1,test_mode);
	  	break;
	  case delay_time:
	  	memcpy((UINT8 *)&delay,(UINT8 *)&uiHMIWord[delay_time],C_delay_NUM*sizeof(UINT16));
	  	//memcpy((UINT8 *)&uiHMIWord[delay_time], (UINT8 *)&delay, C_delay_NUM*sizeof(UINT16));
	  	getModuleName(ui16CurModule, ui8TermModule);
			writeParadelaytime();
			//readParadelaytime();
	  	break;
		case  PLC_BAKCMD:
			gpioConfig(GPIO_CARD_DET, 0);
			gpioSet(GPIO_CARD_DET, 1);
			if(gpioGet(GPIO_CARD_DET)==0)
			{
				err = xdcfActiveDevIdSet(DRIVE_SD);
				xdcfInit(imageDirNameStr, imageFileNameStr, 0);
				dirInit();
				if(err==SUCCESS)
				{
					xdcfChange2Root();
					vfsMkdir(ui8TermModule);
					xdcfCurRootDirSet(ui8TermModule);
					xdcfCurDirPosGet(&ui32dstDirPos);
					myXdcfDelFile();
					xdcfActiveDevIdSet(DRIVE_NAND);
					xdcfCurRootDirSet(ui8TermModule);
					xdcfChange2Root();
					vfsChdir(ui8TermModule);
					err |= myXdcfCopyDisk(ui32dstDirPos);
					if(uiHMIWord[PLC_BAKCMD])
					{
						myXdcfDelFile();
					}
					if(err==SUCCESS)
						uiHMIWord[PLC_BAKINFO] = 2;
					else
						uiHMIWord[PLC_BAKINFO] = 4;  // ¶ÁSD¿¨´íÎó
				}
				else
				{
					uiHMIWord[PLC_BAKINFO] = 4;  // ¶ÁSD¿¨´íÎó
				}
			}
			else
			{
				uiHMIWord[PLC_BAKINFO] = 3;  // ûÓÐSD¿¨
			}
			#if  C_FILE_DEBUG
			    printf("backup end  ");
			#endif
			break;
		default:
			break;
	}
}
示例#12
0
文件: main.c 项目: cpantel/ciaa
int main(void){

   /* ------------- INICIALIZACIONES ------------- */

   boardConfig();


   gpioConfig(TEC1, GPIO_INPUT);
   gpioConfig(TEC2, GPIO_INPUT);
   gpioConfig(TEC3, GPIO_INPUT);
   gpioConfig(TEC4, GPIO_INPUT);

   gpioConfig(LED1, GPIO_OUTPUT);
   gpioConfig(LED2, GPIO_OUTPUT);
   gpioConfig(LED3, GPIO_OUTPUT);

  
   bool_t led1 = false;
   bool_t led2 = false;
   bool_t led3 = false;

   int delayTime1 = 250;
   int delayTime2 = 250;
   int delayTime3 = 250;

   delay_t delay1;
   delay_t delay2;
   delay_t delay3;

 
   delayConfig( &delay1, delayTime1 );
   delayConfig( &delay2, delayTime2 );
   delayConfig( &delay3, delayTime3 );

   while(1) {
      if (delayRead(&delay1)) {
         gpioWrite( LED1, led1 );
         led1 = ! led1;
         delayWrite(&delay1,delayTime1);
      }
      if (delayRead(&delay2)) {
         gpioWrite( LED2, led2 );
         led2 = ! led2;
         delayWrite(&delay2,delayTime2);
      }
      if (delayRead(&delay3)) {
         gpioWrite( LED3, led3 );
         led3 = ! led3;
         delayWrite(&delay3,delayTime3);
      }

      if (! gpioRead(TEC1)) {
         delayTime1 = 250;
         delayTime2 = 250;
         delayTime3 = 250;
      }
      if (! gpioRead(TEC2)) {
         delayTime1 = 250;
         delayTime2 = 500;
         delayTime3 = 750;
      }
      if (! gpioRead(TEC3)) {
         delayTime1 = 750;
         delayTime2 = 500;
         delayTime3 = 250;
      }
      if (! gpioRead(TEC4)) {
         delayTime1 = 1000;
         delayTime2 = 1000;
         delayTime3 = 1000;
      }




   }

   return 0 ;
}