WPILibC++  unspecified
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Pages
I2C.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 enum HAL_I2CPort : int32_t { HAL_I2C_kOnboard = 0, HAL_I2C_kMXP };
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
18 void HAL_InitializeI2C(HAL_I2CPort port, int32_t* status);
19 int32_t HAL_TransactionI2C(HAL_I2CPort port, int32_t deviceAddress,
20  uint8_t* dataToSend, int32_t sendSize,
21  uint8_t* dataReceived, int32_t receiveSize);
22 int32_t HAL_WriteI2C(HAL_I2CPort port, int32_t deviceAddress,
23  uint8_t* dataToSend, int32_t sendSize);
24 int32_t HAL_ReadI2C(HAL_I2CPort port, int32_t deviceAddress, uint8_t* buffer,
25  int32_t count);
26 void HAL_CloseI2C(HAL_I2CPort port);
27 #ifdef __cplusplus
28 }
29 #endif