14#include <units/time.h>
137 int Read(
bool initiate, uint8_t* dataReceived,
int size);
146 int Transaction(uint8_t* dataToSend, uint8_t* dataReceived,
int size);
226 units::second_t timeout);
247 int pow2BytesPerRead);
265 int validMask,
int validValue,
int dataShift,
266 int dataSize,
bool isSigned,
bool bigEndian);
367 std::unique_ptr<Accumulator> m_accum;
and restrictions which apply to each piece of software is included later in this file and or inside of the individual applicable source files The disclaimer of warranty in the WPILib license above applies to all code in and nothing in any of the other licenses gives permission to use the names of FIRST nor the names of the WPILib contributors to endorse or promote products derived from this software The following pieces of software have additional or alternate and or glfw and nanopb were modified for use in Google Inc All rights reserved Redistribution and use in source and binary with or without are permitted provided that the following conditions are this list of conditions and the following disclaimer *Redistributions in binary form must reproduce the above copyright this list of conditions and the following disclaimer in the documentation and or other materials provided with the distribution *Neither the name of Google Inc nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS AS IS AND ANY EXPRESS OR IMPLIED BUT NOT LIMITED THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY OR CONSEQUENTIAL WHETHER IN STRICT OR EVEN IF ADVISED OF THE POSSIBILITY OF SUCH January AND DISTRIBUTION Definitions License shall mean the terms and conditions for and distribution as defined by Sections through of this document Licensor shall mean the copyright owner or entity authorized by the copyright owner that is granting the License Legal Entity shall mean the union of the acting entity and all other entities that control are controlled by or are under common control with that entity For the purposes of this definition control direct or to cause the direction or management of such whether by contract or including but not limited to software source documentation source
Definition ThirdPartyNotices.txt:123
DigitalSource Interface.
Definition DigitalSource.h:22
SPI bus interface class.
Definition SPI.h:27
void SetAccumulatorIntegratedCenter(double center)
Set the center value of the accumulator integrator.
void SetChipSelectActiveLow()
Configure the chip select line to be active low.
double GetAccumulatorIntegratedAverage() const
Read the average of the integrated value.
void StopAuto()
Stop running the automatic SPI transfer engine.
void ForceAutoRead()
Force the engine to make a single transfer.
void FreeAccumulator()
Frees the accumulator.
SPI(Port port)
Constructor.
void SetAccumulatorDeadband(int deadband)
Set the accumulator's deadband.
void ResetAccumulator()
Resets the accumulator to zero.
int Write(uint8_t *data, int size)
Write data to the peripheral device.
int Transaction(uint8_t *dataToSend, uint8_t *dataReceived, int size)
Perform a simultaneous read/write transaction with the device.
double GetAccumulatorAverage() const
Read the average of the accumulated value.
int Read(bool initiate, uint8_t *dataReceived, int size)
Read a word from the receive FIFO.
Port GetPort() const
Returns the SPI port.
void FreeAuto()
Frees the automatic SPI transfer engine.
void SetMode(Mode mode)
Sets the mode for the SPI device.
void SetAutoTransmitData(std::span< const uint8_t > dataToSend, int zeroSize)
Set the data to be transmitted by the engine.
void StartAutoRate(units::second_t period)
Start running the automatic SPI transfer engine at a periodic rate.
void SetChipSelectActiveHigh()
Configure the chip select line to be active high.
int64_t GetAccumulatorCount() const
Read the number of accumulated values.
hal::Handle< HAL_SPIPort, HAL_CloseSPI, HAL_SPI_kInvalid > m_port
Definition SPI.h:360
int GetAccumulatorLastValue() const
Read the last value read by the accumulator engine.
double GetAccumulatorIntegratedValue() const
Read the integrated value.
SPI & operator=(SPI &&)=default
void SetAccumulatorCenter(int center)
Set the center value of the accumulator.
Port
SPI port.
Definition SPI.h:32
@ kOnboardCS2
Onboard SPI bus port CS2.
Definition SPI.h:38
@ kOnboardCS1
Onboard SPI bus port CS1.
Definition SPI.h:36
@ kOnboardCS0
Onboard SPI bus port CS0.
Definition SPI.h:34
@ kOnboardCS3
Onboard SPI bus port CS3.
Definition SPI.h:40
@ kMXP
MXP (roboRIO MXP) SPI bus port.
Definition SPI.h:42
int64_t GetAccumulatorValue() const
Read the accumulated value.
Mode
SPI mode.
Definition SPI.h:48
@ kMode2
Clock idle high, data sampled on falling edge.
Definition SPI.h:54
@ kMode1
Clock idle low, data sampled on falling edge.
Definition SPI.h:52
@ kMode3
Clock idle high, data sampled on rising edge.
Definition SPI.h:56
@ kMode0
Clock idle low, data sampled on rising edge.
Definition SPI.h:50
void InitAuto(int bufferSize)
Initialize automatic SPI transfer engine.
int ReadAutoReceivedData(uint32_t *buffer, int numToRead, units::second_t timeout)
Read data that has been transferred by the automatic SPI transfer engine.
void StartAutoTrigger(DigitalSource &source, bool rising, bool falling)
Start running the automatic SPI transfer engine when a trigger occurs.
HAL_SPIMode m_mode
Definition SPI.h:361
int GetAutoDroppedCount()
Get the number of bytes dropped by the automatic SPI transfer engine due to the receive buffer being ...
void GetAccumulatorOutput(int64_t &value, int64_t &count) const
Read the accumulated value and the number of accumulated values atomically.
void InitAccumulator(units::second_t period, int cmd, int xferSize, int validMask, int validValue, int dataShift, int dataSize, bool isSigned, bool bigEndian)
Initialize the accumulator.
void SetClockRate(int hz)
Configure the rate of the generated clock signal.
void ConfigureAutoStall(HAL_SPIPort port, int csToSclkTicks, int stallTicks, int pow2BytesPerRead)
Configure the Auto SPI Stall time between reads.
A move-only C++ wrapper around a HAL handle.
Definition Types.h:96
HAL_SPIMode
SPI mode.
Definition SPITypes.h:34
HAL_SPIPort
SPI port.
Definition SPITypes.h:18
@ HAL_SPI_kMode0
Clock idle low, data sampled on rising edge.
Definition SPITypes.h:36
@ HAL_SPI_kMode1
Clock idle low, data sampled on falling edge.
Definition SPITypes.h:38
@ HAL_SPI_kMode2
Clock idle high, data sampled on falling edge.
Definition SPITypes.h:40
@ HAL_SPI_kMode3
Clock idle high, data sampled on rising edge.
Definition SPITypes.h:42