Exemplo n.º 1
0
/*
 * Each configurable module implements this function. The implementation
 * is idempotent. The most recent call defines the parameter's value.
 */
static int distributeParameter (b_instance* inst, ConfigContext * cfg) {

  int n = 0;

#ifdef CFG_MAIN

  printf ("%s:%d:[%s]=[%s]\n",
	  cfg->fname,
	  cfg->linenr,
	  cfg->name,
 	  cfg->value);

#else

  n += mainConfig (cfg);
  n += midiConfig (inst->midicfg, cfg);
  n += pgmConfig (inst->progs, cfg);
  n += oscConfig (inst->synth, cfg);
  n += scannerConfig (inst->synth, cfg);
  n += ampConfig (inst->preamp, cfg);
  n += whirlConfig (inst->whirl, cfg);
  n += reverbConfig (inst->reverb, cfg);
#ifdef HAVE_ZITACONVOLVE
  n += convolutionConfig(cfg);
#endif

  if (n == 0) {
    fprintf (stderr, "%s:%d:%s=%s:Not claimed by any module.\n",
	    cfg->fname,
	    cfg->linenr,
	    cfg->name,
	    cfg->value);
  } else {
    rc_add_cfg(inst->state, cfg);
  }

#endif /* CFG_MAIN */

  return n;
}
Exemplo n.º 2
0
int main(void)
{
    clearIntrflags();
    oscConfig();
    tmrInit1();
    pwmInit();
    adc_init();

    // all ports digital
    ANSA = 1; // an1 = analog
    ANSB = 0;

    //LED_COMMON_TRIS = 0; not used since this port is now used as PWM output for FAN
    LED_RED_TRIS = 0;
    LED_RED = 0;

    RELAY_1_TRIS = 0;
    RELAY_2_TRIS = 0;
    RELAY_1_TRANSFORMER = 1;

    while (1) {
        ClrWdt();
        if (tmrExpired1mS) {
            tmrExpired1mS = 0;

            static UINT tmrExpired10mS = 9;
            if (++tmrExpired10mS == 10) {
                tmrExpired10mS = 0;
                serviceUserEvents();
            }

            static UINT tmrExpired2mS = 1;
            if (++tmrExpired2mS == 2) {
                tmrExpired2mS = 0;

            }
            pwmSetA(lightController(&wc));
            pwmSetB(lightController(&badkamer));
        }

        if (tmrExpired500mS) {
            tmrExpired500mS = FALSE;
            systemAutoShutdownWhenIdle();

            static UINT tmrExpired1000mS = 0;
            if (++tmrExpired1000mS == 2) {
                tmrExpired1000mS = 0;
                sensorOperation();
            }

        }

        if (tmrExpired1minute) {

            tmrExpired1minute = FALSE;
            lightsAutoOfftmr();
        }
    }

    return 0;
}