-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(flex-stacker): Bring up the internal/external status led bars an…
…d add gcode to control them. (#495)
- Loading branch information
Showing
24 changed files
with
874 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#include "firmware/i2c_comms.hpp" | ||
|
||
#include <cstdint> | ||
|
||
#include "firmware/i2c_hardware.h" | ||
#include "systemwide.h" | ||
|
||
using namespace i2c::hardware; | ||
|
||
auto I2C::set_handle(HAL_I2C_HANDLE i2c_handle, I2C_BUS i2c_bus) -> void { | ||
this->bus = i2c_bus; | ||
i2c_register_handle(i2c_handle, i2c_bus); | ||
} | ||
|
||
auto I2C::i2c_write(uint16_t dev_addr, uint16_t reg, uint8_t* data, | ||
uint16_t size) -> RxTxReturn { | ||
MessageT resp{0}; | ||
auto ret = hal_i2c_write(bus, dev_addr, reg, data, size); | ||
return RxTxReturn(ret, resp); | ||
} | ||
|
||
auto I2C::i2c_read(uint16_t dev_addr, uint16_t reg, uint16_t size) | ||
-> RxTxReturn { | ||
MessageT resp{0}; | ||
auto ret = hal_i2c_read(bus, dev_addr, reg, resp.data(), size); | ||
return RxTxReturn(ret, resp); | ||
} |
Oops, something went wrong.