Exemplo n.º 1
0
/*
 *  ======== EK_TM4C123GXL_initGPIO ========
 */
void EK_TM4C123GXL_initGPIO(void)
{
    /* Setup the LED GPIO pins used */
    GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_1); /* EK_TM4C123GXL_LED_RED */
    GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_2); /* EK_TM4C123GXL_LED_GREEN */
    GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_3); /* EK_TM4C123GXL_LED_BLUE */

    /* Setup the button GPIO pins used */
    GPIOPinTypeGPIOInput(GPIO_PORTF_BASE, GPIO_PIN_4);  /* EK_TM4C123GXL_GPIO_SW1 */
    GPIOPadConfigSet(GPIO_PORTF_BASE, GPIO_PIN_4, GPIO_STRENGTH_4MA, GPIO_PIN_TYPE_STD_WPU);

    /* PF0 requires unlocking before configuration */
    HWREG(GPIO_PORTF_BASE + GPIO_O_LOCK) = GPIO_LOCK_KEY;
    HWREG(GPIO_PORTF_BASE + GPIO_O_CR) |= GPIO_PIN_0;
    GPIOPinTypeGPIOInput(GPIO_PORTF_BASE, GPIO_PIN_0);  /* EK_TM4C123GXL_GPIO_SW2 */
    GPIOPadConfigSet(GPIO_PORTF_BASE, GPIO_PIN_0, GPIO_STRENGTH_4MA, GPIO_PIN_TYPE_STD_WPU);
    HWREG(GPIO_PORTF_BASE + GPIO_O_LOCK) = GPIO_LOCK_M;

    /* Once GPIO_init is called, GPIO_config cannot be changed */
    GPIO_init();

    GPIO_write(EK_TM4C123GXL_LED_RED, EK_TM4C123GXL_LED_OFF);
    GPIO_write(EK_TM4C123GXL_LED_GREEN, EK_TM4C123GXL_LED_OFF);
    GPIO_write(EK_TM4C123GXL_LED_BLUE, EK_TM4C123GXL_LED_OFF);
}
Exemplo n.º 2
0
void setleds(int leds)
{
	GPIO_write(LED1, leds &  1);
	GPIO_write(LED2, leds &  2);
	GPIO_write(LED3, leds &  4);
	GPIO_write(LED4, leds &  8);
	GPIO_write(LED5, leds & 16);
}
Void cycleLED(UArg arg0, UArg arg1)
{
    unsigned int    i = 0;
    uint8_t         writeBuffer[4];
    I2C_Handle      handle;
    I2C_Params      i2cparams;
    I2C_Transaction i2c;

    I2C_Params_init(&i2cparams);
    i2cparams.bitRate = I2C_400kHz;
    handle = I2C_open(Board_I2C_TPL0401, &i2cparams);
    if (handle == NULL) {
        System_abort("I2C was not opened");
    }

    i2c.slaveAddress = Board_TPL0401_ADDR;
    i2c.readCount = 0;
    i2c.readBuf = NULL;
    i2c.writeBuf = writeBuffer;

    /* Enable the PWM oscillator */
    writeBuffer[0] = 0x00;
    writeBuffer[1] = 0x81;
    i2c.writeCount = 2;
    if (!I2C_transfer(handle, &i2c)) {
        GPIO_write(Board_LED1, Board_LED_ON);
        System_abort("Bad I2C transfer!");
    }

    /* Bring the LEDs into PWM mode */
    writeBuffer[0] = 0x8C;
    writeBuffer[1] = 0xAA;
    writeBuffer[2] = 0xAA;
    i2c.writeCount = 3;
    if (!I2C_transfer(handle, &i2c)) {
        GPIO_write(Board_LED1, Board_LED_ON);
        System_abort("Bad I2C transfer!");
    }

    i2c.writeCount = 4;
    while (true) {
        /* Point to the new LED pattern */
        i2c.writeBuf = (uint8_t *) &(rgbcmd[i]);

        if (!I2C_transfer(handle, &i2c)) {
            GPIO_write(Board_LED1, Board_LED_ON);
            System_abort("Bad I2C transfer!");
        }

        /* Reached the end of the RGB patterns; reset index */
        if (rgbcmd[++i].LED == 0x00) {
            i = 0;
        }
        Task_sleep(100);
    }
}
Exemplo n.º 4
0
void dutyminus(uint8_t data) {
	if (dutyMain > 10) {
	    GPIO_write(Board_LED1, Board_LED_OFF);
		dutyMain -= 5;
		lastCommand(dutyMain);
	} else {
	    GPIO_write(Board_LED1, Board_LED_ON);
		dutyMain = 15;
	}
}
Exemplo n.º 5
0
void dutyplus(uint8_t data) {
	if (dutyMain < 91) {
	    GPIO_write(Board_LED0, Board_LED_OFF);
		dutyMain += 5;
		lastCommand(dutyMain);
	} else {
		GPIO_write(Board_LED0, Board_LED_ON);
		dutyMain = 90;
	}
}
Exemplo n.º 6
0
void update_motor(motor_index_t index, motor_direction_t direction, uint16_t duty_tenths_perc){

	GPIO_write(STBY_MOTOR, ON);

	switch(direction){
		case CW:
			// Set the pins so that the direction is Clockwise
			GPIO_write(motors[index].dir_pins[0], ON);
			GPIO_write(motors[index].dir_pins[1], OFF);
			break;
		case CCW:
			// Set the pins so that the direction is Counter-Clockwise
			GPIO_write(motors[index].dir_pins[0], OFF);
			GPIO_write(motors[index].dir_pins[1], ON);
			break;
		case BRAKE:
			// Set the pins so that we brake
			GPIO_write(motors[index].dir_pins[0], ON);
			GPIO_write(motors[index].dir_pins[1], ON);
			break;
		case STOP:
			// Set the pins so we stop
			GPIO_write(motors[index].dir_pins[0], OFF);
			GPIO_write(motors[index].dir_pins[1], OFF);
			break;
		default:
			break;
	}

	uint32_t usec = MOTOR_PERIOD*duty_tenths_perc/1000;
	set_pulse_width(index, &usec);

}
Exemplo n.º 7
0
Void radioTask(UArg arg0, UArg arg1){

	GPIO_write(MSP_OCT1_432P401RLP_5V_EN, 1);
	GPIO_write(MSP_OCT1_432P401RLP_HX1_EN, 1);

	while(true){
		GPIO_write(MSP_OCT1_432P401RLP_HX1_TX, 1);
		Task_sleep(1000);
		GPIO_write(MSP_OCT1_432P401RLP_HX1_TX, 0);

		Task_sleep(3000);
	}
}
Exemplo n.º 8
0
/*
 *  ======== main ========
 */
