mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-07-10 08:17:52 -06:00
Initial commit of source code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
37a91e9c10
commit
f582a36e4d
71 changed files with 9950 additions and 0 deletions
25
src/avr/pgm.h
Normal file
25
src/avr/pgm.h
Normal file
|
@ -0,0 +1,25 @@
|
|||
#ifndef __AVR_PGM_H
|
||||
#define __AVR_PGM_H
|
||||
// This header provides the avr/pgmspace.h definitions for "PROGMEM"
|
||||
// on AVR platforms.
|
||||
|
||||
#include <avr/pgmspace.h>
|
||||
|
||||
#define READP(VAR) ({ \
|
||||
_Pragma("GCC diagnostic push"); \
|
||||
_Pragma("GCC diagnostic ignored \"-Wint-to-pointer-cast\""); \
|
||||
typeof(VAR) __val = \
|
||||
__builtin_choose_expr(sizeof(VAR) == 1, \
|
||||
(typeof(VAR))pgm_read_byte(&(VAR)), \
|
||||
__builtin_choose_expr(sizeof(VAR) == 2, \
|
||||
(typeof(VAR))pgm_read_word(&(VAR)), \
|
||||
__builtin_choose_expr(sizeof(VAR) == 4, \
|
||||
(typeof(VAR))pgm_read_dword(&(VAR)), \
|
||||
__force_link_error__unknown_type))); \
|
||||
_Pragma("GCC diagnostic pop"); \
|
||||
__val; \
|
||||
})
|
||||
|
||||
extern void __force_link_error__unknown_type(void);
|
||||
|
||||
#endif // pgm.h
|
Loading…
Add table
Add a link
Reference in a new issue