[hal] Add support for DMA to Java (#3158)

This commit is contained in:
Thad House
2021-06-14 19:56:42 -07:00
committed by GitHub
parent 85144e47ff
commit 4a36f86c81
39 changed files with 2013 additions and 97 deletions

View File

@@ -39,7 +39,7 @@ class Robot : public frc::TimedRobot {
// Start DMA. No triggers or inputs can be added after this call
// unless DMA is stopped.
m_dma.StartDMA(1024);
m_dma.Start(1024);
}
void RobotPeriodic() override {
@@ -53,10 +53,13 @@ class Robot : public frc::TimedRobot {
// Update our sample. remaining is the number of samples remaining in the
// buffer status is more specific error messages if readStatus is not OK.
// Wait 1ms if buffer is empty
HAL_DMAReadStatus readStatus =
frc::DMASample::DMAReadStatus readStatus =
sample.Update(&m_dma, 1_ms, &remaining, &status);
if (readStatus == HAL_DMA_OK) {
// Unset trigger
m_dmaTrigger.Set(true);
if (readStatus == frc::DMASample::DMAReadStatus::kOk) {
// Status value in all these reads should be checked, a non 0 value means
// value could not be read