int main(void)
{
    /* Call board init functions */
    Board_initGeneral();
    Board_initGPIO();

    /* Turn on user LED */
    GPIO_write(Board_LED0, Board_LED_ON);

    System_printf("Starting the SMS Door Bell example\nSystem provider is set"
                  " to SysMin. Halt the target to view any SysMin contents in"
                  " ROV.\n\n");
    /* SysMin will only print to the console when you call flush or exit */
    System_flush();

    /* Turn off All LEDs. It will be used as a connection indicator */
    GPIO_write(Board_LED0, Board_LED_ON); //Red
    //GPIO_write(Board_LED1, Board_LED_ON); //Orange
    //GPIO_write(Board_LED2, Board_LED_ON); //Green

    /* install Button callback */
    GPIO_setCallback(Board_BUTTON0, gpioButtonFxn0);

    /* Enable interrupts */
    GPIO_enableInt(Board_BUTTON0);

    /*
     *  If more than one input pin is available for your device, interrupts
     *  will be enabled on Board_BUTTON1.
     */
//    if (Board_BUTTON0 != Board_BUTTON1) {
//        /* install Button callback */
//        GPIO_setCallback(Board_BUTTON1, gpioButtonFxn1);
//        GPIO_enableInt(Board_BUTTON1);
//    }

    /*
     * The SimpleLink Host Driver requires a mechanism to allow functions to
     * execute in temporary context.  The SpawnTask is created to handle such
     * situations.  This task will remain blocked until the host driver
     * posts a function.  If the SpawnTask priority is higher than other tasks,
     * it will immediately execute the function and return to a blocked state.
     * Otherwise, it will remain ready until it is scheduled.
     */
    VStartSimpleLinkSpawnTask(SPAWN_TASK_PRI);

    /* Start BIOS */
    BIOS_start();

    return (0);
}
Exemplo n.º 9
0
int rs485_write(const unsigned char *buffer, UInt size)
{
	int i;
	int j=0;
	int num;
	GPIO_write(Board_RS485_DE_RE_PIN, RS485_WRITE);
	while(j<size)
	{
		num = UART_write(uart2, (char *)(buffer+j), 1);
		for(i=0;i<=1000;i++);
		j++;
	}
	GPIO_write(Board_RS485_DE_RE_PIN, RS485_READ);
	return num;
}
Exemplo n.º 10
0
/*
 *  ======== main ========
 */
