mirror of https://github.com/ArduPilot/ardupilot
Progmem: removed desktop specific progmem handling
This commit is contained in:
parent
9b3ed0b683
commit
f393389db2
|
@ -4,9 +4,7 @@
|
||||||
|
|
||||||
#if defined(__AVR__)
|
#if defined(__AVR__)
|
||||||
#include "AP_Progmem_AVR.h"
|
#include "AP_Progmem_AVR.h"
|
||||||
#elif defined(DESKTOP_BUILD)
|
#elif defined(PX4FMU_BUILD) || (CONFIG_HAL_BOARD==HAL_BOARD_AVR_SITL)
|
||||||
#include "AP_Progmem_DesktopBuild.h"
|
|
||||||
#elif defined(PX4FMU_BUILD)
|
|
||||||
#include "AP_Progmem_Identity.h"
|
#include "AP_Progmem_Identity.h"
|
||||||
#else
|
#else
|
||||||
#error "this build type is unknown"
|
#error "this build type is unknown"
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
|
|
||||||
#ifndef __AP_PROGMEM_DESKTOP_BUILD_H__
|
|
||||||
#define __AP_PROGMEM_DESKTOP_BUILD_H__
|
|
||||||
|
|
||||||
#ifndef __AP_PROGMEM_H__
|
|
||||||
#error "Do not import AP_Progmem_DesktopBuild.h directly - use AP_Progmem.h"
|
|
||||||
#endif // __AP_PROGMEM_H__
|
|
||||||
|
|
||||||
/* Inherit AVR definitions for everything else */
|
|
||||||
#include "AP_Progmem_AVR.h"
|
|
||||||
|
|
||||||
#undef PROGMEM
|
|
||||||
#define PROGMEM __attribute__(())
|
|
||||||
|
|
||||||
#endif // __AP_PROGMEM_DESKTOP_BUILD_H__
|
|
||||||
|
|
|
@ -3,11 +3,14 @@
|
||||||
#define __AP_PROGMEM_IDENTITY__
|
#define __AP_PROGMEM_IDENTITY__
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
typedef char prog_char_t;
|
typedef char prog_char_t;
|
||||||
typedef char prog_char;
|
typedef char prog_char;
|
||||||
|
|
||||||
#define PSTR(s) s
|
#define PSTR(s) s
|
||||||
|
#undef PROGMEM
|
||||||
|
#define PROGMEM __attribute__(())
|
||||||
|
|
||||||
static inline int strcasecmp_P(const char *str1, const prog_char_t *pstr)
|
static inline int strcasecmp_P(const char *str1, const prog_char_t *pstr)
|
||||||
{
|
{
|
||||||
|
@ -35,6 +38,41 @@ static inline char *strncpy_P(char *buffer, const prog_char_t *pstr, size_t buff
|
||||||
return strncpy(buffer, pstr, buffer_size);
|
return strncpy(buffer, pstr, buffer_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline size_t strnlen_P(const prog_char_t *str, size_t size)
|
||||||
|
{
|
||||||
|
return strnlen(str, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline int strncmp_P(const prog_char_t *str1, const prog_char_t *str2, size_t n)
|
||||||
|
{
|
||||||
|
return strncmp(str1, str2, n);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 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
|
// read something the size of a pointer. This makes the menu code more
|
||||||
// portable
|
// portable
|
||||||
|
|
Loading…
Reference in New Issue