Exemplo n.º 1
0
_u8   ispEnterProgmode(stkEnterProgIsp_t *param)
{
    _u8   i, rval;
    ispAttachToDevice(stkParam.s.sckDuration, param->stabDelay);
    delay(param->cmdExeDelay);
    /* we want for(i = param->synchLoops; i--;), but avrdude sends synchLoops == 0 */
    for(i = 32; i--;){
        wdt_reset();
        rval = ispBlockTransfer(param->cmd, param->pollIndex);
        if(param->pollIndex < 4)
            ispBlockTransfer(param->cmd + param->pollIndex, 4 - param->pollIndex);
        if(rval == param->pollValue){   /* success: we are in sync */
            return STK_STATUS_CMD_OK;
        }
        /* insert one clock pulse and try again: */
        DIGITAL_WRITE(ISP_SCK, HIGH);
        timerTicksDelay(ispClockDelay);
        DIGITAL_WRITE(ISP_SCK, LOW);
        timerTicksDelay(ispClockDelay);
    }
    ispDetachFromDevice();
    return STK_STATUS_CMD_FAILED;   /* failure */
}
void    ispLeaveProgmode(stkLeaveProgIsp_t *param)
{
    ispDetachFromDevice(param->preDelay);
    timerMsDelay(param->postDelay);
}
Exemplo n.º 3
0
void    ispLeaveProgmode(stkLeaveProgIsp_t *param)
{
    ispDetachFromDevice();
    delay(param->postDelay);
}