Prusa MINI Firmware overview
macros.h File Reference

Go to the source code of this file.

Macros

#define VALUE_BETWEEN(v, l, h)   (((v)>(l)) && ((v)<(h)))
 
#define VALUE_WITHIN(v, l, h)   (((v)>=(l)) && ((v)<=(h)))
 
#define output_pgm_message(wa, fp, mp, el)   wa = &mp, fp((char *)pgm_read_pointer(wa), el)
 
#define output_if_between(v, l, h, wa, fp, mp, el)   if (VALUE_BETWEEN(v,l,h)) output_pgm_message(wa,fp,mp[v-(l+1)],el);
 
#define SWAP(a, b)   (((a) ^= (b)), ((b) ^= (a)), ((a) ^= (b)))
 
#define __BYTE_GRABBING_DEFINED__   1
 
#define BGRAB0(__usi__)   ((uint8_t)((__usi__) & 0xff ))
 
#define BGRAB1(__usi__)   ((uint8_t)(((__usi__) >> 8) & 0xff))
 
#define BGRAB2(__usi__)   ((uint8_t)(((__usi__) >> 16) & 0xff))
 
#define BGRAB3(__usi__)   ((uint8_t)(((__usi__) >> 24) & 0xff))
 
#define BGRAB4(__usi__)   ((uint8_t)(((__usi__) >> 32) & 0xff))
 
#define BGRAB5(__usi__)   ((uint8_t)(((__usi__) >> 40) & 0xff))
 
#define BGRAB6(__usi__)   ((uint8_t)(((__usi__) >> 48) & 0xff))
 
#define BGRAB7(__usi__)   ((uint8_t)(((__usi__) >> 56) & 0xff))
 
#define BOVER1(__usi__)   ((uint16_t)(__usi__) << 8)
 
#define BOVER2(__usi__)   ((uint32_t)(__usi__) << 16)
 
#define BOVER3(__usi__)   ((uint32_t)(__usi__) << 24)
 
#define BOVER4(__usi__)   ((uint64_t)(__usi__) << 32)
 
#define BOVER5(__usi__)   ((uint64_t)(__usi__) << 40)
 
#define BOVER6(__usi__)   ((uint64_t)(__usi__) << 48)
 
#define BOVER7(__usi__)   ((uint64_t)(__usi__) << 56)
 
#define BMAKE16(__usc1__, __usc0__)   ((uint16_t)((uint16_t)(__usc0__) | (uint16_t)BOVER1(__usc1__)))
 
#define BMAKE32(__usc3__, __usc2__, __usc1__, __usc0__)   ((uint32_t)((uint32_t)(__usc0__) | (uint32_t)BOVER1(__usc1__) | (uint32_t)BOVER2(__usc2__) | (uint32_t)BOVER3(__usc3__)))
 
#define BMAKE64(__usc7__, __usc6__, __usc5__, __usc4__, __usc3__, __usc2__, __usc1__, __usc0__)   ((uint64_t)((uint64_t)__usc0__ | (uint64_t)BOVER1(__usc1__) | (uint64_t)BOVER2(__usc2__) | (uint64_t)BOVER3(__usc3__) | (uint64_t)BOVER4(__usc4__) | (uint64_t)BOVER5(__usc5__) | (uint64_t)BOVER6(__usc6__) | (uint64_t)BOVER1(__usc7__)))
 
#define USBTRACE(s)   (Notify(PSTR(s), 0x80))
 
#define USBTRACE1(s, l)   (Notify(PSTR(s), l))
 
#define USBTRACE2(s, r)   (Notify(PSTR(s), 0x80), D_PrintHex((r), 0x80), Notify(PSTR("\r\n"), 0x80))
 
#define USBTRACE3(s, r, l)   (Notify(PSTR(s), l), D_PrintHex((r), l), Notify(PSTR("\r\n"), l))
 

Macro Definition Documentation

◆ VALUE_BETWEEN

#define VALUE_BETWEEN (   v,
  l,
 
)    (((v)>(l)) && ((v)<(h)))

Copyright (C) 2011 Circuits At Home, LTD. All rights reserved.

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.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

Contact information

Circuits At Home, LTD Web : http://www.circuitsathome.com e-mail : suppo.nosp@m.rt@c.nosp@m.ircui.nosp@m.tsat.nosp@m.home..nosp@m.com

◆ VALUE_WITHIN

