Unify duplicated code between touch_adc.cpp and rssi.cpp.

Also remove comments and dead code.
This commit is contained in:
Jared Boone 2015-07-08 16:00:18 -07:00
parent c142b1bcfc
commit f360c01ff3
2 changed files with 2 additions and 23 deletions

View File

@ -29,8 +29,6 @@
#include "hal.h" #include "hal.h"
using namespace lpc43xx; using namespace lpc43xx;
// #include "hackrf_gpio.hpp"
#include "hackrf_hal.hpp" #include "hackrf_hal.hpp"
using namespace hackrf::one; using namespace hackrf::one;
@ -63,8 +61,6 @@ void init() {
adc0.interrupts_disable(); adc0.interrupts_disable();
adc0.power_up(adc0_config); adc0.power_up(adc0_config);
adc0.interrupts_enable(adc0_interrupt_mask); adc0.interrupts_enable(adc0_interrupt_mask);
//nvicEnableVector(ADC0_IRQn, CORTEX_PRIORITY_MASK(LPC_ADC0_IRQ_PRIORITY));
} }
void start() { void start() {

View File

@ -28,7 +28,6 @@
#include "utility.hpp" #include "utility.hpp"
#include "hal.h" #include "hal.h"
using namespace lpc43xx; using namespace lpc43xx;
#include "hackrf_hal.hpp" #include "hackrf_hal.hpp"
@ -39,10 +38,9 @@ using namespace hackrf::one;
namespace rf { namespace rf {
namespace rssi { 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); 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 { constexpr adc::CR adc1_cr {
.sel = adc1_sel, .sel = adc1_sel,
.clkdiv = 49, /* 400kHz sample rate, 2.5us/sample @ 200MHz PCLK */ .clkdiv = 49, /* 400kHz sample rate, 2.5us/sample @ 200MHz PCLK */
@ -53,28 +51,13 @@ constexpr adc::Config adc1_config {
.cr = adc1_cr, .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() { void init() {
adc1.clock_enable(); adc1.clock_enable();
//adc1.interrupts_disable(); adc1.interrupts_disable();
adc1.power_up(adc1_config); adc1.power_up(adc1_config);
/* An interrupt must be enabled within peripheral to issue request to
*GPDMA */
adc1.interrupts_enable(adc1_interrupt_mask); adc1.interrupts_enable(adc1_interrupt_mask);
dma::init(); dma::init();
// dma::set_handlers(rssi_buffer_available, rssi_buffer_error);
} }
void start() { void start() {