int main(void)
{
    /* Call board init functions */
    Board_initGeneral();
    Board_initGPIO();
    Board_initUART();

    /* Construct BIOS objects */
    Task_Params taskParams;

    Task_Params_init(&taskParams);
    taskParams.stackSize = TASKSTACKSIZE;
    taskParams.stack = &task0Stack;
    taskParams.instance->name = "echo";
    Task_construct(&task0Struct, (Task_FuncPtr)echoFxn, &taskParams, NULL);

    /* Turn on user LED */
    GPIO_write(Board_LED0, Board_LED_ON);


    /* Start BIOS */
    BIOS_start();

    return (0);
}
Exemplo n.º 11
0
int rs485_read(unsigned char *buffer, UInt size)
{
	int num;
	GPIO_write(Board_RS485_DE_RE_PIN, RS485_READ);
	num = UART_read(uart2, (char *)buffer, size);
	return num;
}
Exemplo n.º 12
0
/*
 *  ======== main ========
 */
int main(void)
{
    /* Call board init functions */
    Board_initGeneral();
    Board_initGPIO();
    // Board_initDMA();
    // Board_initI2C();
    // Board_initSPI();
    // Board_initUART();
    // Board_initUSB(Board_USBDEVICE);
    // Board_initWatchdog();
    // Board_initWiFi();
    Robot_PWM_init();

    /* Turn on user LED */
    GPIO_write(Board_LED0, Board_LED_ON);

    System_printf("Starting the example\nSystem provider is set to SysMin. "
                  "Halt the target to view any SysMin contents in ROV.\n");
    /* SysMin will only print to the console when you call flush or exit */
    System_flush();

    /* Start BIOS */
    BIOS_start();


    return (0);
}
Exemplo n.º 13
0
/*
 *  ======== main ========
 */
int main(void)
{
    Task_Params taskParams;

    /* Call board init functions */
    Board_initGeneral();
    Board_initGPIO();
    Board_initSDSPI();

    /* Construct file copy Task thread */
    Task_Params_init(&taskParams);
    taskParams.stackSize = TASKSTACKSIZE;
    taskParams.stack = &task0Stack;
    Task_construct(&task0Struct, (Task_FuncPtr)taskFxn, &taskParams, NULL);

    /* Turn on user LED */
    GPIO_write(Board_LED0, Board_LED_ON);

    System_printf("Starting the FatSD Raw example\n");

    /* Start BIOS */
    BIOS_start();

    return (0);
}
Exemplo n.º 14
0
/*
 *  ======== main ========
 */
int main(void)
{
    Task_Params taskParams;

    /* Call board init functions */
    Board_initGeneral();
    Board_initGPIO();
    // Board_initI2C();
    // Board_initSDSPI();
    // Board_initSPI();
    // Board_initUART();
    // Board_initUSB(Board_USBDEVICE);
    // Board_initWatchdog();
    // Board_initWiFi();

    /* Construct heartBeat Task  thread */
    Task_Params_init(&taskParams);
    taskParams.arg0 = 1000;
    taskParams.stackSize = TASKSTACKSIZE;
    taskParams.stack = &task0Stack;
    Task_construct(&task0Struct, (Task_FuncPtr)heartBeatFxn, &taskParams, NULL);

    /* Turn on user LED */
    GPIO_write(Board_LED0, Board_LED_ON);

    System_printf("Starting the example\nSystem provider is set to SysMin. "
                  "Halt the target to view any SysMin contents in ROV.\n");
    /* SysMin will only print to the console when you call flush or exit */
    System_flush();

    /* Start BIOS */
    BIOS_start();

    return (0);
}
Exemplo n.º 15
0
/*
 *
 *  USBSTK5505_GPIO_setOutput( number, output )
 *
 *      Uint16 number   <- GPIO number
 *      Uint16 output    <- 0 : GPIO output is logic low 
 *                         1 : GPIO output is logic high
 *
 *  Description
 *      Sets the GPIO "number" to the high or low state. The GPIO must 
 *      be an output.
 *
 */
