1
0
mirror of git://projects.qi-hardware.com/f32xbase.git synced 2024-11-27 21:45:20 +02:00
f32xbase/fw/example/example.c
2010-08-13 08:49:48 -03:00

57 lines
885 B
C

/*
* example/example.c - Example application
*
* Written 2010 by Werner Almesberger
* Copyright 2010 Werner Almesberger
*
* This program 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 2 of the License, or
* (at your option) any later version.
*/
#include <stdint.h>
#include "regs.h"
static void count(void)
{
union {
uint32_t n;
uint8_t a[3];
} c;
c.n = 0;
while (1) {
P0 = c.a[0];
P2 = c.a[1];
P3 = c.a[2];
c.n++;
}
}
void main(void)
{
/*
* VDD monitor enable sequence, section 7.2
*
* - enable voltage monitor
* - wait for monitor to stabilize
* - enable VDD monitor reset
*/
VDM0CN = VDMEN;
while (!(VDM0CN & VDDSTAT));
RSTSRC = PORSF;
/*
* Go to 24 Mhz
*/
OSCICN |= IFCN0 | IFCN1;
count();
}