119 virtual int Write(uint8_t* data,
int size);
136 virtual int Read(
bool initiate, uint8_t* dataReceived,
int size);
145 virtual int Transaction(uint8_t* dataToSend, uint8_t* dataReceived,
int size);
225 units::second_t timeout);
246 int pow2BytesPerRead);
264 int validMask,
int validValue,
int dataShift,
265 int dataSize,
bool isSigned,
bool bigEndian);
366 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 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:111
DigitalSource Interface.
Definition: DigitalSource.h:22
SPI bus interface class.
Definition: SPI.h:26
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.
virtual int Read(bool initiate, uint8_t *dataReceived, int size)
Read a word from the receive FIFO.
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.
double GetAccumulatorAverage() const
Read the average of the accumulated value.
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.
virtual int Transaction(uint8_t *dataToSend, uint8_t *dataReceived, int size)
Perform a simultaneous read/write transaction with the device.
void SetChipSelectActiveHigh()
Configure the chip select line to be active high.
int64_t GetAccumulatorCount() const
Read the number of accumulated values.
int GetAccumulatorLastValue() const
Read the last value read by the accumulator engine.
double GetAccumulatorIntegratedValue() const
Read the integrated value.
hal::SPIPort m_port
Definition: SPI.h:359
SPI & operator=(SPI &&)=default
void SetAccumulatorCenter(int center)
Set the center value of the accumulator.
virtual int Write(uint8_t *data, int size)
Write data to the peripheral device.
Port
SPI port.
Definition: SPI.h:31
@ kOnboardCS2
Onboard SPI bus port CS2.
Definition: SPI.h:37
@ kOnboardCS1
Onboard SPI bus port CS1.
Definition: SPI.h:35
@ kOnboardCS0
Onboard SPI bus port CS0.
Definition: SPI.h:33
@ kOnboardCS3
Onboard SPI bus port CS3.
Definition: SPI.h:39
@ kMXP
MXP (roboRIO MXP) SPI bus port.
Definition: SPI.h:41
int64_t GetAccumulatorValue() const
Read the accumulated value.
Mode
SPI mode.
Definition: SPI.h:47
@ kMode2
Clock idle high, data sampled on falling edge.
Definition: SPI.h:53
@ kMode1
Clock idle low, data sampled on falling edge.
Definition: SPI.h:51
@ kMode3
Clock idle high, data sampled on rising edge.
Definition: SPI.h:55
@ kMode0
Clock idle low, data sampled on rising edge.
Definition: SPI.h:49
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:360
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
Definition: SPITypes.h:26
HAL_SPIPort
Definition: SPITypes.h:17
@ HAL_SPI_kMode0
Definition: SPITypes.h:27
@ HAL_SPI_kMode1
Definition: SPITypes.h:28
@ HAL_SPI_kMode2
Definition: SPITypes.h:29
@ HAL_SPI_kMode3
Definition: SPITypes.h:30
constexpr auto count() -> size_t
Definition: core.h:1203
Definition: AprilTagPoseEstimator.h:15