Browse Source

HAL_ChibiOS: added disable() API for pulse input

zr-v5.1
Andrew Tridgell 5 years ago
parent
commit
9c0cf0871b
  1. 6
      libraries/AP_HAL_ChibiOS/SoftSigReader.cpp
  2. 1
      libraries/AP_HAL_ChibiOS/SoftSigReader.h
  3. 5
      libraries/AP_HAL_ChibiOS/SoftSigReaderInt.cpp
  4. 1
      libraries/AP_HAL_ChibiOS/SoftSigReaderInt.h

6
libraries/AP_HAL_ChibiOS/SoftSigReader.cpp

@ -91,6 +91,12 @@ bool SoftSigReader::attach_capture_timer(ICUDriver* icu_drv, icuchannel_t chan, @@ -91,6 +91,12 @@ bool SoftSigReader::attach_capture_timer(ICUDriver* icu_drv, icuchannel_t chan,
return true;
}
void SoftSigReader::disable(void)
{
icuStopCapture(_icu_drv);
dmaStreamDisable(dma);
}
void SoftSigReader::_irq_handler(void* self, uint32_t flags)
{
SoftSigReader* sig_reader = (SoftSigReader*)self;

1
libraries/AP_HAL_ChibiOS/SoftSigReader.h

@ -36,6 +36,7 @@ class ChibiOS::SoftSigReader { @@ -36,6 +36,7 @@ class ChibiOS::SoftSigReader {
friend class ChibiOS::RCInput;
public:
bool attach_capture_timer(ICUDriver* icu_drv, icuchannel_t chan, uint8_t dma_stream, uint32_t dma_channel);
void disable(void);
private:
uint32_t *signal;

5
libraries/AP_HAL_ChibiOS/SoftSigReaderInt.cpp

@ -90,6 +90,11 @@ void SoftSigReaderInt::init(EICUDriver* icu_drv, eicuchannel_t chan) @@ -90,6 +90,11 @@ void SoftSigReaderInt::init(EICUDriver* icu_drv, eicuchannel_t chan)
eicuEnable(_icu_drv);
}
void SoftSigReaderInt::disable(void)
{
eicuDisable(_icu_drv);
}
void SoftSigReaderInt::_irq_handler(EICUDriver *eicup, eicuchannel_t aux_channel)
{
eicuchannel_t channel = get_pair_channel(aux_channel);

1
libraries/AP_HAL_ChibiOS/SoftSigReaderInt.h

@ -42,6 +42,7 @@ public: @@ -42,6 +42,7 @@ public:
void init(EICUDriver* icu_drv, eicuchannel_t chan);
bool read(uint32_t &widths0, uint32_t &widths1);
void disable(void);
private:
// singleton
static SoftSigReaderInt *_singleton;

Loading…
Cancel
Save