Fixed DMA time comparison.
Change-Id: I9aa454f3a3c75bd2ad65c0bcb62591e1acbc17f8
diff --git a/aos/externals/forwpilib/dma.cc b/aos/externals/forwpilib/dma.cc
index 3d41c43..ce8bbd3 100644
--- a/aos/externals/forwpilib/dma.cc
+++ b/aos/externals/forwpilib/dma.cc
@@ -350,8 +350,12 @@
ssize_t DMASample::offset(int index) const { return dma_->channel_offsets_[index]; }
+uint32_t DMASample::GetTime() const {
+ return read_buffer_[dma_->capture_size_ - 1];
+}
+
double DMASample::GetTimestamp() const {
- return static_cast<double>(read_buffer_[dma_->capture_size_ - 1]) * 0.000001;
+ return static_cast<double>(GetTime()) * 0.000001;
}
bool DMASample::Get(DigitalSource *input) const {
diff --git a/aos/externals/forwpilib/dma.h b/aos/externals/forwpilib/dma.h
index 754b0a5..2f5b331 100644
--- a/aos/externals/forwpilib/dma.h
+++ b/aos/externals/forwpilib/dma.h
@@ -22,8 +22,10 @@
public:
DMASample() = default;
- // Returns the FPGA timestamp of the sample.
+ // Returns the FPGA timestamp of the sample in seconds.
double GetTimestamp() const;
+ // Returns the FPGA timestamp of the sample in microseconds.
+ uint32_t GetTime() const;
// All Get methods either return the requested value, or set the Error.