Int16 USBSTK5505_GPIO_setOutput( Uint16 number, Uint16 output )
{
    CSL_Status           status;
    
    /* Set GPIO output */
    status = GPIO_write(hGpio,number,output);

    return status;
}
Exemplo n.º 16
0
void *blink5Hz(void *bla)
{
	struct timespec request;
	request.tv_nsec = 200000000;
	request.tv_sec = request.tv_nsec / 1000000000;

	while(!SHUTDOWN)
	{
		while(count % 2 == 0)
		{
			GPIO_write(LED_PATH, LED_ON);
			clock_nanosleep(CLOCK_REALTIME, SLEEP_FLAG, &request, NULL);
			GPIO_write(LED_PATH, LED_OFF);
		 	clock_nanosleep(CLOCK_REALTIME, SLEEP_FLAG, &request, NULL);
		}
		clock_nanosleep(CLOCK_REALTIME, SLEEP_FLAG, &request, NULL);
	}
	return;
}
Exemplo n.º 17
0
static void sigintHandler(int sig)
{
	SHUTDOWN = 1;	
	printf("SIGINT erhalten! GPIO wird freigegeben..\n");
   GPIO_write(LED_PATH, LED_OFF);
	GPIO_unexport(SWITCH);
	GPIO_unexport(LED);
	pthread_exit(NULL);
	exit(0);                          /* Just interrupt clock_nanosleep() */
}
Exemplo n.º 18
0
int main(void)
{
    /* Call board init functions. */
    Board_initGeneral();
    Board_initGPIO();
    // Board_initI2C();
    // Board_initSDSPI();
    // Board_initSPI();
    // Board_initUART();
    // Board_initWatchdog();

    Clock_Params clockParams;
    Clock_Handle myClock;
    Error_Block eb;
    Task_Handle task0;

    Task_Params taskParams;
    Task_Params_init(&taskParams);

    int j;
    for(j=0; j<17; j++) {
    	buff1[j] = ' ';
    	buff2[j] = ' ';
    }
    Error_init(&eb);
    Clock_Params_init(&clockParams);
    clockParams.period = 100;
    clockParams.startFlag = TRUE;
    myClock = Clock_create(LCD_print, 10, &clockParams, &eb);
    if(myClock == 0)
    {
    	System_abort("F****n clock");
    }

    LCD_init();

    task0 = Task_create(heartBeatFxn, &taskParams, &eb);
   // sample_screen();F
    /* Turn on user LED */
    GPIO_write(Board_LED0, Board_LED_ON);



    System_printf("Starting the example\nSystem provider is set to SysMin. "
                  "Halt the target to view any SysMin contents in ROV.\n");

    //GPIO_write(4,1);
    /* SysMin will only print to the console when you call flush or exit */
    System_flush();

    /* Start BIOS */
    BIOS_start();

    return (0);
}
/*
 *  ======== taskFxn ========
 *  Task for this function is created statically. See the project's .cfg file.
 */
Void taskFxn(UArg arg0, UArg arg1)
{
#if USEGETCHAR
    int character;
#else
    char lineBuff[BUFFLENGTH];
    int rxCount;
#endif

    USBKBH_State state;

    while (true) {

    	/* Block while the device is NOT connected to the USB */
    	USBKBH_waitForConnect(BIOS_WAIT_FOREVER);

        /* Determine the status of the keyboard */
        USBKBH_getState(&state);

        /* Update LED outputs */
        GPIO_write(Board_LED0, state.capsLED ? Board_LED_ON : Board_LED_OFF);
        GPIO_write(Board_LED1, state.scrollLED ? Board_LED_ON : Board_LED_OFF);

        /* Updated the keyboard's LED status */
        USBKBH_setState(&state);

#if USEGETCHAR /* Use the getChar method */
        /* Wait for a character for 100 tick; this allows for LEDs to update */
        character = USBKBH_getChar(100);

        if (character) {
            /* Print character if it received one */
            System_printf("%c", character);
        }

#else /* Pend task until it gets an entire line (<LF>) */
        rxCount = USBKBH_getString(lineBuff, BUFFLENGTH, BIOS_WAIT_FOREVER);
        System_printf("\"%s\" size %d\n", lineBuff, rxCount);
#endif
    }
}
Exemplo n.º 20
0
/*
 *  ======== EKS_LM4F232_initGPIO ========
 */
