Esempio n. 1
0
/* This is an entry point for the application.
   All application specific initialization is performed here. */
int main(void)
{
	int ret = 0;

	/* Initializes console on UART0 */
	ret = wmstdio_init(UART0_ID, 0);
	if (ret == -WM_FAIL) {
		wmprintf("Failed to initialize console on uart0\r\n");
		return -1;
	}

	wmprintf(" LED demo application started\r\n");
	wmprintf(" This application demonstrates the"
		 " use of blinking led\r\n");

	gpio_led = (board_led_2()).gpio;

	wmprintf(" LED Pin : %d\r\n", gpio_led);

	configure_gpios();
	while (1) {
		gpio_led_on();
		os_thread_sleep(os_msec_to_ticks(1000));
		gpio_led_off();
		os_thread_sleep(os_msec_to_ticks(1000));
	}
	return 0;
}
Esempio n. 2
0
void reset(void)	//same function as main()
{
	   char str[]="sunny,sunny day";//inputs are given
	   char w[]="sunny";
	   wmprintf("entered  string is :%s\n",str);//inputs are outputed
	   wmprintf("entered word :%s\n",w);

	int wcount = count(str,w);

    wmprintf("word count : %d\n",wcount);
    if (wcount>0)
    {
    	 gpio_led_on()
    }

	gpio_led = (board_led_2()).gpio; //assigning gpio pin to led
	gpio_pushbutton = board_button_2(); //assigning gpio pin to push button


	configure_gpios();
	wmprintf("Press push button to reset the program.");
	while (1)
		;
	return 0;
}
Esempio n. 3
0
//Main function, the entry point
int main(void)
{
	int uart_check = 0,i=0,j=0;
	char str[]="sunny,sunny day";//inputs are given
	char w[]="sunny";
	//Checking the status of UART
	uart_check = wmstdio_init(UART0_ID, 0);
	if (uart_check == -WM_FAIL) {
		wmprintf("Failed to initialize console on uart0\r\n");
		return -1;
	}
    	wmprintf("entered  string is :%s\n",str);//inputs are outputed
	wmprintf("entered word :%s\n",w);
	
	int wcount = count(str,w);//ouputting total words

    wmprintf("word count : %d\n",wcount);
    if (wcount>0)
    {
    	 gpio_led_on()
    }

	gpio_led = (board_led_2()).gpio; //assigning gpio pin to led
	gpio_pushbutton = board_button_2(); //assigning gpio pin to push button


	configure_gpios();
	wmprintf("Press push button to reset the program.");
	while (1)
		;
	return 0;
}
Esempio n. 4
0
/* This is an entry point for the application.
   All application specific initialization is performed here. */
int main(void)
{
	int ret = 0;

	/* Initializes console on UART0 */
	ret = wmstdio_init(UART0_ID, 0);
	if (ret == -WM_FAIL) {
		wmprintf("Failed to initialize console on uart0\r\n");
		return -1;
	}

	wmprintf(" GPIO demo application started\r\n");
	wmprintf(" This application demonstrates the"
		 " use of various GPIO driver APIs\r\n");
	wmprintf(" Press button 2 to toggle state of LED\r\n");

	gpio_led = (board_led_2()).gpio;
	gpio_pushbutton = board_button_2();

	wmprintf(" LED Pin : %d\r\n", gpio_led);
	wmprintf(" Pushbutton Pin : %d\r\n", gpio_pushbutton);

	configure_gpios();
	while (1)
		;
	return 0;
}
Esempio n. 5
0
/* Configure GPIO pins to be used as LED and push button */
static void configure_gpios()
{
	/* Get the corresponding pin numbers using the board specific calls */
	/* also configures the gpio accordingly for LED */
	led_1 = board_led_1();
	led_2 = board_led_2();
	button_1 = board_button_1();
	button_2 = board_button_2();

    push_button_set_cb((input_gpio_cfg_t){button_1, GPIO_ACTIVE_LOW}, pushbutton_cb, 0, 0, 0);
    push_button_set_cb((input_gpio_cfg_t){button_2, GPIO_ACTIVE_LOW}, pushbutton_cb, 0, 0, 0);
}
Esempio n. 6
0
/* This is an entry point for the application.
   All application specific initialization is performed here. */
int main(void)
{
    int ret = 0;
    TaskHandle_t blinkLEDHandle = NULL;
    int priority;

    /* Initializes console on UART0 */
    ret = wmstdio_init(UART0_ID, 0);
    if (ret == -WM_FAIL)
    {
        wmprintf("Failed to initialize console on uart0\r\n");
        return -1;
    }

    wmprintf(" LED demo application started\r\n");
    wmprintf(" This application demonstrates the"
                  " use of blinking led\r\n");

    gpio_led = (board_led_2()).gpio;

    wmprintf(" LED Pin : %d\r\n", gpio_led);

    configure_gpios();

    xTaskCreate(prvBlinkLedTask, "Blink led", ( uint16_t ) BLINK_LED_STACK_SIZE, NULL, ( ( UBaseType_t ) BLINK_LED_TASK_PRIORITY ) | portPRIVILEGE_BIT, &blinkLEDHandle);
    // dump blink led task related information
    if (NULL != blinkLEDHandle)
    {
        priority = uxTaskPriorityGet(blinkLEDHandle);
        wmprintf("blink led priority is %d\r\n", priority);
        wmprintf("blink led task name:%s\r\n", pcTaskGetTaskName(blinkLEDHandle));
    }
    wmprintf("run blink led task for 30 seconds\r\n");
    vTaskDelay(30000);
    wmprintf("delete blink led task\r\n");
    if (NULL != blinkLEDHandle)
    {
        vTaskDelete(blinkLEDHandle);
        blinkLEDHandle = NULL;
    }
    while (1)
    {
        vTaskDelay(1000);
    }
    return 0;
}
Esempio n. 7
0
// TO override the pin start mode in mc200_startup.c, so that LED are off at startup
void SetPinStartMode(void)
{
    GPIO_PinModeConfig(board_led_1().gpio, PINMODE_PULLUP);
    GPIO_PinModeConfig(board_led_2().gpio, PINMODE_PULLUP);
}