Example #1
0
static void _filterAndSampleWindowInit(int mc, int md) {
	mcsif_SetInputFilter(mc, md, 0L);
  	mcsif_SetSWDeadband(mc, md, 0L);
  	mcsif_SetSWPOL(mc, md, MCSIF_SWPOL_REMAIN);
  	mcsif_SetSamplWin(mc, md, MCSIF_SWSTART_DISABLE + MCSIF_SWEND_NOW);
  	mcsif_SetSamplWin(mc, md, MCSIF_SWSTART_NOW + MCSIF_SWEND_DISABLE);
}
DMP_INLINE(void) mcmsif_init(int32_t mc)
{
    mcsif_SetInputFilter(mc, MCSIF_MODULEB, 20L);
    mcsif_SetSWDeadband(mc, MCSIF_MODULEB, 0L);
    mcsif_SetSWPOL(mc, MCSIF_MODULEB, MCSIF_SWPOL_REMAIN);
    mcsif_SetSamplWin(mc, MCSIF_MODULEB, MCSIF_SWSTART_DISABLE + MCSIF_SWEND_NOW);
    mcsif_SetSamplWin(mc, MCSIF_MODULEB, MCSIF_SWSTART_NOW + MCSIF_SWEND_DISABLE);

    mcsif_SetMode(mc, MCSIF_MODULEB, MCSIF_PFAU);               // enable MC2 SIFA

    mcpfau_SetCapMode1(mc, MCSIF_MODULEB, MCPFAU_CAP_DISABLE);
    mcpfau_SetCapInterval1(mc, MCSIF_MODULEB, 1L);              // pin1 for FAUTRIG
    mcpfau_SetCap1INT(mc, MCSIF_MODULEB, 1L);
    mcpfau_SetPolarity1(mc, MCSIF_MODULEB, MCPFAU_POL_NORMAL);
    mcpfau_SetMask1(mc, MCSIF_MODULEB, MCPFAU_MASK_NONE);
    mcpfau_SetRLDTRIG1(mc, MCSIF_MODULEB, MCPFAU_RLDTRIG_DISABLE);
    mcpfau_SetFAU1TRIG(mc, MCSIF_MODULEB, MCPFAU_FAUTRIG_INPUT1);
    mcpfau_SetFAU1RELS(mc, MCSIF_MODULEB, MCPFAU_FAURELS_INPUT0);

    mcpfau_SetCapMode2(mc, MCSIF_MODULEB, MCPFAU_CAP_DISABLE);     // pin2 for RLDTRIG
    mcpfau_SetCapInterval2(mc, MCSIF_MODULEB, 1L);
    mcpfau_SetCap2INT(mc, MCSIF_MODULEB, 1L);
    mcpfau_SetPolarity2(mc, MCSIF_MODULEB, MCPFAU_POL_NORMAL);
    mcpfau_SetMask2(mc, MCSIF_MODULEB, MCPFAU_MASK_NONE);
    mcpfau_SetRLDTRIG2(mc, MCSIF_MODULEB, MCPFAU_RLDTRIG_DISABLE);
    mcpfau_SetFAU2TRIG(mc, MCSIF_MODULEB, MCPFAU_FAUTRIG_INPUT1);
    mcpfau_SetFAU2RELS(mc, MCSIF_MODULEB, MCPFAU_FAURELS_INPUT0);

    mcpfau_SetCapMode3(mc, MCSIF_MODULEB, MCPFAU_CAP_DISABLE);
    mcpfau_SetCapInterval3(mc, MCSIF_MODULEB, 1L);              // pin3 for FAUTRIG
    mcpfau_SetCap3INT(mc, MCSIF_MODULEB, 1L);
    mcpfau_SetPolarity3(mc, MCSIF_MODULEB, MCPFAU_POL_NORMAL);
    mcpfau_SetMask3(mc, MCSIF_MODULEB, MCPFAU_MASK_NONE);
    mcpfau_SetRLDTRIG3(mc, MCSIF_MODULEB, MCPFAU_RLDTRIG_DISABLE);
    mcpfau_SetFAU3TRIG(mc, MCSIF_MODULEB, MCPFAU_FAUTRIG_INPUT1);
    mcpfau_SetFAU3RELS(mc, MCSIF_MODULEB, MCPFAU_FAURELS_INPUT0);
#if defined (DMP_DOS_DJGPP)
    io_DisableINT();
#endif
    mcm_init[mc] = true;
#if defined (DMP_DOS_DJGPP)
    io_RestoreINT();
#endif
}
Example #3
0
static void mcmsif_init(void) {
    if(mcm_init[mc] == true) return;
    
    mcsif_SetInputFilter(mc, md, 20L);
    mcsif_SetSWDeadband(mc, md, 0L);
    mcsif_SetSWPOL(mc, md, MCSIF_SWPOL_REMAIN);
    mcsif_SetSamplWin(mc, md, MCSIF_SWSTART_DISABLE + MCSIF_SWEND_NOW);  // stop the current sampling window first
    mcsif_SetSamplWin(mc, md, MCSIF_SWSTART_NOW + MCSIF_SWEND_DISABLE);

	mcsif_SetMode(mc, md, MCSIF_PFAU);               // enable MC2 SIFA
    
    mcpfau_SetCapMode1(mc, md, MCPFAU_CAP_DISABLE);
    mcpfau_SetCapInterval1(mc, md, 1L);              // pin1 for FAUTRIG
    mcpfau_SetCap1INT(mc, md, 1L);
    mcpfau_SetPolarity1(mc, md, MCPFAU_POL_NORMAL);
    mcpfau_SetMask1(mc, md, MCPFAU_MASK_NONE);
    mcpfau_SetRLDTRIG1(mc, md, MCPFAU_RLDTRIG_DISABLE);
    mcpfau_SetFAU1TRIG(mc, md, MCPFAU_FAUTRIG_INPUT1);
    mcpfau_SetFAU1RELS(mc, md, MCPFAU_FAURELS_INPUT0);
	
    mcpfau_SetCapMode2(mc, md, MCPFAU_CAP_DISABLE);     // pin2 for RLDTRIG
    mcpfau_SetCapInterval2(mc, md, 1L);
    mcpfau_SetCap2INT(mc, md, 1L);
    mcpfau_SetPolarity2(mc, md, MCPFAU_POL_NORMAL);
    mcpfau_SetMask2(mc, md, MCPFAU_MASK_NONE);
    mcpfau_SetRLDTRIG2(mc, md, MCPFAU_RLDTRIG_DISABLE);
    mcpfau_SetFAU2TRIG(mc, md, MCPFAU_FAUTRIG_INPUT1);
    mcpfau_SetFAU2RELS(mc, md, MCPFAU_FAURELS_INPUT0);

    mcpfau_SetCapMode3(mc, md, MCPFAU_CAP_DISABLE);
    mcpfau_SetCapInterval3(mc, md, 1L);              // pin3 for FAUTRIG 
    mcpfau_SetCap3INT(mc, md, 1L);
    mcpfau_SetPolarity3(mc, md, MCPFAU_POL_NORMAL);
    mcpfau_SetMask3(mc, md, MCPFAU_MASK_NONE);
    mcpfau_SetRLDTRIG3(mc, md, MCPFAU_RLDTRIG_DISABLE);          
	mcpfau_SetFAU3TRIG(mc, md, MCPFAU_FAUTRIG_INPUT1);
	mcpfau_SetFAU3RELS(mc, md, MCPFAU_FAURELS_INPUT0);
	
	io_DisableINT();
	mcm_init[mc] = true;
	io_RestoreINT();
}