From f360c01ff3964b21f5e82c79101d6e92094f1c6f Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Wed, 8 Jul 2015 16:00:18 -0700 Subject: [PATCH] Unify duplicated code between touch_adc.cpp and rssi.cpp. Also remove comments and dead code. --- firmware/application/touch_adc.cpp | 4 ---- firmware/baseband/rssi.cpp | 21 ++------------------- 2 files changed, 2 insertions(+), 23 deletions(-) diff --git a/firmware/application/touch_adc.cpp b/firmware/application/touch_adc.cpp index 0c5519f1..0808f9fc 100644 --- a/firmware/application/touch_adc.cpp +++ b/firmware/application/touch_adc.cpp @@ -29,8 +29,6 @@ #include "hal.h" using namespace lpc43xx; -// #include "hackrf_gpio.hpp" - #include "hackrf_hal.hpp" using namespace hackrf::one; @@ -63,8 +61,6 @@ void init() { adc0.interrupts_disable(); adc0.power_up(adc0_config); adc0.interrupts_enable(adc0_interrupt_mask); - - //nvicEnableVector(ADC0_IRQn, CORTEX_PRIORITY_MASK(LPC_ADC0_IRQ_PRIORITY)); } void start() { diff --git a/firmware/baseband/rssi.cpp b/firmware/baseband/rssi.cpp index 2117840d..2e9cfa32 100644 --- a/firmware/baseband/rssi.cpp +++ b/firmware/baseband/rssi.cpp @@ -28,7 +28,6 @@ #include "utility.hpp" #include "hal.h" - using namespace lpc43xx; #include "hackrf_hal.hpp" @@ -39,10 +38,9 @@ using namespace hackrf::one; namespace rf { namespace rssi { -constexpr uint32_t adc1_sel = (1U << portapack::adc1_rssi_input); +constexpr uint8_t adc1_sel = (1 << portapack::adc1_rssi_input); const auto adc1_interrupt_mask = flp2(adc1_sel); -//constexpr uint32_t adc1_clkdiv = base_apb3_clk_f / adc::clock_rate_max; constexpr adc::CR adc1_cr { .sel = adc1_sel, .clkdiv = 49, /* 400kHz sample rate, 2.5us/sample @ 200MHz PCLK */ @@ -53,28 +51,13 @@ constexpr adc::Config adc1_config { .cr = adc1_cr, }; -// volatile size_t rssi_buffer_available_count = 0; -// volatile size_t rssi_buffer_error_count = 0; - -// static void rssi_buffer_available() { -// rssi_buffer_available_count++; -// } - -// static void rssi_buffer_error() { -// rssi_buffer_error_count++; -// } - void init() { adc1.clock_enable(); - //adc1.interrupts_disable(); + adc1.interrupts_disable(); adc1.power_up(adc1_config); - - /* An interrupt must be enabled within peripheral to issue request to - *GPDMA */ adc1.interrupts_enable(adc1_interrupt_mask); dma::init(); -// dma::set_handlers(rssi_buffer_available, rssi_buffer_error); } void start() {