Void EKS_LM4F232_initGPIO(Void)
{
    /* EKS_LM4F232_SW1 - EKS_LM4F232_SW5 */
  //  UChar allButtons = GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_4;

    /* Setup the LED GPIO pins used */
    GPIOPinTypeGPIOOutput(GPIO_PORTL_BASE, GPIO_PIN_0); /* EKS_LM4F232_LED1 */
    GPIOPinTypeGPIOOutput(GPIO_PORTL_BASE, GPIO_PIN_1); /* EKS_LM4F232_LED2 */
    GPIOPinTypeGPIOOutput(GPIO_PORTL_BASE, GPIO_PIN_2); /* EKS_LM4F232_LED3 */
    GPIOPinTypeGPIOOutput(GPIO_PORTL_BASE, GPIO_PIN_3); /* EKS_LM4F232_LED4 */
    GPIOPinTypeGPIOOutput(GPIO_PORTL_BASE, GPIO_PIN_4); /* EKS_LM4F232_LED5 */
    GPIOPinTypeGPIOOutput(GPIO_PORTL_BASE, GPIO_PIN_5); /* EKS_LM4F232_LED6 */
    GPIOPinTypeGPIOOutput(GPIO_PORTK_BASE, GPIO_PIN_4); /* EKS_LM4F232_DIOA0 */
    GPIOPinTypeGPIOOutput(GPIO_PORTK_BASE, GPIO_PIN_5); /* EKS_LM4F232_DIOA1 */
    GPIOPinTypeGPIOOutput(GPIO_PORTK_BASE, GPIO_PIN_6); /* EKS_LM4F232_DIODATA */
    GPIOPinTypeGPIOOutput(GPIO_PORTK_BASE, GPIO_PIN_7); /* EKS_LM4F232_DIOCLK */
    GPIOPinTypeGPIOOutput(GPIO_PORTD_BASE, GPIO_PIN_3); /* EKS_LM4F232_OBD */
    GPIOPinTypeGPIOOutput(GPIO_PORTH_BASE, GPIO_PIN_3); /* EKS_LM4F232_SD_ON */
    GPIOPinTypeGPIOOutput(GPIO_PORTN_BASE, GPIO_PIN_7); /* EKS_LM4F232_PWRRF */
    GPIOPinTypeGPIOOutput(GPIO_PORTD_BASE, GPIO_PIN_4); /* EKS_LM4F232_PWRTELIT_EN */
    /* Setup the button GPIO pins used */
    //GPIOPinTypeGPIOInput(GPIO_PORTM_BASE, allButtons);
    //GPIOPadConfigSet(GPIO_PORTM_BASE, allButtons, GPIO_STRENGTH_4MA, GPIO_PIN_TYPE_STD_WPU);

    /* Once GPIO_init is called, GPIO_config cannot be changed */
    GPIO_init();
    GPIO_write(EKS_LM4F232_LED1, EKS_LM4F232_LED_OFF);
    GPIO_write(EKS_LM4F232_LED2, EKS_LM4F232_LED_OFF);
    GPIO_write(EKS_LM4F232_LED3, EKS_LM4F232_LED_OFF);
    GPIO_write(EKS_LM4F232_LED4, EKS_LM4F232_LED_OFF);
    GPIO_write(EKS_LM4F232_LED5, EKS_LM4F232_LED_OFF);
    GPIO_write(EKS_LM4F232_LED6, EKS_LM4F232_LED_OFF);
}
Exemplo n.º 21
0
int GPIO_open()
{
    if (g_init == 1) {
        fprintf(stderr,
                "GPIO_open: I/O expander is already initialised.\n");
        return 0;
    }
    g_init = 1;
    fd = open(I2C_BUS, O_RDWR);
    if (fd == -1) {
        fprintf(stderr, "GPIO_open error: %s\n", strerror(errno));
        return -1;
    }
    if (ioctl(fd, I2C_SLAVE, I2C_ADDR) == -1) {
        fprintf(stderr, "GPIO_open: ioctl error: %s\n", strerror(errno));
        return -1;
    }
    /* Configure IO expander */
    int r = 0;
    r += GPIO_direction(PortA, PORTA_IODIR);
    r += GPIO_direction(PortB, PORTB_IODIR);
    r += exp_write(PortA, IOPOL, PORTA_IOPOL);
    r += exp_write(PortB, IOPOL, PORTB_IOPOL);
    r += exp_write(PortA, GPPU, PORTA_GPPU);
    r += exp_write(PortB, GPPU, PORTB_GPPU);

    /* Configure the GPIO pins */
    GPIOA_buf.reg = GPIOA_INIT;
    GPIOB_buf.reg = GPIOB_INIT;
    r += GPIO_write(PortA);
    r += GPIO_write(PortB);
    if (r == 0) {
        return r;
    }
    g_init = 0;
    fprintf(stderr, "GPIO_open: initialisation Error: %d\n", r);
    return r;
}
Exemplo n.º 22
0
/*
 *  ======== main ========
 */
