From d38e3e9fb42adb84861de3e181164613da916696 Mon Sep 17 00:00:00 2001 From: Carlos Pereira Atencio Date: Sat, 31 Dec 2022 19:34:04 +0000 Subject: [PATCH] Replace `using namespace` in headers with explicit namespaces. As part of: https://github.com/lancaster-university/codal-microbit-v2/issues/240 Other targets should also apply patches like bdfa1eca85dbbd6fc8aaf5fc4c3fd00c1f65762d to ensure they don't depend on the header files having the `using namespace codal` line.` --- inc/NRF52ADC.h | 6 +++--- inc/NRF52PDM.h | 4 +++- inc/NRF52PWM.h | 6 +++--- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/inc/NRF52ADC.h b/inc/NRF52ADC.h index 9def83c..8b703e8 100644 --- a/inc/NRF52ADC.h +++ b/inc/NRF52ADC.h @@ -42,15 +42,14 @@ DEALINGS IN THE SOFTWARE. // #define NRF52_ADC_DATA_READY 1 - -using namespace codal; - // // NRF52ADCChannel status codes // #define NRF52_ADC_CHANNEL_STATUS_ENABLED 0x10 #define NRF52_ADC_CHANNEL_STATUS_CONNECTED 0x20 +namespace codal +{ class NRF52ADC; class NRF52ADCChannel : public DataSource @@ -350,5 +349,6 @@ class NRF52ADC : public CodalComponent, public PinPeripheral */ void configureSampling(); }; +} // namespace codal #endif diff --git a/inc/NRF52PDM.h b/inc/NRF52PDM.h index 691cfdc..eb0ce8f 100755 --- a/inc/NRF52PDM.h +++ b/inc/NRF52PDM.h @@ -40,7 +40,8 @@ DEALINGS IN THE SOFTWARE. // #define NRF52_PDM_BUFFER_SIZE 512 -using namespace codal; +namespace codal +{ class NRF52PDM : public CodalComponent, public DataSource { @@ -103,5 +104,6 @@ class NRF52PDM : public CodalComponent, public DataSource void startDMA(); }; +} // namespace codal #endif diff --git a/inc/NRF52PWM.h b/inc/NRF52PWM.h index 946aa6c..42c2575 100755 --- a/inc/NRF52PWM.h +++ b/inc/NRF52PWM.h @@ -15,9 +15,8 @@ #define NRF52PWM_PWM_PERIPHERALS 3 #define NRF52PWM_PWM_CHANNELS 4 - -using namespace codal; - +namespace codal +{ class NRF52PWM : public CodalComponent, public DataSink, public PinPeripheral { @@ -153,5 +152,6 @@ class NRF52PWM : public CodalComponent, public DataSink, public PinPeripheral int tryPull(uint8_t b); }; +} // namespace codal #endif