xevi/simulation/src/simwire.cpp
Brian Hrebec 01d193c9b3 Refactored for teensy 4.0, xEvi hardware
- Switched to platformio, ino -> cpp
- MPRLS for pressure sensor
- Added basic ICM support
- Removed widi, battery, other features not supported in xEvi
- Removed legacy options/processing
- Added LED strip support
- Added encoder support
- Reworked menu code to use encoders/be more flexible
2023-08-27 11:52:08 -05:00

94 lines
1.6 KiB
C++

#include <stdio.h>
#include "Wire.h"
/********************************
*
*/
SimWire::SimWire( bool verbose )
: verbose_( verbose )
{
}
void SimWire::setClock(uint32_t)
{
// Ignore.. lol
}
void SimWire::begin()
{
}
void SimWire::beginTransmission(uint8_t address)
{
if( verbose_ )
printf("[SimWire::beginTransmission] $%02x\n", address);
}
void SimWire::beginTransmission(int address)
{
beginTransmission((uint8_t)address);
}
uint8_t SimWire::endTransmission()
{
if( verbose_ )
printf("[SimWire::endTransmission]\n");
return 0;
}
uint8_t SimWire::endTransmission(uint8_t what)
{
if( verbose_ )
printf("[SimWire::endTransmission %d]\n", what);
return 0;
}
uint8_t SimWire::requestFrom(uint8_t address, uint8_t count)
{
if( verbose_ )
printf("[SimWire::requestFrom] $%02x for %d bytes\n", address, count);
// TODO: We must check if there is an actual slave for that address.
return 0;
}
int SimWire::read()
{
// TODO: Verify that bus is in read mode.
// if( current_slave_ != NULL ) {
// return current_slave_->i2cReadData( );
// } else {
printf("No slave selected, returning ones\n");
return 0xffu;
// }
}
int SimWire::available()
{
// TODO: This needs to be implemented!!
return 0;
}
size_t SimWire::write(uint8_t __attribute__((unused)) data)
{
// // TODO: Verify that bus is in write mode.
// if( current_slave_ != NULL ) {
// current_slave_->i2cWriteData( data );
// } else {
printf("No slave selected i2c writes to the void.\n");
// }
return 1;
}