diff options
author | JF <jf@codingfield.com> | 2020-03-01 21:00:59 +0100 |
---|---|---|
committer | JF <jf@codingfield.com> | 2020-03-01 21:00:59 +0100 |
commit | 6f1857c50397aa26d1b16ded6bbb4e6952f3762e (patch) | |
tree | 877086a8a42fba1dfb11b853be730410de8e506c /src/drivers | |
parent | 5bc0640b735573b465cfef16fb729ad5f5149eb4 (diff) |
Add debugPins module that provides functions to set and clear debug GPIOs.
Disable logging once again.
Diffstat (limited to 'src/drivers')
-rw-r--r-- | src/drivers/DebugPins.cpp | 49 | ||||
-rw-r--r-- | src/drivers/DebugPins.h | 25 |
2 files changed, 74 insertions, 0 deletions
diff --git a/src/drivers/DebugPins.cpp b/src/drivers/DebugPins.cpp new file mode 100644 index 00000000..5a12fd86 --- /dev/null +++ b/src/drivers/DebugPins.cpp @@ -0,0 +1,49 @@ +#include <hal/nrf_gpio.h> +#include "DebugPins.h" + +#ifdef USE_DEBUG_PINS +void debugpins_init() { + nrf_gpio_cfg_output(DebugPin0); + nrf_gpio_pin_clear(DebugPin0); + + nrf_gpio_cfg_output(DebugPin1); + nrf_gpio_pin_clear(DebugPin1); + + nrf_gpio_cfg_output(DebugPin2); + nrf_gpio_pin_clear(DebugPin2); + + nrf_gpio_cfg_output(DebugPin3); + nrf_gpio_pin_clear(DebugPin3); + + nrf_gpio_cfg_output(DebugPin4); + nrf_gpio_pin_clear(DebugPin4); +} +void debugpins_set(debugpins_pins pin) { + nrf_gpio_pin_set((uint32_t)(pin)); +} + +void debugpins_clear(debugpins_pins pin) { + nrf_gpio_pin_clear((uint32_t)(pin)); +} + +void debugpins_pulse(debugpins_pins pin) { + nrf_gpio_pin_set((uint32_t)(pin)); + nrf_gpio_pin_clear((uint32_t)(pin)); +} +#else +void debugpins_init() { + +} +void debugpins_set(debugpins_pins pin) { + +} + +void debugpins_clear(debugpins_pins pin) { + +} + +void debugpins_pulse(debugpins_pins pin) { + +} + +#endif
\ No newline at end of file diff --git a/src/drivers/DebugPins.h b/src/drivers/DebugPins.h new file mode 100644 index 00000000..cb20bac5 --- /dev/null +++ b/src/drivers/DebugPins.h @@ -0,0 +1,25 @@ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +#include <stdint.h> + +typedef enum { + DebugPin0 = 27, + DebugPin1 = 29, + DebugPin2 = 20, + DebugPin3 = 17, + DebugPin4 = 11, +} debugpins_pins; + +void debugpins_init(); +void debugpins_set(debugpins_pins pin); +void debugpins_clear(debugpins_pins pin); +void debugpins_pulse(debugpins_pins pin); + +#ifdef __cplusplus +} +#endif + |