Execute IO function.
129 {
131
135 }
137 }
138
139 switch (function) {
141 if (args.size() < 1) {
143 }
144 uint8_t level = static_cast<uint8_t>(args[0]);
145 if (level > 1) {
147 }
150 }
151
153 if (args.size() < 1) {
155 }
156 uint8_t* level_ptr = reinterpret_cast<uint8_t*>(static_cast<uintptr_t>(args[0]));
157 if (level_ptr == nullptr) {
159 }
162 }
163
167 }
168
170 if (args.size() < 1) {
172 }
173
176 }
177
179 if (args.size() < 1) {
181 }
184 }
185
187 if (args.size() < 3) {
189 }
190 void (*callback)(uint8_t, void*) = reinterpret_cast<void (*)(uint8_t, void*)>(static_cast<uintptr_t>(args[0]));
191 void* user_data = reinterpret_cast<void*>(static_cast<uintptr_t>(args[1]));
192 uint8_t trigger_type = static_cast<uint8_t>(args[2]);
194 }
195
199 }
200
202 if (args.size() < 1) {
204 }
205 bool enable = static_cast<bool>(args[0]);
208 }
209
211
213 }
214
215 default:
217 }
218 }
virtual int registerInterrupt(void(*callback)(uint8_t, void *), void *user_data, uint8_t trigger_type) override
Register interrupt (convenience method).
Definition meshx_gpio_impl.cpp:287
meshx_err_t
MeshX Error Codes.
Definition meshx_err.h:43
meshx_err_t meshx_gpio_set_level(uint8_t logical_pin, uint8_t level)
Set GPIO pin level.
Definition meshx_gpio.c:322
meshx_err_t meshx_gpio_execute_function(uint8_t logical_pin, meshx_io_function_t function, const uint32_t *args, uint8_t arg_count)
Execute IO function on GPIO pin.
Definition meshx_gpio.c:616
meshx_err_t meshx_gpio_get_level(uint8_t logical_pin, uint8_t *level)
Get GPIO pin level.
Definition meshx_gpio.c:392
meshx_err_t meshx_gpio_intr_enable(uint8_t logical_pin, bool enable)
Enable/disable GPIO interrupt.
Definition meshx_gpio.c:591
meshx_err_t meshx_gpio_unregister_intr(uint8_t logical_pin)
Unregister GPIO interrupt handler.
Definition meshx_gpio.c:557
meshx_err_t meshx_gpio_init(void)
Initialize GPIO subsystem.
Definition meshx_gpio.c:95
meshx_err_t meshx_gpio_toggle(uint8_t logical_pin)
Toggle GPIO pin level.
Definition meshx_gpio.c:453
@ MESHX_IO_FUNCTION_SET_PWM_FREQUENCY
Definition meshx_gpio.h:68
@ MESHX_IO_FUNCTION_SET_PWM_DUTY
Definition meshx_gpio.h:67
**This function is called by the parent element when a state change request *is received It validates the request and returns a result to the element not the model layer **return * MESHX_SUCCESS
Definition meshx_model_level.cpp:385
@ NOT_INITIALIZED
Definition meshx_io_types.hpp:90
@ PWM_NOT_SUPPORTED
Definition meshx_io_types.hpp:87
@ INVALID_MODE
Definition meshx_io_types.hpp:82
@ NOT_SUPPORTED
Definition meshx_io_types.hpp:89
@ INTR_NOT_SUPPORTED
Definition meshx_io_types.hpp:85
@ INVALID_ARG
Definition meshx_io_types.hpp:84
@ PWM_INVALID_PARAM
Definition meshx_io_types.hpp:88
@ INVALID_LEVEL
Definition meshx_io_types.hpp:83
@ REGISTER_INTERRUPT
Definition meshx_io_interface.hpp:31
@ TOGGLE
Definition meshx_io_interface.hpp:28
@ UNREGISTER_INTERRUPT
Definition meshx_io_interface.hpp:32
@ SET_PWM_DUTY
Definition meshx_io_interface.hpp:29
@ SET_PWM_FREQUENCY
Definition meshx_io_interface.hpp:30
@ CUSTOM_FUNCTION
Definition meshx_io_interface.hpp:34
@ SET_LEVEL
Definition meshx_io_interface.hpp:26
@ GET_LEVEL
Definition meshx_io_interface.hpp:27