mirror of
git://projects.qi-hardware.com/antorcha.git
synced 2024-11-25 19:51:52 +02:00
tornado/fw/: handle platform separation for delay function via include path
... and not via #ifdef
This commit is contained in:
parent
c7ed8fbc4a
commit
557a80c3c6
@ -17,7 +17,8 @@ NAME = tornado
|
|||||||
CFLAGS = -g -mmcu=$(CHIP) \
|
CFLAGS = -g -mmcu=$(CHIP) \
|
||||||
-DBOOT_ADDR=$(BOOT_ADDR) \
|
-DBOOT_ADDR=$(BOOT_ADDR) \
|
||||||
-Wall -Wextra -Wshadow -Wno-unused-parameter \
|
-Wall -Wextra -Wshadow -Wno-unused-parameter \
|
||||||
-Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes
|
-Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes \
|
||||||
|
-Iavr
|
||||||
# -Wall -Wextra -Wshadow -Werror -Wno-unused-parameter \
|
# -Wall -Wextra -Wshadow -Werror -Wno-unused-parameter \
|
||||||
|
|
||||||
CHIP = atmega168
|
CHIP = atmega168
|
||||||
|
19
tornado/fw/avr/delay.h
Normal file
19
tornado/fw/avr/delay.h
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
/*
|
||||||
|
* fw/avr/delay.h - AVR-specific _delay_ms
|
||||||
|
*
|
||||||
|
* Written 2012 by Werner Almesberger
|
||||||
|
* Copyright 2012 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef AVR_DELAY_H
|
||||||
|
#define AVR_DELAY_H
|
||||||
|
|
||||||
|
#define F_CPU 8000000UL
|
||||||
|
#include <util/delay.h>
|
||||||
|
|
||||||
|
#endif /* AVR_DELAY_H */
|
24
tornado/fw/ben/delay.h
Normal file
24
tornado/fw/ben/delay.h
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
/*
|
||||||
|
* fw/ben/delay.h - Ben-specific access to _delay_ms
|
||||||
|
*
|
||||||
|
* Written 2012 by Werner Almesberger
|
||||||
|
* Copyright 2012 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef BEN_DELAY_H
|
||||||
|
#define BEN_DELAY_H
|
||||||
|
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
|
||||||
|
static inline void _delay_ms(int ms)
|
||||||
|
{
|
||||||
|
usleep(1000*ms);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif /* BEN_DELAY_H */
|
@ -15,26 +15,15 @@
|
|||||||
|
|
||||||
#ifdef AVR
|
#ifdef AVR
|
||||||
|
|
||||||
#define F_CPU 8000000UL
|
|
||||||
#include <util/delay.h>
|
|
||||||
|
|
||||||
#include "io.h"
|
#include "io.h"
|
||||||
|
|
||||||
#else /* AVR */
|
#else /* AVR */
|
||||||
|
|
||||||
#include <unistd.h>
|
|
||||||
|
|
||||||
#include "ben-io.h"
|
#include "ben-io.h"
|
||||||
|
|
||||||
|
|
||||||
static inline void _delay_ms(int ms)
|
|
||||||
{
|
|
||||||
usleep(1000*ms);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* !AVR */
|
#endif /* !AVR */
|
||||||
|
|
||||||
|
#include "delay.h"
|
||||||
#include "mmc-hw.h"
|
#include "mmc-hw.h"
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user