ardupilot/libraries/AP_Progmem/AP_Progmem.h
Lucas De Marchi 92016e9229 AP_Progmem: remove dead code
The only thing from AP_Progmem that's still used are the pgm_read_*
function and there's no support for AVR anymore. So remove the dead code
and use a single header to contain that inline functions.
2015-10-30 14:35:47 +09:00

42 lines
1.0 KiB
C

#pragma once
#include <string.h>
#include <stdint.h>
// read something the size of a byte
static inline uint8_t pgm_read_byte(const void *s) {
return *(const uint8_t *)s;
}
// read something the size of a byte, far version
static inline uint8_t pgm_read_byte_far(const void *s) {
return *(const uint8_t *)s;
}
// read something the size of a word
static inline uint16_t pgm_read_word(const void *s) {
return *(const uint16_t *)s;
}
// read something the size of a dword
static inline uint32_t pgm_read_dword(const void *s) {
return *(const uint32_t *)s;
}
// read something the size of a float
static inline float pgm_read_float(const void *s) {
return *(const float *)s;
}
// read something the size of a pointer. This makes the menu code more
// portable
static inline uintptr_t pgm_read_pointer(const void *s) {
return *(const uintptr_t *)s;
}
// read something the size of a pointer. This makes the menu code more
// portable
static inline void pgm_read_block(const void *s, void *dest, uint8_t len) {
memcpy(dest, s, len);
}