Loading CMakeLists.txt +1 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,7 @@ if (UNIX) include_directories(${I2C_INCLUDE_DIR}) elseif(WIN32) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/MCP2221_DLL/unmanaged/dll) set(MCP_DLL "${CMAKE_CURRENT_SOURCE_DIR}/MCP2221_DLL/unmanaged/dll/mcp2221_dll_um_x64.dll" CACHE INTERNAL "Path to MCP2221 DLL") endif() include_directories(lib) Loading lib/mcp2221a_i2c_win.cpp +10 −1 Original line number Diff line number Diff line Loading @@ -123,8 +123,17 @@ namespace MCP2221A { void I2CMaster::read_register(uint8_t slave_addr, uint8_t reg_addr, uint8_t *data, size_t length) { // Windows implementation to read register try { send(slave_addr, ®_addr, 1); } catch (const I2CMasterException &e) { throw I2CMasterException("Failed to write register address before reading: " + std::string(e.what())); } try { receive(slave_addr, data, length); } catch (const I2CMasterException &e) { throw I2CMasterException("Failed to read register data: " + std::string(e.what())); } } std::vector<int> I2CMaster::get_slaves_addresses(bool force_scan) Loading Loading
CMakeLists.txt +1 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,7 @@ if (UNIX) include_directories(${I2C_INCLUDE_DIR}) elseif(WIN32) include_directories(${CMAKE_CURRENT_SOURCE_DIR}/MCP2221_DLL/unmanaged/dll) set(MCP_DLL "${CMAKE_CURRENT_SOURCE_DIR}/MCP2221_DLL/unmanaged/dll/mcp2221_dll_um_x64.dll" CACHE INTERNAL "Path to MCP2221 DLL") endif() include_directories(lib) Loading
lib/mcp2221a_i2c_win.cpp +10 −1 Original line number Diff line number Diff line Loading @@ -123,8 +123,17 @@ namespace MCP2221A { void I2CMaster::read_register(uint8_t slave_addr, uint8_t reg_addr, uint8_t *data, size_t length) { // Windows implementation to read register try { send(slave_addr, ®_addr, 1); } catch (const I2CMasterException &e) { throw I2CMasterException("Failed to write register address before reading: " + std::string(e.what())); } try { receive(slave_addr, data, length); } catch (const I2CMasterException &e) { throw I2CMasterException("Failed to read register data: " + std::string(e.what())); } } std::vector<int> I2CMaster::get_slaves_addresses(bool force_scan) Loading