gnea\grbl-Mega  1.0f
Source Code Documentation ( Internal Workings )
nuts_bolts.h File Reference

Go to the source code of this file.

Macros

#define false   0
 
#define true   1
 
#define SOME_LARGE_VALUE   1.0E+38
 
#define N_AXIS   3
 Axis array index values. Must start with 0 and be continuous. More...
 
#define X_AXIS   0
 Axis indexing value. More...
 
#define Y_AXIS   1
 
#define Z_AXIS   2
 
#define MM_PER_INCH   (25.40)
 CoreXY motor assignments. DO NOT ALTER. More...
 
#define INCH_PER_MM   (0.0393701)
 
#define TICKS_PER_MICROSECOND   (F_CPU/1000000)
 
#define DELAY_MODE_DWELL   0
 
#define DELAY_MODE_SYS_SUSPEND   1
 
#define clear_vector(a)   memset(a, 0, sizeof(a))
 Useful macros. More...
 
#define clear_vector_float(a)   memset(a, 0.0, sizeof(float)*N_AXIS)
 
#define max(a, b)   (((a) > (b)) ? (a) : (b))
 
#define min(a, b)   (((a) < (b)) ? (a) : (b))
 
#define isequal_position_vector(a, b)   !(memcmp(a, b, sizeof(float)*N_AXIS))
 
#define bit(n)   (1 << n)
 Bit field and masking macros. More...
 
#define bit_true(x, mask)   (x) |= (mask)
 
#define bit_false(x, mask)   (x) &= ~(mask)
 
#define bit_istrue(x, mask)   ((x & mask) != 0)
 
#define bit_isfalse(x, mask)   ((x & mask) == 0)
 

Functions

uint8_t read_float (char *line, uint8_t *char_counter, float *float_ptr)
 Read a floating point value from a string. Line points to the input buffer, char_counter. More...
 
void delay_sec (float seconds, uint8_t mode)
 Non-blocking delay function used for general operation and suspend features. More...
 
void delay_ms (uint16_t ms)
 Delays variable-defined milliseconds. Compiler compatibility fix for _delay_ms(). More...
 
void delay_us (uint32_t us)
 Delays variable-defined microseconds. Compiler compatibility fix for _delay_us(). More...
 
float hypot_f (float x, float y)
 Computes hypotenuse, avoiding avr-gcc's bloated version and the extra error checking. More...
 
float convert_delta_vector_to_unit_vector (float *vector)
 
float limit_value_by_axis_maximum (float *max_value, float *unit_vec)
 

Macro Definition Documentation

#define bit (   n)    (1 << n)

Bit field and masking macros.

Definition at line 57 of file nuts_bolts.h.

#define bit_false (   x,
  mask 
)    (x) &= ~(mask)

Definition at line 59 of file nuts_bolts.h.

#define bit_isfalse (   x,
  mask 
)    ((x & mask) == 0)

Definition at line 61 of file nuts_bolts.h.

#define bit_istrue (   x,
  mask 
)    ((x & mask) != 0)

Definition at line 60 of file nuts_bolts.h.

#define bit_true (   x,
  mask 
)    (x) |= (mask)

Definition at line 58 of file nuts_bolts.h.

#define clear_vector (   a)    memset(a, 0, sizeof(a))

Useful macros.

Definition at line 50 of file nuts_bolts.h.

#define clear_vector_float (   a)    memset(a, 0.0, sizeof(float)*N_AXIS)

Definition at line 51 of file nuts_bolts.h.

#define DELAY_MODE_DWELL   0

Definition at line 47 of file nuts_bolts.h.

#define DELAY_MODE_SYS_SUSPEND   1

Definition at line 48 of file nuts_bolts.h.

#define false   0

Definition at line 25 of file nuts_bolts.h.

#define INCH_PER_MM   (0.0393701)

Definition at line 44 of file nuts_bolts.h.

#define isequal_position_vector (   a,
 
)    !(memcmp(a, b, sizeof(float)*N_AXIS))

Definition at line 55 of file nuts_bolts.h.

#define max (   a,
 
)    (((a) > (b)) ? (a) : (b))

Definition at line 53 of file nuts_bolts.h.

#define min (   a,
 
)    (((a) < (b)) ? (a) : (b))

Definition at line 54 of file nuts_bolts.h.

#define MM_PER_INCH   (25.40)

CoreXY motor assignments. DO NOT ALTER.

NOTE: If the A and B motor axis bindings are changed, this effects the CoreXY equations. Conversions

Definition at line 43 of file nuts_bolts.h.

#define N_AXIS   3

Axis array index values. Must start with 0 and be continuous.

Number of axes

Definition at line 30 of file nuts_bolts.h.

#define SOME_LARGE_VALUE   1.0E+38

Definition at line 28 of file nuts_bolts.h.

#define TICKS_PER_MICROSECOND   (F_CPU/1000000)

Definition at line 45 of file nuts_bolts.h.

#define true   1

Definition at line 26 of file nuts_bolts.h.

#define X_AXIS   0

Axis indexing value.

Definition at line 31 of file nuts_bolts.h.

#define Y_AXIS   1

Definition at line 32 of file nuts_bolts.h.

#define Z_AXIS   2

Definition at line 33 of file nuts_bolts.h.

Function Documentation

float convert_delta_vector_to_unit_vector ( float *  vector)

Definition at line 160 of file nuts_bolts.c.

void delay_ms ( uint16_t  ms)

Delays variable-defined milliseconds. Compiler compatibility fix for _delay_ms().

Delays variable-defined milliseconds. Compiler compatibility fix for _delay_ms().

Definition at line 129 of file nuts_bolts.c.

void delay_sec ( float  seconds,
uint8_t  mode 
)

Non-blocking delay function used for general operation and suspend features.

< DELAY_MODE_SYS_SUSPEND

< Execute rt_system() only to avoid nesting suspend loops.

< Delay DWELL_TIME_STEP increment

Definition at line 111 of file nuts_bolts.c.

void delay_us ( uint32_t  us)

Delays variable-defined microseconds. Compiler compatibility fix for _delay_us().

Delays variable-defined microseconds. Compiler compatibility fix for _delay_us().

Definition at line 137 of file nuts_bolts.c.

float hypot_f ( float  x,
float  y 
)

Computes hypotenuse, avoiding avr-gcc's bloated version and the extra error checking.

Computes hypotenuse, avoiding avr-gcc's bloated version and the extra error checking.

Definition at line 157 of file nuts_bolts.c.

float limit_value_by_axis_maximum ( float *  max_value,
float *  unit_vec 
)

< Avoid divide by zero.

Definition at line 176 of file nuts_bolts.c.

uint8_t read_float ( char *  line,
uint8_t *  char_counter,
float *  float_ptr 
)

Read a floating point value from a string. Line points to the input buffer, char_counter.

Read a floating point value from a string. Line points to the input buffer, char_counter.

NOTE: Thanks to Radu-Eosif Mihailescu for identifying the issues with using strtod().

< intval*10 + c

< Set char_counter to next statement

Definition at line 35 of file nuts_bolts.c.