grblHAL core  20241107
nuts_bolts.h File Reference
#include "grbl.h"
#include "errors.h"

Go to the source code of this file.

Data Structures

union  axes_signals_t
 
union  point_2d_t
 
struct  limit_signals_t
 Limit switches struct, consists of four packed axes_signals_t structs in 32 bits. More...
 
struct  home_signals_t
 Home switches struct, consists of two packed axes_signals_t structs. More...
 

Macros

#define Off   0
 
#define On   1
 
#define SOME_LARGE_VALUE   1.0E+38f
 
#define TOLERANCE_EQUAL   0.0001f
 
#define RADDEG   0.01745329251994329577f
 
#define DEGRAD   57.29577951308232087680f
 
#define SQRT3   1.73205080756887729353f
 
#define SIN120   0.86602540378443864676f
 
#define COS120   -0.5f
 
#define TAN60   1.73205080756887729353f
 
#define SIN30   0.5f
 
#define TAN30   0.57735026918962576451f
 
#define TAN30_2   0.28867513459481288225f
 
#define ABORTED   (sys.abort || sys.cancel)
 
#define CAPS(c)   ((c >= 'a' && c <= 'z') ? (c & 0x5F) : c)
 
#define LCAPS(c)   ((c >= 'A' && c <= 'Z') ? (c | 0x20) : c)
 
#define X_AXIS   0
 
#define Y_AXIS   1
 
#define Z_AXIS   2
 
#define X_AXIS_BIT   bit(X_AXIS)
 
#define Y_AXIS_BIT   bit(Y_AXIS)
 
#define Z_AXIS_BIT   bit(Z_AXIS)
 
#define AXES_BITMASK   (X_AXIS_BIT|Y_AXIS_BIT|Z_AXIS_BIT)
 
#define N_ABC_AXIS   0
 
#define MM_PER_INCH   (25.40f)
 
#define INCH_PER_MM   (0.0393701f)
 
#define MAX_INT_DIGITS   9
 
#define STRLEN_COORDVALUE   (MAX_INT_DIGITS + N_DECIMAL_COORDVALUE_INCH + 1)
 
#define clear_vector(a)   memset(a, 0, sizeof(a))
 
#define isequal_position_vector(a, b)   !memcmp(a, b, sizeof(coord_data_t))
 
#define is0_position_vector(a)   !memcmp(a, &((coord_data_t){0}), sizeof(coord_data_t))
 
#define bit_true(x, mask)   (x) |= (mask)
 
#define bit_false(x, mask)   (x) &= ~(mask)
 
#define BIT_SET(x, bit, v)   { if (v) { x |= (bit); } else { x &= ~(bit); } }
 
#define bit_istrue(x, mask)   ((x & (mask)) != 0)
 
#define bit_isfalse(x, mask)   ((x & (mask)) == 0)
 

Enumerations

enum  delaymode_t { DelayMode_Dwell = 0 , DelayMode_SysSuspend }
 

Functions

char * uitoa (uint32_t n)
 
char * ftoa (float n, uint8_t decimal_places)
 
char * trim_float (char *s)
 
bool isintf (float value)
 
status_code_t read_uint (char *line, uint_fast8_t *char_counter, uint32_t *uint_ptr)
 
bool read_float (char *line, uint_fast8_t *char_counter, float *float_ptr)
 
bool delay_sec (float seconds, delaymode_t mode)
 
float convert_delta_vector_to_unit_vector (float *vector)
 
struct tmget_datetime (const char *s)
 
uint8_t calc_checksum (uint8_t *data, uint32_t size)
 
char * strcaps (char *s)
 
void dummy_handler (void)
 

Variables

char const *const axis_letter []
 

Macro Definition Documentation

◆ ABORTED

#define ABORTED   (sys.abort || sys.cancel)

◆ AXES_BITMASK

#define AXES_BITMASK   (X_AXIS_BIT|Y_AXIS_BIT|Z_AXIS_BIT)