int main(void)
{
    Clock_Handle clkHandle;
    Clock_Params clkParams;
    
    /* Call board init functions */
    Board_initGeneral();
    Board_initGPIO();
    Board_initUART();

    /* Turn on user LED */
    GPIO_write(Board_LED0, Board_LED_OFF);
    GPIO_write(Board_LED1, Board_LED_ON);   
    
    GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_0, GPIO_PIN_0);

    System_printf("Hello World\n");
    
    /* SysMin will only print to the console when you call flush or exit */
    System_flush();

    /* Create a periodic Clock Instance with period = 5 system time units */
    Clock_Params_init(&clkParams);
    clkParams.period = 1000;
    clkParams.startFlag = TRUE;
    Clock_create(clk0Fxn, 5, &clkParams, NULL);

    /* Create an one-shot Clock Instance with timeout = 11 system time units */
    clkParams.period = 0;
    clkParams.startFlag = FALSE;
    clkHandle = Clock_create(clk1Fxn, 11, &clkParams, NULL);
    Clock_start(clkHandle);

    /* Start BIOS */
    BIOS_start();

    return (0);
}
Exemplo n.º 23
0
void SPI::_SPI(const char* _spi_path, uint32_t _bps, GPIO::GPIO_pin_type _cs_pin){
	// allocate memory
	cs_pin = _cs_pin;
	cs_enable_high = false;
	fd = open(_spi_path, O_RDWR);
	if (fd < 0) {
		warn("cannot open: %s", _spi_path);
	}

	bps = _bps;

	GPIO_mode(cs_pin, GPIO::GPIO_OUTPUT);
	GPIO_write(cs_pin, (int)!cs_enable_high);
	printf("[SPI] Opened %s with FD %d\n", _spi_path, fd);
}
Exemplo n.º 24
0
//*****************************************************************************
//
//! Main application function.
//!
//! This function is meant to initialize all devices and tasks used in this
//! application. After the initialization is complete, the tasks start running.
//!
//! \return None.
//
//*****************************************************************************
int main(void)
{
    // Initialize General configurations
    Board_initGeneral();

    // Initialize GPIO
    Board_initGPIO();

    // Turn off all LEDS
    GPIO_write(Board_LED0, Board_LED_OFF);
    GPIO_write(Board_LED1, Board_LED_OFF);
    GPIO_write(Board_LED2, Board_LED_OFF);

	// Initializes interrupts
    GPIO_setCallback(Board_BUTTON0, _callback_Button_Select);
    GPIO_setCallback(Board_BUTTON1, _callback_Button_Up);
    GPIO_setCallback(Board_BUTTON2, _callback_Button_Down);
    GPIO_setCallback(Board_SENSE_RISER_DOWN, _callback_Festo_Riser_Down);
    GPIO_setCallback(Board_SENSE_RISER_UP, _callback_Festo_Riser_Up);
    GPIO_setCallback(Board_SENSE_SAMPLE_IN_PLACE, _callback_Festo_Piece_In);

    // Enable Interrupts
    GPIO_enableInt(Board_BUTTON0);
    GPIO_enableInt(Board_BUTTON1);
    GPIO_enableInt(Board_BUTTON2);
    GPIO_enableInt(Board_SENSE_RISER_DOWN);
    GPIO_enableInt(Board_SENSE_RISER_UP);
    GPIO_enableInt(Board_SENSE_SAMPLE_IN_PLACE);

    Seconds_set(1432639800);

    // Start BIOS
    BIOS_start();

    return (0);
}
/*
 *  ======== main ========
 */
