mirror of
https://github.com/eclipse/upm.git
synced 2025-07-02 18:01:18 +03:00
upmc: Updates for building C modules w/base UPM
Test commit for building C UPM modules. * Added C include directory * Added C utilities directory * Rename C++ upm.h -> upm.hpp to make room for C upm.h * Added upm_mixed_module_init function to src/CMakeLists.txt. This function takes filesnames similar to upm_module_init and does a bit of processing before calling upm_module_init. * Added c example directory. Changed c++ example names. * Added dfrph implemention for testing (C++ wraps C). Added mraa to .pc requires for dfrph. Tested against stand-alone project. Added dfrph c example. * Update implemention of pkg-config file generation. * Added two cmake cache variables: BUILDCPP and BUILDFTI * Removed src from swig_add_module calls, added libname to swig_link_libraries calls. Shrinks swig'ed binaries by ~13%. * Added install target in upm/CMakeLists.txt to install C header, directory. Is this where we want this? * C FTI header directory is include/fti Signed-off-by: Noel Eck <noel.eck@intel.com>
This commit is contained in:
45
include/fti/upm_acceleration.h
Normal file
45
include/fti/upm_acceleration.h
Normal file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Authors:
|
||||
* Copyright (c) 2016 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#ifndef UPM_ACCELERATION_H_
|
||||
#define UPM_ACCELERATION_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Acceleration units
|
||||
typedef enum _upm_acceleration_u {G, METERS_PER_SECOND_SQ, FEET_PER_SECOND_SQ} upm_acceleration_u;
|
||||
|
||||
// Acceleration function table
|
||||
typedef struct _upm_acceleration_ft {
|
||||
upm_result_t (*upm_acceleration_set_scale) (void* dev, float* scale);
|
||||
upm_result_t (*upm_acceleration_set_offset) (void* dev, float* offset);
|
||||
upm_result_t (*upm_acceleration_get_value) (void* dev, float* value, upm_acceleration_u unit);
|
||||
} upm_acceleration_ft;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* UPM_ACCELERATION_H_ */
|
42
include/fti/upm_angle.h
Normal file
42
include/fti/upm_angle.h
Normal file
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Authors:
|
||||
* Copyright (c) 2016 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef UPM_ANGLE_H_
|
||||
#define UPM_ANGLE_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum _upm_angle_u {DEGREES, RADIANS} upm_angle_u;
|
||||
|
||||
typedef struct _upm_angle_ft {
|
||||
upm_result_t (*upm_angle_get_value) (void* dev, float* value, upm_angle_u unit);
|
||||
} upm_angle_ft;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* UPM_ANGLE_H_ */
|
44
include/fti/upm_audio.h
Normal file
44
include/fti/upm_audio.h
Normal file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Authors:
|
||||
* Copyright (c) 2016 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef UPM_AUDIO_H_
|
||||
#define UPM_AUDIO_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Audio unit
|
||||
typedef enum _upm_audio_u {DECIBELS} upm_audio_u;
|
||||
|
||||
// Audio function table
|
||||
typedef struct _upm_audio_ft {
|
||||
upm_result_t (*upm_audio_get_value) (void* dev, float* value, upm_audio_u unit);
|
||||
} upm_audio_ft;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* UPM_AUDIO_H_ */
|
43
include/fti/upm_distance.h
Normal file
43
include/fti/upm_distance.h
Normal file
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Authors:
|
||||
* Copyright (c) 2016 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#ifndef UPM_DISTANCE_H_
|
||||
#define UPM_DISTANCE_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Distance units
|
||||
typedef enum _upm_distance_u {CENTIMETER, INCH} upm_distance_u;
|
||||
|
||||
// Distance function table
|
||||
typedef struct _upm_dist_ft {
|
||||
upm_result_t (*upm_distance_get_value) (void* dev, float* value, upm_distance_u unit);
|
||||
} upm_distance_ft;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* UPM_SENSOR_DISTANCE_H_ */
|
43
include/fti/upm_heart_rate.h
Normal file
43
include/fti/upm_heart_rate.h
Normal file
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Authors:
|
||||
* Copyright (c) 2016 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#ifndef UPM_HEART_RATE_H_
|
||||
#define UPM_HEART_RATE_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Heart rate units
|
||||
typedef enum _upm_heart_rate_u {BPM} upm_heart_rate_u;
|
||||
|
||||
// Heart rate function table
|
||||
typedef struct _upm_heart_rate_ft {
|
||||
upm_result_t (*upm_heart_rate_get_value) (void* dev, int* value, upm_heart_rate_u unit);
|
||||
} upm_heart_rate_ft;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* UPM_HEART_RATE_H_ */
|
54
include/fti/upm_joystick.h
Normal file
54
include/fti/upm_joystick.h
Normal file
@ -0,0 +1,54 @@
|
||||
/*
|
||||
* Authors:
|
||||
* Copyright (c) 2016 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#ifndef UPM_JOYSTICK_H_
|
||||
#define UPM_JOYSTICK_H_
|
||||
|
||||
#include "upm_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Joytick function table */
|
||||
typedef struct _upm_joystick_ft
|
||||
{
|
||||
/* Set sensor offset in raw counts */
|
||||
upm_result_t (*upm_joystick_set_offset_x) (const void* dev, float offset);
|
||||
/* Set sensor offset in raw counts */
|
||||
upm_result_t (*upm_joystick_set_offset_y) (const void* dev, float offset);
|
||||
/* Set sensor scale in raw counts */
|
||||
upm_result_t (*upm_joystick_set_scale_x) (const void* dev, float scale);
|
||||
/* Set sensor scale in raw counts */
|
||||
upm_result_t (*upm_joystick_set_scale_y) (const void* dev, float scale);
|
||||
/* Read sensor value, return normalized value */
|
||||
upm_result_t (*upm_joystick_get_value_x) (const void* dev, float* value);
|
||||
/* Read sensor value, return normalized value */
|
||||
upm_result_t (*upm_joystick_get_value_y) (const void* dev, float* value);
|
||||
} upm_joystick_ft;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* UPM_JOYSTICK_H_ */
|
48
include/fti/upm_light.h
Normal file
48
include/fti/upm_light.h
Normal file
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Authors:
|
||||
* Copyright (c) 2016 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#ifndef UPM_LIGHT_H_
|
||||
#define UPM_LIGHT_H_
|
||||
|
||||
#include "upm_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* pH function table */
|
||||
typedef struct _upm_light_ft
|
||||
{
|
||||
/* Set sensor offset in raw counts */
|
||||
upm_result_t (*upm_light_set_offset) (const void* dev, float offset);
|
||||
/* Set sensor scale in raw counts */
|
||||
upm_result_t (*upm_light_set_scale) (const void* dev, float scale);
|
||||
/* Read sensor value, return lux */
|
||||
upm_result_t (*upm_light_get_value) (const void* dev, float* value);
|
||||
} upm_light_ft;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* UPM_LIGHT_H_ */
|
33
include/fti/upm_moisture.h
Normal file
33
include/fti/upm_moisture.h
Normal file
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Authors:
|
||||
* Copyright (c) 2016 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef UPM_SENSOR_MOISTURE_H_
|
||||
#define UPM_SENSOR_MOISTURE_H_
|
||||
#include <stdarg.h>
|
||||
|
||||
typedef struct _upm_moisture_ft {
|
||||
upm_result_t (*upm_moisture_sensor_get_moisture) (void* dev, int* moisture);
|
||||
} upm_moisture_ft;
|
||||
|
||||
#endif /* UPM_SENSOR_MOISTURE_H_ */
|
48
include/fti/upm_ph.h
Normal file
48
include/fti/upm_ph.h
Normal file
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Authors:
|
||||
* Copyright (c) 2016 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#ifndef UPM_PH_H_
|
||||
#define UPM_PH_H_
|
||||
|
||||
#include "upm_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* pH function table */
|
||||
typedef struct _upm_ph_ft
|
||||
{
|
||||
/* Set sensor offset in raw counts */
|
||||
upm_result_t (*upm_ph_set_offset) (const void* dev, float offset);
|
||||
/* Set sensor scale in raw counts */
|
||||
upm_result_t (*upm_ph_set_scale) (const void* dev, float scale);
|
||||
/* Read sensor value, return pH */
|
||||
upm_result_t (*upm_ph_get_value) (const void* dev, float* value);
|
||||
} upm_ph_ft;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* UPM_PH_H_ */
|
42
include/fti/upm_potentiometer.h
Normal file
42
include/fti/upm_potentiometer.h
Normal file
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Authors:
|
||||
* Copyright (c) 2016 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef UPM_POTENTIOMETER_H_
|
||||
#define UPM_POTENTIOMETER_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum _upm_potentiometer_u {VOLTAGE} upm_potentiometer_u;
|
||||
|
||||
typedef struct _upm_potentiometer_ft {
|
||||
upm_result_t (*upm_potentiometer_get_value) (void* dev, float* value, upm_potentiometer_u unit);
|
||||
} upm_potentiometer_ft;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* UPM_POTENTIOMETER_H_ */
|
48
include/fti/upm_raw.h
Normal file
48
include/fti/upm_raw.h
Normal file
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Authors:
|
||||
* Copyright (c) 2016 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#ifndef UPM_RAW_H_
|
||||
#define UPM_RAW_H_
|
||||
|
||||
#include "upm_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Raw counts function table */
|
||||
typedef struct _upm_raw_ft
|
||||
{
|
||||
/* Set sensor offset in raw counts */
|
||||
upm_result_t (*upm_raw_set_offset) (const void* dev, float offset);
|
||||
/* Set sensor scale in raw counts */
|
||||
upm_result_t (*upm_raw_set_scale) (const void* dev, float scale);
|
||||
/* Read sensor value, return raw counts */
|
||||
upm_result_t (*upm_raw_get_value) (const void* dev, float* value);
|
||||
} upm_raw_ft;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* UPM_RAW_H_ */
|
45
include/fti/upm_sensor.h
Normal file
45
include/fti/upm_sensor.h
Normal file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Authors:
|
||||
* Copyright (c) 2016 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#ifndef UPM_SENSOR_H_
|
||||
#define UPM_SENSOR_H_
|
||||
|
||||
#include "upm_types.h"
|
||||
#include "upm_fti.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Generic sensor function table
|
||||
typedef struct _upm_sensor_ft {
|
||||
void* (*upm_sensor_init_name) (const char* protocol, const char* params);
|
||||
void (*upm_sensor_close) (void* dev);
|
||||
const upm_sensor_descriptor_t (*upm_sensor_get_descriptor) (const void* dev);
|
||||
} upm_sensor_ft;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* UPM_SENSOR_H_ */
|
41
include/fti/upm_servo.h
Normal file
41
include/fti/upm_servo.h
Normal file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Authors:
|
||||
* Copyright (c) 2016 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#ifndef UPM_SERVO_H_
|
||||
#define UPM_SERVO_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Servo function table
|
||||
typedef struct _upm_servo_ft {
|
||||
upm_result_t (*upm_servo_set_angle) (void* dev, int angle);
|
||||
} upm_servo_ft;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* UPM_SERVO_H_ */
|
||||
|
45
include/fti/upm_stream.h
Normal file
45
include/fti/upm_stream.h
Normal file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Authors: Jon Trulson <jtrulson@ics.com>
|
||||
* Copyright (c) 2016 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef UPM_STREAM_H_
|
||||
#define UPM_STREAM_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _upm_stream_ft {
|
||||
/* read up to len bytes into buffer, return number of bytes read */
|
||||
int (*upm_stream_read) (void* dev, void *buffer, int len);
|
||||
/* write up to len bytes from buffer, return number of bytes written */
|
||||
int (*upm_stream_write) (void* dev, void *buffer, int len);
|
||||
/* return true if data is available to be read, false otherwise */
|
||||
bool (*upm_stream_data_available) (void* dev, unsigned int timeout);
|
||||
} upm_stream_ft;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* UPM_STREAM_H_ */
|
42
include/fti/upm_switch.h
Normal file
42
include/fti/upm_switch.h
Normal file
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Authors:
|
||||
* Copyright (c) 2016 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#ifndef UPM_SWITCH_H_
|
||||
#define UPM_SWITCH_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Switch function table
|
||||
typedef struct _upm_switch_ft {
|
||||
upm_result_t (*upm_switch_get_value) (void* dev, bool* value, int num);
|
||||
upm_result_t (*upm_switch_attach_isr) (void* dev, void (*isr)(void *), void *arg);
|
||||
upm_result_t (*upm_switch_clear_isr) (void* dev);
|
||||
} upm_switch_ft;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* UPM_SWITCH_H_ */
|
44
include/fti/upm_temperature.h
Normal file
44
include/fti/upm_temperature.h
Normal file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Authors:
|
||||
* Copyright (c) 2016 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#ifndef UPM_TEMPERATURE_H_
|
||||
#define UPM_TEMPERATURE_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// Temperature units
|
||||
typedef enum _upm_temperature_u {CELSIUS, FAHRENHEIT, KELVIN} upm_temperature_u;
|
||||
|
||||
// Temperature function table
|
||||
typedef struct _upm_temperature_ft {
|
||||
upm_result_t (*upm_temperature_set_scale) (void* dev, float scale);
|
||||
upm_result_t (*upm_temperature_get_value) (void* dev, float* value, upm_temperature_u unit);
|
||||
} upm_temperature_ft;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* UPM_TEMPERATURE_H_ */
|
36
include/fti/upm_touch.h
Normal file
36
include/fti/upm_touch.h
Normal file
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Authors:
|
||||
* Copyright (c) 2016 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef UPM_TOUCH_H_
|
||||
#define UPM_TOUCH_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* UPM_TOUCH_H_ */
|
40
include/fti/upm_vibration.h
Normal file
40
include/fti/upm_vibration.h
Normal file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Authors:
|
||||
* Copyright (c) 2016 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef UPM_VIBRATION_H_
|
||||
#define UPM_VIBRATION_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct _upm_vibration_ft {
|
||||
upm_result_t (*upm_vibration_get_value) (void* dev, float* value);
|
||||
} upm_vibration_ft;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* UPM_VIBRATION_H_ */
|
47
include/fti/upm_voltage.h
Normal file
47
include/fti/upm_voltage.h
Normal file
@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Authors:
|
||||
* Copyright (c) 2016 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#ifndef UPM_VOLTAGE_H_
|
||||
#define UPM_VOLTAGE_H_
|
||||
|
||||
#include "upm_types.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Generic voltage function table */
|
||||
typedef struct _upm_voltage_ft {
|
||||
/* Set sensor offset in volts */
|
||||
upm_result_t (*upm_voltage_set_offset) (const void* dev, float offset);
|
||||
/* Set sensor scale in volts */
|
||||
upm_result_t (*upm_voltage_set_scale) (const void* dev, float scale);
|
||||
/* Read sensor value in volts */
|
||||
upm_result_t (*upm_voltage_get_value) (const void* dev, float* value);
|
||||
} upm_voltage_ft;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* UPM_VOLTAGE_H_ */
|
45
include/upm.h
Normal file
45
include/upm.h
Normal file
@ -0,0 +1,45 @@
|
||||
/*
|
||||
* Authors:
|
||||
* Copyright (c) 2016 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#ifndef UPM_H_
|
||||
#define UPM_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if __STDC_VERSION__ >= 199901L
|
||||
#define C99
|
||||
#endif
|
||||
|
||||
#include <upm_types.h>
|
||||
#include <upm_math.h>
|
||||
#include <upm_utilities.h>
|
||||
|
||||
#define upm_perror(...) perror(args, __VA_ARGS__)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* UPM_H_ */
|
122
include/upm_fti.h
Normal file
122
include/upm_fti.h
Normal file
@ -0,0 +1,122 @@
|
||||
/*
|
||||
* Authors:
|
||||
* Copyright (c) 2016 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef UPM_FTI_H_
|
||||
#define UPM_FTI_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* The UPM Function Table Interface (FTI)
|
||||
*/
|
||||
|
||||
|
||||
/* Sensor categories */
|
||||
typedef enum {
|
||||
UPM_ACCELEROMETER,
|
||||
UPM_ANGLE,
|
||||
UPM_AUDIO,
|
||||
UPM_COMPASS,
|
||||
UPM_CURRENT,
|
||||
UPM_DISPLAY,
|
||||
UPM_DISTANCE,
|
||||
UPM_ELECTRICITY,
|
||||
UPM_FLOW,
|
||||
UPM_FORCE,
|
||||
UPM_GAS,
|
||||
UPM_GYROSCOPE,
|
||||
UPM_HEART_RATE,
|
||||
UPM_HUMIDITY,
|
||||
UPM_IMU,
|
||||
UPM_JOYSTICK,
|
||||
UPM_LED,
|
||||
UPM_LIGHT,
|
||||
UPM_MOISTURE,
|
||||
UPM_NFC,
|
||||
UPM_PH,
|
||||
UPM_POTENTIOMETER,
|
||||
UPM_PRESSURE,
|
||||
UPM_RAW,
|
||||
UPM_SENSOR,
|
||||
UPM_SERVO,
|
||||
UPM_STEPPER,
|
||||
UPM_SWITCH,
|
||||
UPM_TEMPERATURE,
|
||||
UPM_TIME,
|
||||
UPM_VIBRATION,
|
||||
UPM_VIDEO,
|
||||
UPM_VOLTAGE,
|
||||
UPM_WIRELESS,
|
||||
UPM_STREAM
|
||||
} upm_sensor_t;
|
||||
|
||||
/* Supported IO protocols via MRAA */
|
||||
typedef enum {
|
||||
UPM_ANALOG,
|
||||
UPM_GPIO,
|
||||
UPM_PWM,
|
||||
UPM_I2C,
|
||||
UPM_SPI,
|
||||
UPM_UART,
|
||||
UPM_ONEWIRE
|
||||
} upm_protocol_t;
|
||||
|
||||
/* Sensor descriptor */
|
||||
typedef struct _upm_sensor_descriptor {
|
||||
const char* name;
|
||||
const char* description;
|
||||
int protocol_size;
|
||||
const upm_protocol_t* protocol;
|
||||
int category_size;
|
||||
const upm_sensor_t* category;
|
||||
} upm_sensor_descriptor_t;
|
||||
|
||||
/* Function pointer typedef helpers */
|
||||
typedef struct _upm_sensor_ft* (*func_get_upm_sensor_ft)(upm_sensor_t sensor_type);
|
||||
|
||||
#include <fti/upm_acceleration.h>
|
||||
#include <fti/upm_angle.h>
|
||||
#include <fti/upm_audio.h>
|
||||
#include <fti/upm_distance.h>
|
||||
#include <fti/upm_heart_rate.h>
|
||||
#include <fti/upm_ph.h>
|
||||
#include <fti/upm_potentiometer.h>
|
||||
#include <fti/upm_servo.h>
|
||||
#include <fti/upm_sensor.h>
|
||||
#include <fti/upm_switch.h>
|
||||
#include <fti/upm_temperature.h>
|
||||
#include <fti/upm_touch.h>
|
||||
#include <fti/upm_voltage.h>
|
||||
#include <fti/upm_vibration.h>
|
||||
#include <fti/upm_moisture.h>
|
||||
#include <fti/upm_light.h>
|
||||
#include <fti/upm_stream.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* UPM_FTI_H_ */
|
27
include/upm_internal.h
Normal file
27
include/upm_internal.h
Normal file
@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Authors:
|
||||
* Copyright (c) 2016 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#ifndef UPM_INTERNAL_H_
|
||||
#define UPM_INTERNAL_H_
|
||||
|
||||
#endif /* UPM_INTERNAL_H_ */
|
39
include/upm_math.h
Normal file
39
include/upm_math.h
Normal file
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Authors:
|
||||
* Copyright (c) 2016 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#ifndef UPM_MATH_H_
|
||||
#define UPM_MATH_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef linux
|
||||
#include <math.h>
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* UPM_MATH_H_ */
|
60
include/upm_types.h
Normal file
60
include/upm_types.h
Normal file
@ -0,0 +1,60 @@
|
||||
/*
|
||||
* Authors:
|
||||
* Copyright (c) 2016 Intel Corporation.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, sublicense, and/or sell copies of the Software, and to
|
||||
* permit persons to whom the Software is furnished to do so, subject to
|
||||
* the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#ifndef UPM_TYPES_H_
|
||||
#define UPM_TYPES_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef C99
|
||||
#include <stdbool.h>
|
||||
#elif __cplusplus
|
||||
#else
|
||||
typedef enum {
|
||||
false = 0,
|
||||
true = 1
|
||||
} bool;
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
UPM_SUCCESS = 0, /* Operation is successful, expected response */
|
||||
UPM_ERROR_NOT_IMPLEMENTED = 1, /* Trying to access a feature or mode that is not implemented */
|
||||
UPM_ERROR_NOT_SUPPORTED = 2, /* Trying to access a feature or mode that is not supported */
|
||||
UPM_ERROR_NO_RESOURCES = 3, /* No resources to perform operation */
|
||||
UPM_ERROR_NO_DATA = 4, /* No data received or available from the sensor */
|
||||
UPM_ERROR_INVALID_PARAMETER = 5, /* Invalid parameter passed to the function*/
|
||||
UPM_ERROR_INVALID_SIZE = 6, /* Invalid buffer size */
|
||||
UPM_ERROR_OUT_OF_RANGE = 7, /* When the input to drive is too high/low or -ve */
|
||||
UPM_ERROR_OPERATION_FAILED = 8, /* When a function isn't able to perform as expected */
|
||||
UPM_ERROR_TIMED_OUT = 9, /* Timed out while communicating with the sensor */
|
||||
|
||||
UPM_ERROR_UNSPECIFIED = 99 /* Unspecified/Unknown error */
|
||||
} upm_result_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* UPM_TYPES_H_ */
|
Reference in New Issue
Block a user