コード例 #1
0
/** @details
 *  The digital and motor ports can (should) be configured here.
 */
void
vexUserSetup()
{
    vexDigitalConfigure( dConfig, DIG_CONFIG_SIZE( dConfig ) );
    vexMotorConfigure( mConfig, MOT_CONFIG_SIZE( mConfig ) );

    // read user parameters
    userp = vexFlashUserParamRead();
}
コード例 #2
0
ファイル: vexuser.c プロジェクト: Impact2585/convex
// Initialize the digital ports
void
vexUserSetup()
{
    vexDigitalConfigure( dConfig, DIG_CONFIG_SIZE( dConfig ) );
    vexMotorConfigure( mConfig, MOT_CONFIG_SIZE( mConfig ) );
}
コード例 #3
0
ファイル: vexuser.c プロジェクト: Impact2585/convex
// Initialize the digital ports
void
vexUserSetup()
{
    vexDigitalConfigure( dConfig, DIG_CONFIG_SIZE( dConfig ) );
}
コード例 #4
0
void
vexDigitalConfigure( vexDigiCfg *cfg, int16_t cfg_num )
{
    vexDigiCfg          *_cfg, *_cfg1, *_cfg2;
    tVexDigitalPin      i;
    tVexDigitalPin      j;
    int16_t             len;

    if( cfg == NULL ){
        _cfg = vexDefConfig;
        len = DIG_CONFIG_SIZE( vexDefConfig );
        }
    else {
        _cfg = cfg;
        len = cfg_num;
        }

    for(i=0,_cfg1=_cfg;i<len;i++,_cfg1++)
        {
        // An input ?
        if( _cfg1->cfg == kVexConfigInput )
            vexDigitalModeSet(_cfg1->pin, kVexDigitalInput );
        // An output ?
        if( _cfg1->cfg == kVexConfigOutput )
            vexDigitalModeSet(_cfg1->pin, kVexDigitalOutput );

        // An encoder ?
        if( _cfg1->cfg == kVexConfigQuadEnc1 )
            {
            // find other encoder pin
            for(j=0, _cfg2=_cfg;j<len;j++,_cfg2++)
                {
                if( (_cfg2->cfg == kVexConfigQuadEnc2) && (_cfg1->chan == _cfg2->chan ) )
                    vexEncoderAdd( _cfg1->chan, _cfg1->pin, _cfg2->pin );
                }
            }

        // A sonar ?
        if( _cfg1->cfg == kVexConfigSonarOut )
            {
            // find other encoder pin
            for(j=0, _cfg2=_cfg;j<len;j++,_cfg2++)
                {
                if( (_cfg2->cfg == kVexConfigSonarIn) && (_cfg1->chan == _cfg2->chan ) )
                    vexSonarAdd( _cfg1->chan, _cfg1->pin, _cfg2->pin );
                }
            }

        // Interrupt (experimental)
        if( _cfg1->cfg == kVexConfigInterrupt )
            {
            vexDigitalIntrSet( _cfg1->pin );
            }

        // A bit messy here
        // use the default config to save the user config.
        // obviously if there is no user config then this is superfluous.
        vexDefConfig[ _cfg1->pin ].type = _cfg1->type;
        vexDefConfig[ _cfg1->pin ].cfg  = _cfg1->cfg;
        vexDefConfig[ _cfg1->pin ].chan = _cfg1->chan;
        }
}
コード例 #5
0
void
vexCortexDefaultSetup(void)
{
    vexDigitalConfigure( dConfig, DIG_CONFIG_SIZE( dConfig ) );
    vexMotorConfigure( mConfig, MOT_CONFIG_SIZE( mConfig ) );
}