12 #include <boost/system/error_code.hpp> 15 #include "gtest/gtest.h" 20 #define EXPORT_GPIO_PATH "/sys/class/gpio/export" 21 #define UNEXPORT_GPIO_PATH "/sys/class/gpio/unexport" 22 #define GPIO_PATH "/sys/class/gpio/gpio" 75 static std::map<int, dpyUtilsGpio::Edge> s_mapEdge;
80 static std::map<dpyUtilsGpio::Functionality, std::string> EP100GpioNumMap = { {
dpyUtilsGpio::DO0,
"115"}, {
dpyUtilsGpio::DO1,
"121"}, {
dpyUtilsGpio::DO2,
"122"}, {
dpyUtilsGpio::DI0,
"65"}, {
dpyUtilsGpio::DI1,
"66"}, {
dpyUtilsGpio::DI2,
"67"}};
96 std::string getGpioNum();
99 explicit Gpio(std::string gnum);
109 bool createGpio(boost::system::error_code& ec);
110 bool deleteGpio(boost::system::error_code& ec);
128 FRIEND_TEST(Basic_gpio_tests, create_GPIO_OK);
129 FRIEND_TEST(Basic_gpio_tests, create_GPIO_IO_ERROR);
130 FRIEND_TEST(Basic_gpio_tests, create_GPIO_NO_EFFECT);
131 FRIEND_TEST(Basic_gpio_tests, delete_GPIO_OK);
132 FRIEND_TEST(Basic_gpio_tests, delete_GPIO_IO_ERROR);
133 FRIEND_TEST(Basic_gpio_tests, delete_GPIO_ERROR);
134 FRIEND_TEST(Basic_gpio_tests, get_dir_INPUT_OK);
135 FRIEND_TEST(Basic_gpio_tests, get_dir_OUTPUT_OK);
136 FRIEND_TEST(Basic_gpio_tests, get_dir_ERROR);
137 FRIEND_TEST(Basic_gpio_tests, get_dir_BAD_PARAMETER);
138 FRIEND_TEST(Basic_gpio_tests, set_edge_OK);
139 FRIEND_TEST(Basic_gpio_tests, get_edge_OK);
140 FRIEND_TEST(Basic_gpio_tests, get_val_OK);
141 FRIEND_TEST(Basic_gpio_tests, get_val_ERROR);
142 FRIEND_TEST(Basic_gpio_tests, get_val_BAD_PARAMETER);
143 FRIEND_TEST(Basic_gpio_tests, get_edge_OK);
144 FRIEND_TEST(Basic_gpio_tests, get_edge_ERROR);
145 FRIEND_TEST(Basic_gpio_tests, get_edge_BAD_PARAMETER);
146 FRIEND_TEST(Advanced_gpio_tests, set_dir_OK_NO_EFFECT);
147 FRIEND_TEST(Advanced_gpio_tests, set_dir_NOT_OBTAIN_VALUE);
148 FRIEND_TEST(Advanced_gpio_tests, set_dir_NOT_OBTAIN_VALUE_2);
149 FRIEND_TEST(Advanced_gpio_tests, set_dir_BAD_PARAMETER);
150 FRIEND_TEST(Advanced_gpio_tests, set_dir_NOT_PERMITTED);
151 FRIEND_TEST(Advanced_gpio_tests, set_val_OK_0);
152 FRIEND_TEST(Advanced_gpio_tests, set_val_OK_1);
153 FRIEND_TEST(Advanced_gpio_tests, set_val_BAD_PARAMETER);
154 FRIEND_TEST(Advanced_gpio_tests, set_val_IO_ERROR);
155 FRIEND_TEST(Advanced_gpio_tests, set_val_NOT_OBTAIN_VALUE);
156 FRIEND_TEST(Advanced_gpio_tests, set_val_NOT_PERMITTED);
157 FRIEND_TEST(Advanced_gpio_tests, set_val_NOT_PERMITTED_2);
158 FRIEND_TEST(Advanced_gpio_tests, set_edge_OK);
159 FRIEND_TEST(Advanced_gpio_tests, set_edge_NOT_PERMITTED);
160 FRIEND_TEST(Advanced_gpio_tests, set_edge_BAD_PARAMETER);
161 FRIEND_TEST(Advanced_gpio_tests, set_edge_NOT_OBTAIN_VALUE);
162 FRIEND_TEST(Advanced_gpio_tests_2, switch_options_OK_1);
163 FRIEND_TEST(Advanced_gpio_tests_2, switch_options_OK_2);
164 FRIEND_TEST(Advanced_gpio_tests_2, switch_options_ERROR_1);
165 FRIEND_TEST(Advanced_gpio_tests_2, switch_options_ERROR_2);
This class implementes the read/write operations to work with text files stored in the file sytem...
Definition: files.h:43
DI2.
Definition: gpio.h:62
The value of the edge and its string.
Definition: gpio.h:68
DO1.
Definition: gpio.h:58
Low to High edge.
Definition: gpio.h:47
High to low edge.
Definition: gpio.h:48
DI1.
Definition: gpio.h:61
As an output.
Definition: gpio.h:29
As an input.
Definition: gpio.h:28
Low voltage.
Definition: gpio.h:37
Each object instantiated from this class will control a GPIO pin. The GPIO pin number must be defined...
Definition: gpio.h:89
Both edges-.
Definition: gpio.h:49
std::string gpionum
The gpio number that is wanted to configure.
Definition: gpio.h:92
Files * file
File Object to use GPIOs.
Definition: gpio.h:93
High voltage.
Definition: gpio.h:38
std::string sEdge
The default property configuration value.
Definition: gpio.h:70
enum EDGE edge
A string register name of the configuration property.
Definition: gpio.h:71
DIRECTION
An enum definition of the direction of the port.
Definition: gpio.h:26
DO2.
Definition: gpio.h:59
DI0.
Definition: gpio.h:60
EDGE
The edge definition for the hardware interrupts.
Definition: gpio.h:44
VALUE
The value of the port.
Definition: gpio.h:35
Functionality
Digital outputs or inputs available for application users.
Definition: gpio.h:55
DO0.
Definition: gpio.h:57