Move mockdata/HAL_Value.h to hal/Value.h

Also prefix the MakeBoolean et al functions with HAL_ to avoid namespace
pollution.
This commit is contained in:
Peter Johnson
2019-09-23 23:28:49 -07:00
parent 1b266717a8
commit e8d6f8a2c1
37 changed files with 185 additions and 179 deletions

View File

@@ -39,6 +39,7 @@
#include "hal/Solenoid.h"
#include "hal/Threads.h"
#include "hal/Types.h"
#include "hal/Value.h"
#ifdef __cplusplus
#include "hal/FRCUsageReporting.h"

View File

@@ -53,6 +53,10 @@ typedef HAL_Handle HAL_SerialPortHandle;
typedef HAL_Handle HAL_CANHandle;
typedef HAL_Handle HAL_SimDeviceHandle;
typedef HAL_Handle HAL_SimValueHandle;
typedef HAL_CANHandle HAL_PDPHandle;
typedef int32_t HAL_Bool;

View File

@@ -31,37 +31,45 @@ struct HAL_Value {
enum HAL_Type type;
};
inline HAL_Value MakeBoolean(HAL_Bool v) {
HAL_Value value;
#ifdef __cplusplus
extern "C" {
#endif
inline struct HAL_Value HAL_MakeBoolean(HAL_Bool v) {
struct HAL_Value value;
value.type = HAL_BOOLEAN;
value.data.v_boolean = v;
return value;
}
inline HAL_Value MakeEnum(int v) {
HAL_Value value;
inline struct HAL_Value HAL_MakeEnum(int v) {
struct HAL_Value value;
value.type = HAL_ENUM;
value.data.v_enum = v;
return value;
}
inline HAL_Value MakeInt(int v) {
HAL_Value value;
inline struct HAL_Value HAL_MakeInt(int v) {
struct HAL_Value value;
value.type = HAL_INT;
value.data.v_int = v;
return value;
}
inline HAL_Value MakeLong(int64_t v) {
HAL_Value value;
inline struct HAL_Value HAL_MakeLong(int64_t v) {
struct HAL_Value value;
value.type = HAL_LONG;
value.data.v_long = v;
return value;
}
inline HAL_Value MakeDouble(double v) {
HAL_Value value;
inline struct HAL_Value HAL_MakeDouble(double v) {
struct HAL_Value value;
value.type = HAL_DOUBLE;
value.data.v_double = v;
return value;
}
#ifdef __cplusplus
} // extern "C"
#endif

View File

@@ -7,9 +7,9 @@
#pragma once
#include "HAL_Value.h"
#include "NotifyListener.h"
#include "hal/Types.h"
#include "hal/Value.h"
typedef void (*HAL_CAN_SendMessageCallback)(const char* name, void* param,
uint32_t messageID,

View File

@@ -7,7 +7,7 @@
#pragma once
#include "HAL_Value.h"
#include "hal/Value.h"
typedef void (*HAL_NotifyCallback)(const char* name, void* param,
const struct HAL_Value* value);

View File

@@ -11,7 +11,7 @@
#include <wpi/StringRef.h>
#include "mockdata/HAL_Value.h"
#include "hal/Value.h"
namespace frc {
namespace sim {