int main(void)
{
    /* Call board init functions */
    Board_initGeneral();
    Board_initGPIO();
    Board_initSDSPI();
    Board_initUSBMSCHFatFs();

    /* Turn on user LED */
    GPIO_write(Board_LED0, Board_LED_ON);

    System_printf("Starting the FatSD USB Copy example\n");

    /* Start BIOS */
    BIOS_start();

    return (0);
}
/*
 *  ======== main ========
 */
int main(void)
{
    /* Call board init functions. */
    Board_initGeneral();
    Board_initGPIO();
    // Board_initI2C();
    // Board_initSDSPI();
    // Board_initSPI();
    // Board_initUART();
    // Board_initWatchdog();

    /* Turn on user LED  */
    GPIO_write(Board_LED0, Board_LED_ON);

    /* Start BIOS */
    BIOS_start();

    return (0);
}
Exemplo n.º 27
0
int main()
{
	struct sigaction sa;
	pthread_t thread;
   sigemptyset(&sa.sa_mask);
   sa.sa_flags = 0;
   sa.sa_handler = sigintHandler;

	if (sigaction(SIGINT, &sa, NULL) == -1)
	{
		printf("MAIN: reserving sigaction failed!\n");
		return -1;
	}

	
	GPIO_export(SWITCH);
	GPIO_export(LED);
	GPIO_direction(SWITCH_DIRECTION_PATH,"in");
	GPIO_direction(LED_DIRECTION_PATH,"out");
	GPIO_write(LED_PATH, LED_OFF);

	if(pthread_create(&thread, NULL , blink5Hz , NULL))
	{
		printf("MAIN: error: Thread-creation failed!\n");
		return -1;
	}

	struct timespec request;
	request.tv_nsec = 50000000;
	request.tv_sec = request.tv_nsec / 1000000000;

	printf("Push the Button ..");fflush(stdout);
	while(!SHUTDOWN)
	{
		while(strcmp(GPIO_read(SWITCH_PATH),LOW) != 0)
			clock_nanosleep(CLOCK_REALTIME, SLEEP_FLAG, &request, NULL);

		while(strcmp(GPIO_read(SWITCH_PATH),HIGH) != 0)
			clock_nanosleep(CLOCK_REALTIME, SLEEP_FLAG, &request, NULL);
		
		count++;	
	}
}
Exemplo n.º 28
0
/*
 *  ======== main ========
 */
Int main(Void)
{
    /* Call board init functions */
    Board_initGeneral();
    Board_initGPIO();
    Board_initSDSPI();

    /* Turn on user LED */
    GPIO_write(Board_LED, Board_LED_ON);

    System_printf("Starting the FatSD Raw example\nSystem provider is set to "
                  "SysMin. Halt the target and use ROV to view output.\n");
    /* SysMin will only print to the console when you call flush or exit */
    System_flush();

    /* Start BIOS */
    BIOS_start();

    return (0);
}
Exemplo n.º 29
0
/*
 *  ======== main ========
 */
int main(void)
{
    /* Call board init functions */
    Board_initGeneral();
    Board_initGPIO();
    Board_initEMAC();

    /* Turn on user LED */
    GPIO_write(Board_LED0, Board_LED_ON);

    System_printf("Starting the UDP Echo example\nSystem provider is set to "
                  "SysMin. Halt the target to view any SysMin contents in"
                  " ROV.\n");
    /* SysMin will only print to the console when you call flush or exit */
    System_flush();

    /* Start BIOS */
    BIOS_start();

    return (0);
}
/*
 *  ======== main ========
 */
int main(void)
{
    /* Call board init functions */
    Board_initGeneral();
    Board_initGPIO();
    Board_initUSB(Board_USBHOST);

    /* Turn on user LED */
    GPIO_write(Board_LED0, Board_LED_ON);

    System_printf("Starting the USB Keyboard Host example\nSystem provider is "
                  "set to SysMin. Halt the target to view any SysMin contents"
                  " in ROV.\n");
    /* SysMin will only print to the console when you call flush or exit */
    System_flush();

    USBKBH_init();

    /* Start BIOS */
    BIOS_start();

    return (0);
}