Esempio n. 1
0
void stmpe811_gpioworker(FAR struct stmpe811_dev_s *priv)
{
  uint8_t regval;
  uint8_t pinmask;
  int pin;

  /* Get the set of pending GPIO interrupts */

  regval = stmpe811_getreg8(priv, STMPE811_GPIO_INTSTA);

  /* Look at each pin */

  for (pin = 0; pin < STMPE811_GPIO_NPINS; pin++)
    {
      pinmask = GPIO_INT(pin);
      if ((regval & pinmask) != 0)
        {
          /* Check if we have a handler for this interrupt (there should
           * be one)
           */

          if (priv->handlers[pin])
            {
              /* Interrupt is pending... dispatch the interrupt to the
               * callback
               */

              priv->handlers[pin](pin);
            }
          else
            {
              illdbg("No handler for PIN%d, GPIO_INTSTA: %02x\n", pin, regval);
            }

          /* Clear the pending GPIO interrupt by writing a '1' to the
           * pin position in the status register.
           */

          stmpe811_putreg8(priv, STMPE811_GPIO_INTSTA, pinmask);
        }
    }
}
Esempio n. 2
0
int main(void)
{
    /*!< At this stage the microcontroller clock setting is already configured,
         this is done through SystemInit() function which is called from startup
         file (startup_stm32f0xx.s) before to branch to application main.
         To reconfigure the default setting of SystemInit() function, refer to
         system_stm32f0xx.c file
       */

    /* GPIOB Periph clock enable */

    uint8_t i = 0;
    uint8_t buffptr[5] = "ABCD";

    GPIO_INT();
    USART1_Config();


    if (SysTick_Config(SystemCoreClock / 200))
    {
        /* Capture error */
        while (1);
    }









    /* Start user code. Do not edit comment generated here */
    bpm_ctrl.state = BPM_STATE_INITIAL;
//    	key_ctrl.state = KEY_STATE_INITIAL;
    pmp_ctrl.state = PMP_STATE_INITIAL;
    vlv_ctrl.state = VLV_STATE_INITIAL;
//    	rtc_ctrl.state = RTC_STATE_INITIAL;
//    	lcd_ctrl.state = LCD_STATE_INITIAL;
//    	log_ctrl.state = LOG_STATE_INITIAL;
//    	R_TAU0_Channel7_Start();
//   	R_IT_Start();



#if 1

    while (1U)
    {

        bpm_main(); //include sensor task
//        key_task();
        pump_task();
        valve_task();
//        rtc_task();
//        lcd_task();
//        log_task();




        /* TIM3 Main Output Enable */

        /*yy test*******************************************************************************/
//				vlv_ctrl.phase = 0x00;
//				valve_open();
//				vlv_ctrl.phase = 0x00;
//				valve_close();

//			pmp_ctrl.phase = 0x00;
//			pump_on();
//			pmp_ctrl.phase = 0x00;
//			pump_off();

//
//		Delay(1);
//
//		STM_EVAL_LEDToggle(LED3);


//TIM_ForcedOC1Config( TIM3,TIM_ForcedAction_InActive );

//TIM_ForcedOC1Config( TIM3,TIM_OCMode_PWM1 );

//{TIM3->CCER&=0xFFFE;}
        /*yy test********************************************************************************/

    }

#endif








































//	TIM_Config();





    /* To achieve GPIO toggling maximum frequency, the following  sequence is mandatory.
       You can monitor PC8 and PC9 on the scope to measure the output signal.
       If you need to fine tune this frequency, you can add more GPIO set/reset
       cycles to minimize more the infinite loop timing.
       This code needs to be compiled with high speed optimization option.  */
#if 0


#endif



}