예제 #1
0
/**
 * @brief Disable timers
 */
static void timesync_disable_timers(void) {
    STM32_TIM_DISABLEINT(timesync_strobe_timer, 0);
    STM32_TIM_SETMODE(timesync_strobe_timer, STM32_TIM_MODE_DISABLED);
    STM32_TIM_SETCLOCK(timesync_strobe_timer, 0);
    STM32_TIM_DISABLEINT(timesync_rollover_master_timer, 0);
    STM32_TIM_SETMODE(timesync_rollover_master_timer, STM32_TIM_MODE_DISABLED);
    STM32_TIM_SETCLOCK(timesync_rollover_master_timer, 0);
    STM32_TIM_DISABLEINT(timesync_rollover_slave_timer, 0);
    STM32_TIM_SETMODE(timesync_rollover_slave_timer, STM32_TIM_MODE_DISABLED);
    STM32_TIM_SETCLOCK(timesync_rollover_slave_timer, 0);
}
예제 #2
0
/**
 * @brief Responsible for sending out the TIME_SYNC pulse
 *
 * Logs the time of the strobe and strobes. If the requested iteration
 * count is reached we transition to the TIMESYNC_STATE_ACTIVE state or
 * the TIMESYNC_STATE_DEBUT_INIT state depending on CONFIG_ARCH_TIMESYNC_DEBUG.
 *
 */
static int timesync_strobe_handler(int irq, void *context, void *priv) {
    irqstate_t flags;
    uint64_t strobe_time;

    flags = irqsave();

    STM32_TIM_ACKINT(timesync_strobe_timer, irq);

    timesync_strobe(timesync_pin_strobe_mask, &strobe_time);
    timesync_log_frame_time(strobe_time);

    if (timesync_strobe_index == timesync_strobe_count) {
        STM32_TIM_DISABLEINT(timesync_strobe_timer, 0);
        STM32_TIM_SETMODE(timesync_strobe_timer, STM32_TIM_MODE_DISABLED);
        STM32_TIM_SETCLOCK(timesync_strobe_timer, 0);
#ifdef CONFIG_ARCH_TIMESYNC_DEBUG
        timesync_set_state(TIMESYNC_STATE_DEBUG_INIT);
        sem_post(&dbg_thread_sem);
#else
        timesync_set_state(TIMESYNC_STATE_ACTIVE);
#endif
    }

    irqrestore(flags);
    return 0;
}
예제 #3
0
static int up_lcdextcominisr(int irq, void *context)
{
  STM32_TIM_ACKINT(tim, 0);
  if (g_isr == NULL)
    {
      lcddbg("error, irq not attached, disabled\n");
      STM32_TIM_DISABLEINT(tim, 0);
      return OK;
    }

  return g_isr(irq, context);
}
예제 #4
0
파일: stm32_lcd.c 프로젝트: dagar/NuttX
static int up_lcdextcominisr(int irq, void *context, void *arg)
{
  STM32_TIM_ACKINT(tim, ATIM_SR_UIF);
  if (g_isr == NULL)
    {
      lcderr("ERROR: error, irq not attached, disabled\n");
      STM32_TIM_DISABLEINT(tim, 0);
      return OK;
    }

  return g_isr(irq, context, arg);
}
예제 #5
0
static void up_lcddispcontrol(bool on)
{
  lcddbg("set: %s\n", on ? "on" : "off");

  if (on)
    {
      stm32_gpiowrite(GPIO_MEMLCD_DISP, 1);
      STM32_TIM_ENABLEINT(tim, 0);
    }
  else
    {
      stm32_gpiowrite(GPIO_MEMLCD_DISP, 0);
      STM32_TIM_DISABLEINT(tim, 0);
    }
}