aboutsummaryrefslogtreecommitdiffstats
path: root/os/various
diff options
context:
space:
mode:
authorStephane D'Alu <sdalu@sdalu.com>2016-02-07 18:55:45 +0100
committerStephane D'Alu <sdalu@sdalu.com>2016-02-07 18:55:45 +0100
commitbd884d47577f398dfef251011ec82c81de9a84d7 (patch)
tree561ba5de9676a9297f6cd0d20002465214516485 /os/various
parent7ecdfd4386abe1bd27a92da87a5a487a946c1165 (diff)
downloadChibiOS-Contrib-bd884d47577f398dfef251011ec82c81de9a84d7.tar.gz
ChibiOS-Contrib-bd884d47577f398dfef251011ec82c81de9a84d7.tar.bz2
ChibiOS-Contrib-bd884d47577f398dfef251011ec82c81de9a84d7.zip
cleanup
Diffstat (limited to 'os/various')
-rw-r--r--os/various/devices_lib/sensors/hdc1000/bswap.h138
-rw-r--r--os/various/devices_lib/sensors/hdc1000/hdc1000.c5
-rw-r--r--os/various/devices_lib/sensors/hdc1000/hdc1000.h1
3 files changed, 3 insertions, 141 deletions
diff --git a/os/various/devices_lib/sensors/hdc1000/bswap.h b/os/various/devices_lib/sensors/hdc1000/bswap.h
deleted file mode 100644
index 624e4ba..0000000
--- a/os/various/devices_lib/sensors/hdc1000/bswap.h
+++ /dev/null
@@ -1,138 +0,0 @@
-#ifndef BSWAP_H
-#define BSWAP_H
-
-#if defined(__cplusplus)
-extern "C" {
-#endif
-
-#if !(defined(ARCH_BIG_ENDIAN) || defined(ARCH_LITTLE_ENDIAN))
-#if YOTTA_CFG_CONFIG_ARCH_LITTLE_ENDIAN
-#define ARCH_LITTLE_ENDIAN
-#endif
-#if YOTTA_CFG_CONFIG_ARCH_BIG_ENDIAN
-#define ARCH_BIG_ENDIAN
-#endif
-#endif
-
-#if !(defined(ARCH_BIG_ENDIAN) || defined(ARCH_LITTLE_ENDIAN))
-#error "ARCH_BIG_ENDIAN or ARCH_LITTLE_ENDIAN not set."
-#endif
-
-#if defined(ARCH_BIG_ENDIAN) && defined(ARCH_LITTLE_ENDIAN)
-#error "ARCH_BIG_ENDIAN and ARCH_LITTLE_ENDIAN are both set."
-#endif
-
-
-#define BSWAP_16(x) \
- (uint16_t)((((x) & 0xFF00) >> 8) | (((x) & 0x00FF) << 8))
-#define BSWAP_32(x) \
- (uint32_t)((((x) & 0xFF000000UL) >> 24UL) | \
- (((x) & 0x00FF0000UL) >> 8UL) | \
- (((x) & 0x0000FF00UL) << 8UL) | \
- (((x) & 0x000000FFUL) << 24UL))
-
-
-#if defined(ARCH_BIG_ENDIAN)
-#define le16_to_cpu(x) bswap_16(x)
-#define le32_to_cpu(x) bswap_32(x)
-#define be16_to_cpu(x) (x)
-#define be32_to_cpu(x) (x)
-#define cpu_to_le16(x) bswap_16(x)
-#define cpu_to_le32(x) bswap_32(x)
-#define cpu_to_be16(x) (x)
-#define cpu_to_be32(x) (x)
-#define LE16_TO_CPU(x) BSWAP_16(x)
-#define LE32_TO_CPU(x) BSWAP_32(x)
-#define BE16_TO_CPU(x) (x)
-#define BE32_TO_CPU(x) (x)
-#define CPU_TO_LE16(x) BSWAP_16(x)
-#define CPU_TO_LE32(x) BSWAP_32(x)
-#define CPU_TO_BE16(x) (x)
-#define CPU_TO_BE32(x) (x)
-#endif
-
-
-#if defined(ARCH_LITTLE_ENDIAN)
-#define le16_to_cpu(x) (x)
-#define le32_to_cpu(x) (x)
-#define be16_to_cpu(x) bswap_16(x)
-#define be32_to_cpu(x) bswap_32(x)
-#define cpu_to_le16(x) (x)
-#define cpu_to_le32(x) (x)
-#define cpu_to_be16(x) bswap_16(x)
-#define cpu_to_be32(x) bswap_32(x)
-#define LE16_TO_CPU(x) (x)
-#define LE32_TO_CPU(x) (x)
-#define BE16_TO_CPU(x) BSWAP_16(x)
-#define BE32_TO_CPU(x) BSWAP_32(x)
-#define CPU_TO_LE16(x) (x)
-#define CPU_TO_LE32(x) (x)
-#define CPU_TO_BE16(x) BSWAP_16(x)
-#define CPU_TO_BE32(x) BSWAP_32(x)
-#endif
-
-
-static inline uint16_t bswap_16(const uint16_t x)
- __attribute__ ((warn_unused_result))
- __attribute__ ((const))
- __attribute__ ((always_inline));
-
-static inline uint16_t bswap_16(const uint16_t x) {
- if (__builtin_constant_p(x))
- return BSWAP_16(x);
-
- uint8_t tmp;
- union { uint16_t x; uint8_t b[2]; } data;
-
- data.x = x;
- tmp = data.b[0];
- data.b[0] = data.b[1];
- data.b[1] = tmp;
-
- return data.x;
-}
-
-static inline uint32_t bswap_32(const uint32_t x)
- __attribute__ ((warn_unused_result))
- __attribute__ ((const))
- __attribute__ ((always_inline));
-
-
-static inline uint32_t bswap_32(const uint32_t x) {
- if (__builtin_constant_p(x))
- return BSWAP_32(x);
-
- uint8_t tmp;
- union { uint32_t x; uint8_t b[4]; } data;
-
- data.x = x;
- tmp = data.b[0];
- data.b[0] = data.b[3];
- data.b[3] = tmp;
- tmp = data.b[1];
- data.b[1] = data.b[2];
- data.b[2] = tmp;
-
- return data.x;
-}
-
-static inline void bswap_n(void* const data, uint8_t len)
- __attribute__ ((nonnull (1)));
-
-static inline void bswap_n(void* const data, uint8_t len) {
- uint8_t* ptr = (uint8_t*)data;
-
- for ( ; len > 1 ; ptr++, len -= 2 ) {
- uint8_t tmp = *ptr;
- *ptr = *(ptr + len - 1);
- *(ptr + len - 1) = tmp;
- }
-}
-
-#if defined(__cplusplus)
-}
-#endif
-
-#endif
-
-
diff --git a/os/various/devices_lib/sensors/hdc1000/hdc1000.c b/os/various/devices_lib/sensors/hdc1000/hdc1000.c
index ac8160c..47e0e5a 100644
--- a/os/various/devices_lib/sensors/hdc1000/hdc1000.c
+++ b/os/various/devices_lib/sensors/hdc1000/hdc1000.c
@@ -78,7 +78,7 @@
/* Driver local functions. */
/*===========================================================================*/
-inline msg_t
+static inline msg_t
_apply_config(HDC1000_drv *drv) {
struct __attribute__((packed)) {
uint8_t reg;
@@ -88,7 +88,7 @@ _apply_config(HDC1000_drv *drv) {
return i2c_send((uint8_t*)&tx, sizeof(tx));
}
-inline msg_t
+static inline msg_t
_decode_measure(HDC1000_drv *drv,
uint32_t val, float *temperature, float *humidity) {
(void)drv;
@@ -110,6 +110,7 @@ _decode_measure(HDC1000_drv *drv,
*humidity = hum;
}
+ /* ok */
return MSG_OK;
}
diff --git a/os/various/devices_lib/sensors/hdc1000/hdc1000.h b/os/various/devices_lib/sensors/hdc1000/hdc1000.h
index 8522ecb..902b17b 100644
--- a/os/various/devices_lib/sensors/hdc1000/hdc1000.h
+++ b/os/various/devices_lib/sensors/hdc1000/hdc1000.h
@@ -62,7 +62,6 @@ typedef enum __attribute__ ((__packed__)) {
} HDC1000_state_t;
-
/**
* @brief HDC1000 configuration structure.
*/