WPILibC++  2020.3.2
DMA.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) 2019 FIRST. All Rights Reserved. */
3 /* Open Source Software - may be modified and shared by FRC teams. The code */
4 /* must be accompanied by the FIRST BSD license file in the root directory of */
5 /* the project. */
6 /*----------------------------------------------------------------------------*/
7 
8 #pragma once
9 
10 #include <hal/Types.h>
11 
12 #include "frc/ErrorBase.h"
13 
14 namespace frc {
15 class Encoder;
16 class Counter;
17 class DigitalSource;
18 class DutyCycle;
19 class AnalogInput;
20 class DMASample;
21 
22 class DMA : public ErrorBase {
23  friend class DMASample;
24 
25  public:
26  DMA();
27  ~DMA() override;
28 
29  DMA& operator=(DMA&& other) = default;
30  DMA(DMA&& other) = default;
31 
32  void SetPause(bool pause);
33  void SetRate(int cycles);
34 
35  void AddEncoder(const Encoder* encoder);
36  void AddEncoderPeriod(const Encoder* encoder);
37 
38  void AddCounter(const Counter* counter);
39  void AddCounterPeriod(const Counter* counter);
40 
41  void AddDigitalSource(const DigitalSource* digitalSource);
42 
43  void AddDutyCycle(const DutyCycle* digitalSource);
44 
45  void AddAnalogInput(const AnalogInput* analogInput);
46  void AddAveragedAnalogInput(const AnalogInput* analogInput);
47  void AddAnalogAccumulator(const AnalogInput* analogInput);
48 
49  void SetExternalTrigger(DigitalSource* source, bool rising, bool falling);
50 
51  void StartDMA(int queueDepth);
52  void StopDMA();
53 
54  private:
55  hal::Handle<HAL_DMAHandle> dmaHandle;
56 };
57 } // namespace frc
frc::DMA
Definition: DMA.h:22
frc::DMASample
Definition: DMASample.h:23
frc::DutyCycle
Class to read a duty cycle PWM input.
Definition: DutyCycle.h:35
frc::ErrorBase
Base class for most objects.
Definition: ErrorBase.h:104
frc::Encoder
Class to read quad encoders.
Definition: Encoder.h:44
frc::AnalogInput
Analog input class.
Definition: AnalogInput.h:37
frc
A class that enforces constraints on the differential drive kinematics.
Definition: SPIAccelerometerSim.h:16
frc::Counter
Class for counting the number of ticks on a digital input channel.
Definition: Counter.h:37
frc::DigitalSource
DigitalSource Interface.
Definition: DigitalSource.h:25