HAL_ChibiOS: added disable() API for pulse input

This commit is contained in:
Andrew Tridgell 2020-01-29 13:21:54 +11:00
parent 258b8b71ea
commit 9c0cf0871b
4 changed files with 13 additions and 0 deletions

View File

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

View File

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

View File

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

View File

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