◆ bit_false

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

◆ bit_isfalse

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

◆ bit_istrue

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

◆ BIT_SET

#define BIT_SET (   x,
  bit,
 
)    { if (v) { x |= (bit); } else { x &= ~(bit); } }

◆ bit_true

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

◆ CAPS

#define CAPS (   c)    ((c >= 'a' && c <= 'z') ? (c & 0x5F) : c)

◆ clear_vector

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

◆ COS120

#define COS120   -0.5f

◆ DEGRAD

#define DEGRAD   57.29577951308232087680f

◆ INCH_PER_MM

#define INCH_PER_MM   (0.0393701f)

◆ is0_position_vector

#define is0_position_vector (   a)    !memcmp(a, &((coord_data_t){0}), sizeof(coord_data_t))

◆ isequal_position_vector

#define isequal_position_vector (   a,
 
)    !memcmp(a, b, sizeof(coord_data_t))

◆ LCAPS

#define LCAPS (   c)    ((c >= 'A' && c <= 'Z') ? (c | 0x20) : c)

◆ MAX_INT_DIGITS

#define MAX_INT_DIGITS   9

◆ MM_PER_INCH

#define MM_PER_INCH   (25.40f)

◆ N_ABC_AXIS

#define N_ABC_AXIS   0

◆ Off

#define Off   0

◆ On

#define On   1

◆ RADDEG

#define RADDEG   0.01745329251994329577f

◆ SIN120

#define SIN120   0.86602540378443864676f

◆ SIN30

#define SIN30   0.5f

◆ SOME_LARGE_VALUE

#define SOME_LARGE_VALUE   1.0E+38f

◆ SQRT3

#define SQRT3   1.73205080756887729353f

◆ STRLEN_COORDVALUE

#define STRLEN_COORDVALUE   (MAX_INT_DIGITS + N_DECIMAL_COORDVALUE_INCH + 1)

◆ TAN30

#define TAN30   0.57735026918962576451f

◆ TAN30_2

#define TAN30_2   0.28867513459481288225f

◆ TAN60

#define TAN60   1.73205080756887729353f

◆ TOLERANCE_EQUAL

#define TOLERANCE_EQUAL   0.0001f

◆ X_AXIS

#define X_AXIS   0

◆ X_AXIS_BIT

#define X_AXIS_BIT   bit(X_AXIS)

◆ Y_AXIS

#define Y_AXIS   1

◆ Y_AXIS_BIT

#define Y_AXIS_BIT   bit(Y_AXIS)

◆ Z_AXIS

#define Z_AXIS   2

◆ Z_AXIS_BIT

#define Z_AXIS_BIT   bit(Z_AXIS)

Enumeration Type Documentation

◆ delaymode_t

Enumerator
DelayMode_Dwell 
DelayMode_SysSuspend 

Function Documentation

◆ calc_checksum()

uint8_t calc_checksum ( uint8_t *  data,
uint32_t  size 
)

◆ convert_delta_vector_to_unit_vector()

float convert_delta_vector_to_unit_vector ( float *  vector)

◆ delay_sec()

bool delay_sec ( float  seconds,
delaymode_t  mode 
)

◆ dummy_handler()

void dummy_handler ( void  )

◆ ftoa()

char* ftoa ( float  n,
uint8_t  decimal_places 
)

◆ get_datetime()

struct tm* get_datetime ( const char *  s)

◆ isintf()

bool isintf ( float  value)

◆ read_float()

bool read_float ( char *  line,
uint_fast8_t *  char_counter,
float *  float_ptr 
)

◆ read_uint()

status_code_t read_uint ( char *  line,
uint_fast8_t *  char_counter,
uint32_t *  uint_ptr 
)

◆ strcaps()

char* strcaps ( char *  s)

◆ trim_float()

char* trim_float ( char *  s)

◆ uitoa()

char* uitoa ( uint32_t  n)

Variable Documentation

◆ axis_letter

char const* const axis_letter[]
extern