WPILibC++  unspecified
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Pages
SPI.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) FIRST 2016-2017. All Rights Reserved. */
3 /* Open Source Software - may be modified and shared by FRC teams. The code */
4 /* must be accompanied by the FIRST BSD license file in the root directory of */
5 /* the project. */
6 /*----------------------------------------------------------------------------*/
7 
8 #pragma once
9 
10 #include <stdint.h>
11 
12 #include "HAL/Types.h"
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
18 void HAL_InitializeSPI(int32_t port, int32_t* status);
19 int32_t HAL_TransactionSPI(int32_t port, uint8_t* dataToSend,
20  uint8_t* dataReceived, int32_t size);
21 int32_t HAL_WriteSPI(int32_t port, uint8_t* dataToSend, int32_t sendSize);
22 int32_t HAL_ReadSPI(int32_t port, uint8_t* buffer, int32_t count);
23 void HAL_CloseSPI(int32_t port);
24 void HAL_SetSPISpeed(int32_t port, int32_t speed);
25 void HAL_SetSPIOpts(int32_t port, HAL_Bool msbFirst, HAL_Bool sampleOnTrailing,
26  HAL_Bool clkIdleHigh);
27 void HAL_SetSPIChipSelectActiveHigh(int32_t port, int32_t* status);
28 void HAL_SetSPIChipSelectActiveLow(int32_t port, int32_t* status);
29 int32_t HAL_GetSPIHandle(int32_t port);
30 void HAL_SetSPIHandle(int32_t port, int32_t handle);
31 
32 void HAL_InitSPIAccumulator(int32_t port, int32_t period, int32_t cmd,
33  int32_t xferSize, int32_t validMask,
34  int32_t validValue, int32_t dataShift,
35  int32_t dataSize, HAL_Bool isSigned,
36  HAL_Bool bigEndian, int32_t* status);
37 void HAL_FreeSPIAccumulator(int32_t port, int32_t* status);
38 void HAL_ResetSPIAccumulator(int32_t port, int32_t* status);
39 void HAL_SetSPIAccumulatorCenter(int32_t port, int32_t center, int32_t* status);
40 void HAL_SetSPIAccumulatorDeadband(int32_t port, int32_t deadband,
41  int32_t* status);
42 int32_t HAL_GetSPIAccumulatorLastValue(int32_t port, int32_t* status);
43 int64_t HAL_GetSPIAccumulatorValue(int32_t port, int32_t* status);
44 int64_t HAL_GetSPIAccumulatorCount(int32_t port, int32_t* status);
45 double HAL_GetSPIAccumulatorAverage(int32_t port, int32_t* status);
46 void HAL_GetSPIAccumulatorOutput(int32_t port, int64_t* value, int64_t* count,
47  int32_t* status);
48 #ifdef __cplusplus
49 }
50 #endif