+++ /dev/null
-/*
- * File: timer.c
- *
- * Timer 0 + Timer 1 for timekeeping
- */
-
-
-#include <htc.h>
-#include "timer.h"
-
-void timer_uwait(unsigned us)
-{
- unsigned t0 = TMR0;
-
- TMR0IF = 0;
- while (us >= 32768) {
- timer_owait();
- us -= 32768;
- }
- while (us >= 16384) {
- timer_cwait(128);
- us -= 16384;
- }
- timer_cwait(us / 128);
-}
-
-void timer_mwait(unsigned ms)
-{
- unsigned t0 = TMR0;
-
- TMR0IF = 0;
- while (ms >= 32) {
- timer_owait();
- ms -= 32;
- }
- while (ms >= 16) {
- timer_cwait(128);
- ms -= 16;
- }
- timer_cwait(ms * 8);
-}