2017-10-19 02:01:58 -04:00
|
|
|
/*----------------------------------------------------------------------------*/
|
2020-06-27 22:11:24 -07:00
|
|
|
/* Copyright (c) 2017-2020 FIRST. All Rights Reserved. */
|
2017-10-19 02:01:58 -04:00
|
|
|
/* 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
|
|
|
|
|
|
2020-06-27 22:11:24 -07:00
|
|
|
#include "hal/simulation/I2CData.h"
|
|
|
|
|
#include "hal/simulation/SimCallbackRegistry.h"
|
|
|
|
|
#include "hal/simulation/SimDataValue.h"
|
2017-10-19 02:01:58 -04:00
|
|
|
|
|
|
|
|
namespace hal {
|
|
|
|
|
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;
|
2017-10-19 02:01:58 -04:00
|
|
|
} // namespace hal
|