Documentation for “Zerocat Chipflasher” as of Wed, 24 Jun 2026 07:28:15 +0200
Repository: git://zerocat.org/zerocat/projects/chipflasher.git
Version: v3.0.0-0-b445ef922
Branch: master

time.spin.nointerface.html

{{

______________________________________________________________________________
********************************************************* File starts here ***
Zerocat Chipflasher --- Flash free firmware, kick the Management Engine.

Copyright (C) 2020, 2021, 2022, 2025, 2026  Kai Mertens 

File time.spin --- provide some handy timing methods

This file is part of Zerocat Chipflasher.

See end of file for terms of use.

******************************************************************************
}}



''
''
''# Object Summary
OBJ     'This directive triggers the compiler to insert a summary.



''
''
''# Loaded Objects



''
''
''# Included Files



''
''
''# Constants
CON
        ''
        ''* SPIN Interpreter Overhead
        SPIN_OVERHEAD       = 381



''
''
''# Functions


PUB     sleep (number_of_seconds) | cnt0, sec

        '' Sleep some seconds.

        sec := CLKFREQ
        cnt0 := CNT
        REPEAT number_of_seconds
            WAITCNT(cnt0 += sec)


PUB     sleep_msec (n) | cnt0, msec

        '' Sleep n milliseconds.

        msec := CLKFREQ / 1_000
        cnt0 := CNT
        REPEAT n
            WAITCNT(cnt0 += msec)


PUB     sleep_husec (n) | cnt0, husec

        '' Sleep n * 100 microseconds.

        husec := CLKFREQ / 10_000
        cnt0 := CNT
        REPEAT n
            WAITCNT(cnt0 += husec)


PUB     sleep_50us

        '' Sleep 50 microseconds.

        WAITCNT((CLKFREQ / 20_000) + CNT)


PUB     sleep_10us

        '' Sleep 10 microseconds.

        WAITCNT((CLKFREQ / 100_000) + CNT)



{{


******************************************************************************
Terms of Use:

Zerocat Chipflasher is free software: you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.

Zerocat Chipflasher is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
General Public License for more details.

You should have received a copy of the GNU General Public License along
with Zerocat Chipflasher.  If not, see <http://www.gnu.org/licenses/>.

************************************************************** End of File ***
}}