Add debugPins module that provides functions to set and clear debug GPIOs.

Disable logging once again.
This commit is contained in:
JF
2020-03-01 21:00:59 +01:00
parent 5bc0640b73
commit 6f1857c503
5 changed files with 88 additions and 3 deletions

View File

@@ -178,6 +178,7 @@ list(APPEND SOURCE_FILES
drivers/St7789.cpp
drivers/SpiMaster.cpp
drivers/Watchdog.cpp
drivers/DebugPins.cpp
BLE/BleManager.c
Components/Battery/BatteryController.cpp
Components/Ble/BleController.cpp
@@ -211,6 +212,7 @@ set(INCLUDE_FILES
drivers/St7789.h
drivers/SpiMaster.h
drivers/Watchdog.h
drivers/DebugPins.h
BLE/BleManager.h
Components/Battery/BatteryController.h
Components/Ble/BleController.h

49
src/drivers/DebugPins.cpp Normal file
View File

@@ -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

25
src/drivers/DebugPins.h Normal file
View File

@@ -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

View File

@@ -8452,15 +8452,15 @@
// <e> NRF_LOG_ENABLED - nrf_log - Logger
//==========================================================
#ifndef NRF_LOG_ENABLED
#define NRF_LOG_ENABLED 1
#define NRF_LOG_ENABLED 0
#endif
#ifndef NRF_LOG_BACKEND_RTT_ENABLED
#define NRF_LOG_BACKEND_RTT_ENABLED 1
#define NRF_LOG_BACKEND_RTT_ENABLED 0
#endif
#ifndef NRF_LOG_BACKEND_SERIAL_USES_RTT
#define NRF_LOG_BACKEND_SERIAL_USES_RTT 1
#define NRF_LOG_BACKEND_SERIAL_USES_RTT 0s
#endif
// <h> Log message pool - Configuration of log message pool