~kris/9p

9hist

ref: 602fc1003b1173c4d4ffc04f819159a3959fd6f7 9hist/bitsy/power.c -rw-r--r-- 433 bytes
602fc100 — David du Colombier Plan 9 from Bell Labs 2000-11-22 25 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include	"u.h"
#include	"../port/lib.h"
#include	"mem.h"
#include	"dat.h"
#include	"fns.h"
#include	"io.h"
#include	"ureg.h"
#include	"init.h"
#include	"pool.h"

/* Power management for the bitsy */

static void
powerintr(Ureg*, void *x)
{
	/* Power button interrupt */
	int i;

	/* debounce, 50 ms*/
	for (i = 0; i < 50; i++) {
		delay(1);
		if ((gpioregs->level & GPIO_PWR_ON_i) == 0)
			return;	/* bounced */
	}
	rs232power(0);
}