Exemplo n.º 1
0
/* The ISR executed when the user button is pushed. */
void GPIO8_IRQHandler( void )
{
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;

	/* The button was pushed, so ensure the LED is on before resetting the
	LED timer.  The LED timer will turn the LED off if the button is not
	pushed within 5000ms. */
	ulGPIOState &= ~mainTIMER_CONTROLLED_LED;
	MSS_GPIO_set_outputs( ulGPIOState );

	/* This interrupt safe FreeRTOS function can be called from this interrupt
	because the interrupt priority is below the
	configMAX_SYSCALL_INTERRUPT_PRIORITY setting in FreeRTOSConfig.h. */
	xTimerResetFromISR( xLEDTimer, &xHigherPriorityTaskWoken );

	/* Clear the interrupt before leaving. */
    MSS_GPIO_clear_irq( MSS_GPIO_8 );

	/* If calling xTimerResetFromISR() caused a task (in this case the timer
	service/daemon task) to unblock, and the unblocked task has a priority
	higher than or equal to the task that was interrupted, then
	xHigherPriorityTaskWoken will now be set to pdTRUE, and calling
	portEND_SWITCHING_ISR() will ensure the unblocked task runs next. */
	portEND_SWITCHING_ISR( xHigherPriorityTaskWoken );
}
Exemplo n.º 2
0
void GPIO28_IRQHandler( void ) // TODO: rename to SPI_0_IRQHandler
{
	MSS_SPI_set_slave_select( &g_mss_spi0, MSS_SPI_SLAVE_0 );
	rx_data = MSS_SPI_transfer_frame( &g_mss_spi0, '.' );
	MSS_SPI_clear_slave_select( &g_mss_spi0, MSS_SPI_SLAVE_0 );

	uint8_t end = (spi_rx_buffer_start + spi_rx_buffer_count) % spi_rx_buffer_size;
	spi_rx_buffer[end] = rx_data;

	if ( spi_rx_buffer_count != spi_rx_buffer_size )
	{
		spi_rx_buffer_count++;
	}

	//cmd_length = 0;
	if ( spi_rx_buffer[end] == '\n' )
	{
		uint8_t i;
		for ( i = 0; i < spi_rx_buffer_count-1; i++ )
		{
			spi_cmd_buf[i] = spi_rx_buffer[(spi_rx_buffer_start + i) % spi_rx_buffer_size];
		}
		spi_cmd_buf[spi_rx_buffer_count-1] = '\0';
		spi_cmd_length = spi_rx_buffer_count;

		spi_rx_buffer_start = spi_cmd_length % spi_rx_buffer_size;
		spi_rx_buffer_count = 0;
	}

	MSS_GPIO_clear_irq( MSS_GPIO_SPI_0_IT );
}
Exemplo n.º 3
0
__attribute__ ((interrupt)) void RFID_Handler(void)
{
	MSS_GPIO_clear_irq( MSS_GPIO_1 );

	if(!_rfid_init_done) {
		return;
	}
	xSemaphoreGive(rfid_top_sem);
	MSS_GPIO_disable_irq(MSS_GPIO_1);
}
Exemplo n.º 4
0
void on_pulse(void){
	MSS_GPIO_clear_irq(gpio_i_i);
	if(pulse_direction == BRIGHTER) {
		if(master_brightness < full_brightness)
			set_brightness(master_brightness+1);
		else
			pulse_direction = DIMMER;
	} else {
		if(master_brightness > min_brightness)
			set_brightness(master_brightness-1);
		else
			pulse_direction = BRIGHTER;
	}
}
Exemplo n.º 5
0
__attribute__((__interrupt__)) void GPIO9_IRQHandler( void )
{
	if(ledState1 == off)
	{
		ledOn(1);
		ledState1 = on;
	}
	else if(ledState1 == on)
	{
		ledOff(1);
		ledState1 = off;
	}

    /*
     * Clear interrupt both at the GPIO and Cortex-M3 interrupt controller levels.
     */
    MSS_GPIO_clear_irq( MSS_GPIO_9 );
}
Exemplo n.º 6
0
void pwm_blue(){
	MSS_GPIO_clear_irq(gpio_b_i);
	pwm_timer_handler(gpio_b, blue_timer_id);
}
Exemplo n.º 7
0
void pwm_green(){
	MSS_GPIO_clear_irq(gpio_g_i);
	pwm_timer_handler(gpio_g, green_timer_id);
}
Exemplo n.º 8
0
void pwm_red(){
	MSS_GPIO_clear_irq(gpio_r_i);
	pwm_timer_handler(gpio_r, red_timer_id);
}