Esempio n. 1
0
int stm32_comp_setup(void)
{
  static bool initialized = false;
  struct comp_dev_s* comp = NULL;
  int ret;

  if (!initialized)
    {
      /* Get the comparator interface */

#ifdef CONFIG_STM32_COMP2
      comp = stm32_compinitialize(2);
      if (comp == NULL)
        {
          aerr("ERROR: Failed to get COMP%d interface\n", 2);
          return -ENODEV;
        }
#endif

#ifdef CONFIG_STM32_COMP4
      comp = stm32_compinitialize(4);
      if (comp == NULL)
        {
          aerr("ERROR: Failed to get COMP%d interface\n", 4);
          return -ENODEV;
        }
#endif

#ifdef CONFIG_STM32_COMP6
      comp = stm32_compinitialize(6);
      if (comp == NULL)
        {
          aerr("ERROR: Failed to get COMP%d interface\n", 6);
          return -ENODEV;
        }
#endif

      /* Register the comparator character driver at /dev/comp0 */

      ret = comp_register("/dev/comp0", comp);
      if (ret < 0)
        {
          aerr("ERROR: comp_register failed: %d\n", ret);
          return ret;
        }

      initialized = true;
    }

  return OK;
}
Esempio n. 2
0
/** \brief Initializes selector component. */
static void sys_comp_selector_init(void)
{
	comp_register(&comp_selector);
}
Esempio n. 3
0
static void sys_comp_keyword_init(void)
{
	comp_register(&comp_keyword);
}