#define VALUE_WITHIN (   v,
  l,
 
)    (((v)>=(l)) && ((v)<=(h)))

◆ output_pgm_message

#define output_pgm_message (   wa,
  fp,
  mp,
  el 
)    wa = &mp, fp((char *)pgm_read_pointer(wa), el)

◆ output_if_between

#define output_if_between (   v,
  l,
  h,
  wa,
  fp,
  mp,
  el 
)    if (VALUE_BETWEEN(v,l,h)) output_pgm_message(wa,fp,mp[v-(l+1)],el);

◆ SWAP

#define SWAP (   a,
 
)    (((a) ^= (b)), ((b) ^= (a)), ((a) ^= (b)))

◆ __BYTE_GRABBING_DEFINED__

#define __BYTE_GRABBING_DEFINED__   1

◆ BGRAB0

#define BGRAB0 (   __usi__)    ((uint8_t)((__usi__) & 0xff ))

◆ BGRAB1

#define BGRAB1 (   __usi__)    ((uint8_t)(((__usi__) >> 8) & 0xff))

◆ BGRAB2

#define BGRAB2 (   __usi__)    ((uint8_t)(((__usi__) >> 16) & 0xff))

◆ BGRAB3

#define BGRAB3 (   __usi__)    ((uint8_t)(((__usi__) >> 24) & 0xff))

◆ BGRAB4

#define BGRAB4 (   __usi__)    ((uint8_t)(((__usi__) >> 32) & 0xff))

◆ BGRAB5

#define BGRAB5 (   __usi__)    ((uint8_t)(((__usi__) >> 40) & 0xff))

◆ BGRAB6

#define BGRAB6 (   __usi__)    ((uint8_t)(((__usi__) >> 48) & 0xff))

◆ BGRAB7

#define BGRAB7 (   __usi__)    ((uint8_t)(((__usi__) >> 56) & 0xff))

◆ BOVER1

#define BOVER1 (   __usi__)    ((uint16_t)(__usi__) << 8)

◆ BOVER2

#define BOVER2 (   __usi__)    ((uint32_t)(__usi__) << 16)

◆ BOVER3

#define BOVER3 (   __usi__)    ((uint32_t)(__usi__) << 24)

◆ BOVER4

#define BOVER4 (   __usi__)    ((uint64_t)(__usi__) << 32)

◆ BOVER5

#define BOVER5 (   __usi__)    ((uint64_t)(__usi__) << 40)

◆ BOVER6

#define BOVER6 (   __usi__)    ((uint64_t)(__usi__) << 48)

◆ BOVER7

#define BOVER7 (   __usi__)    ((uint64_t)(__usi__) << 56)

◆ BMAKE16

#define BMAKE16 (   __usc1__,
  __usc0__ 
)    ((uint16_t)((uint16_t)(__usc0__) | (uint16_t)BOVER1(__usc1__)))

◆ BMAKE32

#define BMAKE32 (   __usc3__,
  __usc2__,
  __usc1__,
  __usc0__ 
)    ((uint32_t)((uint32_t)(__usc0__) | (uint32_t)BOVER1(__usc1__) | (uint32_t)BOVER2(__usc2__) | (uint32_t)BOVER3(__usc3__)))

◆ BMAKE64

#define BMAKE64 (   __usc7__,
  __usc6__,
  __usc5__,
  __usc4__,
  __usc3__,
  __usc2__,
  __usc1__,
  __usc0__ 
)    ((uint64_t)((uint64_t)__usc0__ | (uint64_t)BOVER1(__usc1__) | (uint64_t)BOVER2(__usc2__) | (uint64_t)BOVER3(__usc3__) | (uint64_t)BOVER4(__usc4__) | (uint64_t)BOVER5(__usc5__) | (uint64_t)BOVER6(__usc6__) | (uint64_t)BOVER1(__usc7__)))

◆ USBTRACE

#define USBTRACE (   s)    (Notify(PSTR(s), 0x80))

◆ USBTRACE1

#define USBTRACE1 (   s,
 
)    (Notify(PSTR(s), l))

◆ USBTRACE2

#define USBTRACE2 (   s,
 
)    (Notify(PSTR(s), 0x80), D_PrintHex((r), 0x80), Notify(PSTR("\r\n"), 0x80))

◆ USBTRACE3

#define USBTRACE3 (   s,
  r,
 
)    (Notify(PSTR(s), l), D_PrintHex((r), l), Notify(PSTR("\r\n"), l))