1
0
mirror of git://projects.qi-hardware.com/ben-wpan.git synced 2024-11-22 20:39:20 +02:00

atusb/fw/: moved timer initialization to board_app.c as well

- board.c (board_init), board_app.h (timer_init), board_app.c
  (timer_init): moved timer initialization from board_init to
  new function timer_init
- atusb.c (main): call timer_init
This commit is contained in:
Werner Almesberger 2011-06-11 01:52:16 -03:00
parent 2d7ee91430
commit 2acdaca218
4 changed files with 11 additions and 5 deletions

View File

@ -34,6 +34,7 @@ int main(void)
usb_init(); usb_init();
ep0_init(); ep0_init();
timer_init();
while (1) { while (1) {
usb_poll(); usb_poll();

View File

@ -135,10 +135,5 @@ void board_init(void)
CLKPR = 1 << CLKPCE; CLKPR = 1 << CLKPCE;
CLKPR = 0; CLKPR = 0;
/* configure timer 1 as a free-running CLK counter */
TCCR1A = 0;
TCCR1B = 1 << CS10;
get_sernum(); get_sernum();
} }

View File

@ -79,6 +79,7 @@ void panic(void);
void timer_poll(void); void timer_poll(void);
uint64_t timer_read(void); uint64_t timer_read(void);
void timer_init(void);
int gpio(uint8_t port, uint8_t data, uint8_t dir, uint8_t mask, uint8_t *res); int gpio(uint8_t port, uint8_t data, uint8_t dir, uint8_t mask, uint8_t *res);

View File

@ -74,6 +74,15 @@ uint64_t timer_read(void)
} }
void timer_init(void)
{
/* configure timer 1 as a free-running CLK counter */
TCCR1A = 0;
TCCR1B = 1 << CS10;
}
int gpio(uint8_t port, uint8_t data, uint8_t dir, uint8_t mask, uint8_t *res) int gpio(uint8_t port, uint8_t data, uint8_t dir, uint8_t mask, uint8_t *res)
{ {
switch (port) { switch (port) {