34 #include "lib/simEnvChange.h" 41 #define LOG_MODULE "Cooja Button" 42 #define LOG_LEVEL LOG_LEVEL_NONE 45 char simButtonChanged;
47 char simButtonIsActive = 1;
48 const struct simInterface button_interface;
51 BUTTON_HAL_BUTTON(button_user,
"User button", COOJA_BTN_PIN,
54 BUTTON_HAL_BUTTONS(&button_user);
57 doInterfaceActionsBeforeTick(
void)
59 if(simButtonChanged) {
60 LOG_DBG(
"Cooja button changed. simButtonIsDown=%u, ", simButtonIsDown);
67 LOG_DBG_(
"clearing pin");
70 LOG_DBG_(
"setting pin");
79 LOG_DBG_(
", triggering edge event");
89 doInterfaceActionsAfterTick(
void)
93 SIM_INTERFACE(button_interface,
94 doInterfaceActionsBeforeTick,
95 doInterfaceActionsAfterTick);
101 #include "lib/sensors.h" 102 #include "dev/button-sensor.h" 111 configure(
int type,
int c)
122 SENSORS_SENSOR(
button_sensor, BUTTON_SENSOR, value, configure, status);
void gpio_hal_arch_no_port_set_pin(gpio_hal_pin_t pin)
Set a GPIO pin to logical high.
SENSORS & button_sensor
Exports global symbols for the sensor API.
gpio_hal_pin_cfg_t gpio_hal_arch_no_port_pin_cfg_get(gpio_hal_pin_t pin)
Read the configuration of a GPIO pin.
void gpio_hal_arch_no_port_clear_pin(gpio_hal_pin_t pin)
Clear a GPIO pin (logical low)
#define gpio_hal_pin_to_mask(pin)
Convert a pin to a pin mask.
void gpio_hal_event_handler(gpio_hal_port_t port, gpio_hal_pin_mask_t pins)
The platform-independent GPIO event handler.
Header file for the logging system