|
Compiling Teacup Firmware, Maybe is a stupid problem... May 07, 2011 03:51PM |
Registered: 14 years ago Posts: 9 |
|
Re: Compiling Teacup Firmware, Maybe is a stupid problem... May 07, 2011 04:07PM |
Registered: 14 years ago Posts: 9 |
|
Re: Compiling Teacup Firmware, Maybe is a stupid problem... May 07, 2011 05:18PM |
Registered: 17 years ago Posts: 1,094 |
|
Re: Compiling Teacup Firmware, Maybe is a stupid problem... May 07, 2011 08:13PM |
Registered: 14 years ago Posts: 2,947 |
| FFF Settings Calculator | Gcode post processors | Geometric Object Deposition Tool Blog |
| Tantillus.org | Mini Printable Lathe | How NOT to install a Pololu driver |
|
Re: Compiling Teacup Firmware, Maybe is a stupid problem... May 08, 2011 03:36AM |
Registered: 14 years ago Posts: 9 |
|
Re: Compiling Teacup Firmware, Maybe is a stupid problem... May 08, 2011 09:40AM |
Registered: 14 years ago Posts: 9 |
|
Re: Compiling Teacup Firmware, Maybe is a stupid problem... May 08, 2011 12:39PM |
Registered: 15 years ago Posts: 196 |
#ifndef _DELAY_H
#define _DELAY_H
#include
#include
#include "watchdog.h"
#include
// WAITING_DELAY is expressed in microseconds
#define WAITING_DELAY 10000
// Force delay functions to be inlined.
// Otherwise they will not work correctly.
static inline void delay_us(uint16_t us) __attribute__((always_inline));
static inline void delay(uint32_t delay) __attribute__((always_inline));
static inline void delay_ms( uint16_t delay ) __attribute__((always_inline));
// Delay for a minimum of us microseconds.
// The parameter us MUST be a compile time constant.
// A compiler error will be issued in the case that
// it is not.
void delay_us(uint16_t us)
{
// The floating point calculation will
// be completed during compilation, so
// there is no runtime floating point
// code generated.
uint32_t cycles = ceil( (double)F_CPU * us / 1000000.0 );
__builtin_avr_delay_cycles(cycles);
}
// Delay for a minimum of us microseconds.
// If the watchdog functionality is enabled
// this function will reset the timer before
// and after the delay (and at least once every
// 65536 microseconds).
//
// This function is forced (see declaration above) to be inlined.
// The parameter us MUST be a compile time constant.
// A compiler error will be issued in the case that
// it is not.
void delay(uint32_t us)
{
wd_reset();
int i;
for( i = 0; i < us/65536; i++ )
{
delay_us(65535);
delay_us(1);
wd_reset();
}
if( us%65536 )
{
delay_us(us%65536);
wd_reset();
}
}
// Delay for a minimum of ms milliseconds.
// If the watchdog functionality is enabled
// this function will reset the timer before
// and after the delay (and at least once every
// 65000 microseconds).
//
// This function is forced (see declaration above) to be inlined.
// The parameter us MUST be a compile time constant.
// A compiler error will be issued in the case that
// it is not.
void delay_ms( uint16_t ms )
{
wd_reset();
uint16_t i;
for( i = 0; i < ms/65; i++ )
{
delay_us(65000);
wd_reset();
}
if( ms%65 )
{
delay_us((ms%65536)*1000);
wd_reset();
}
}
#endif /* _DELAY_H */
|
Re: Compiling Teacup Firmware, Maybe is a stupid problem... May 09, 2011 02:46AM |
Registered: 15 years ago Posts: 7,616 |
Quote
I'm afraid the C99 mode error is my fault. I submitted a patch that did not compiler under the Arduino compiler (I did not realize that at the time).
Teacup_Firmware/delay.h:30: undefined reference to `__builtin_avr_delay_cycles'
| Generation 7 Electronics | Teacup Firmware | RepRap DIY |
|
Re: Compiling Teacup Firmware, Maybe is a stupid problem... May 09, 2011 03:28AM |
Registered: 15 years ago Posts: 7,616 |
| Generation 7 Electronics | Teacup Firmware | RepRap DIY |
|
Re: Compiling Teacup Firmware, Maybe is a stupid problem... May 09, 2011 10:21PM |
Registered: 15 years ago Posts: 196 |
|
Re: Compiling Teacup Firmware, Maybe is a stupid problem... May 10, 2011 03:03AM |
Registered: 15 years ago Posts: 7,616 |

| Generation 7 Electronics | Teacup Firmware | RepRap DIY |
|
Re: Compiling Teacup Firmware, Maybe is a stupid problem... May 12, 2011 04:15PM |
Registered: 14 years ago Posts: 9 |
|
Re: Compiling Teacup Firmware, Maybe is a stupid problem... May 12, 2011 07:30PM |
Registered: 17 years ago Posts: 1,094 |
|
Re: Compiling Teacup Firmware, Maybe is a stupid problem... May 13, 2011 12:46AM |
Registered: 14 years ago Posts: 9 |
|
Re: Compiling Teacup Firmware, Maybe is a stupid problem... May 13, 2011 01:23AM |
Registered: 17 years ago Posts: 1,094 |
|
Re: Compiling Teacup Firmware, Maybe is a stupid problem... May 13, 2011 05:21AM |
Registered: 14 years ago Posts: 9 |
|
Re: Compiling Teacup Firmware, Maybe is a stupid problem... May 13, 2011 03:55PM |
Registered: 15 years ago Posts: 7,616 |
| Generation 7 Electronics | Teacup Firmware | RepRap DIY |
|
Re: Compiling Teacup Firmware, Maybe is a stupid problem... May 19, 2011 07:53AM |
Registered: 14 years ago Posts: 9 |