2020-12-26 14:12:05 -08:00
|
|
|
// Copyright (c) FIRST and other WPILib contributors.
|
|
|
|
|
// Open Source Software; you can modify and/or share it under the terms of
|
|
|
|
|
// the WPILib BSD license file in the root directory of this project.
|
2017-10-19 02:01:58 -04:00
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2025-11-07 19:56:21 -05:00
|
|
|
#include "wpi/hal/simulation/I2CData.h"
|
|
|
|
|
#include "wpi/hal/simulation/SimCallbackRegistry.h"
|
|
|
|
|
#include "wpi/hal/simulation/SimDataValue.h"
|
2017-10-19 02:01:58 -04:00
|
|
|
|
2025-11-07 20:00:05 -05:00
|
|
|
namespace wpi::hal {
|
2017-10-19 02:01:58 -04:00
|
|
|
class I2CData {
|
2018-09-03 16:08:07 -07:00
|
|
|
HAL_SIMDATAVALUE_DEFINE_NAME(Initialized)
|
|
|
|
|
HAL_SIMCALLBACKREGISTRY_DEFINE_NAME(Read)
|
|
|
|
|
HAL_SIMCALLBACKREGISTRY_DEFINE_NAME(Write)
|
2017-10-19 02:01:58 -04:00
|
|
|
|
2018-09-03 16:08:07 -07:00
|
|
|
public:
|
2017-11-15 21:41:58 -08:00
|
|
|
void Write(int32_t deviceAddress, const uint8_t* dataToSend,
|
|
|
|
|
int32_t sendSize);
|
2017-10-19 02:01:58 -04:00
|
|
|
void Read(int32_t deviceAddress, uint8_t* buffer, int32_t count);
|
|
|
|
|
|
2019-09-23 23:28:49 -07:00
|
|
|
SimDataValue<HAL_Bool, HAL_MakeBoolean, GetInitializedName> initialized{
|
|
|
|
|
false};
|
2018-09-03 16:08:07 -07:00
|
|
|
SimCallbackRegistry<HAL_BufferCallback, GetReadName> read;
|
|
|
|
|
SimCallbackRegistry<HAL_ConstBufferCallback, GetWriteName> write;
|
2017-10-19 02:01:58 -04:00
|
|
|
|
2018-09-03 16:08:07 -07:00
|
|
|
void ResetData();
|
2017-10-19 02:01:58 -04:00
|
|
|
};
|
2017-12-10 19:38:53 -08:00
|
|
|
extern I2CData* SimI2CData;
|
2025-11-07 20:00:05 -05:00
|
|
|
} // namespace wpi::hal
|