mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-29 02:21:44 +00:00
Update to 2018_v4 image and new build system. (#598)
* Revert "Force OpenCV to 3.1.0 (#602)"
This reverts commit 50ed55e8e2.
* Removes Simulation
* Removes old build system
* Removes old gtest
* Adds new gmock and gtest
* Updates to new ni-libraries
* removes MyRobot (to be replaced)
* moves files to new location
* Adds new sim backend and new test executables
* updates .styleguide and .gitignore
* Changes cpp WPILibVersion to a function
MSVC throws an AV with the old version.
* Disables USBCamera on all systems except for linux
* 2018 NI Libraries
* New build system
This commit is contained in:
committed by
Peter Johnson
parent
50ed55e8e2
commit
e1195e8b9d
78
wpilibc/src/main/native/include/SPI.h
Normal file
78
wpilibc/src/main/native/include/SPI.h
Normal file
@@ -0,0 +1,78 @@
|
||||
/*----------------------------------------------------------------------------*/
|
||||
/* Copyright (c) FIRST 2008-2017. All Rights Reserved. */
|
||||
/* Open Source Software - may be modified and shared by FRC teams. The code */
|
||||
/* must be accompanied by the FIRST BSD license file in the root directory of */
|
||||
/* the project. */
|
||||
/*----------------------------------------------------------------------------*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "SensorBase.h"
|
||||
|
||||
enum HAL_SPIPort : int32_t;
|
||||
|
||||
namespace frc {
|
||||
|
||||
class DigitalOutput;
|
||||
class DigitalInput;
|
||||
|
||||
/**
|
||||
* SPI bus interface class.
|
||||
*
|
||||
* This class is intended to be used by sensor (and other SPI device) drivers.
|
||||
* It probably should not be used directly.
|
||||
*
|
||||
*/
|
||||
class SPI : public SensorBase {
|
||||
public:
|
||||
enum Port { kOnboardCS0 = 0, kOnboardCS1, kOnboardCS2, kOnboardCS3, kMXP };
|
||||
explicit SPI(Port port);
|
||||
virtual ~SPI();
|
||||
|
||||
SPI(const SPI&) = delete;
|
||||
SPI& operator=(const SPI&) = delete;
|
||||
|
||||
void SetClockRate(double hz);
|
||||
|
||||
void SetMSBFirst();
|
||||
void SetLSBFirst();
|
||||
|
||||
void SetSampleDataOnFalling();
|
||||
void SetSampleDataOnRising();
|
||||
|
||||
void SetClockActiveLow();
|
||||
void SetClockActiveHigh();
|
||||
|
||||
void SetChipSelectActiveHigh();
|
||||
void SetChipSelectActiveLow();
|
||||
|
||||
virtual int Write(uint8_t* data, int size);
|
||||
virtual int Read(bool initiate, uint8_t* dataReceived, int size);
|
||||
virtual int Transaction(uint8_t* dataToSend, uint8_t* dataReceived, int size);
|
||||
|
||||
void InitAccumulator(double period, int cmd, int xfer_size, int valid_mask,
|
||||
int valid_value, int data_shift, int data_size,
|
||||
bool is_signed, bool big_endian);
|
||||
void FreeAccumulator();
|
||||
void ResetAccumulator();
|
||||
void SetAccumulatorCenter(int center);
|
||||
void SetAccumulatorDeadband(int deadband);
|
||||
int GetAccumulatorLastValue() const;
|
||||
int64_t GetAccumulatorValue() const;
|
||||
int64_t GetAccumulatorCount() const;
|
||||
double GetAccumulatorAverage() const;
|
||||
void GetAccumulatorOutput(int64_t& value, int64_t& count) const;
|
||||
|
||||
protected:
|
||||
HAL_SPIPort m_port;
|
||||
bool m_msbFirst = false; // default little-endian
|
||||
bool m_sampleOnTrailing = false; // default data updated on falling edge
|
||||
bool m_clk_idle_high = false; // default clock active high
|
||||
|
||||
private:
|
||||
void Init();
|
||||
};
|
||||
|
||||
} // namespace frc
|
||||
Reference in New Issue
Block a user