Skip to content

Commit

Permalink
Added missing Wire function requestFrom with 3 args, to F1 Wire library
Browse files Browse the repository at this point in the history
  • Loading branch information
rogerclarkmelbourne committed Jun 29, 2019
1 parent 2e1d0f6 commit 400f5fd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
8 changes: 4 additions & 4 deletions STM32F1/libraries/Wire/utility/WireBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,22 +77,22 @@ uint8 WireBase::endTransmission(){
//TODO: Add the ability to queue messages (adding a boolean to end of function
// call, allows for the Arduino style to stay while also giving the flexibility
// to bulk send
uint8 WireBase::requestFrom(uint8 address, int num_bytes) {
uint8 WireBase::requestFrom(uint8 address, int num_bytes,bool stop) {
if (num_bytes > BUFFER_LENGTH) {
num_bytes = BUFFER_LENGTH;
}
itc_msg.addr = address;
itc_msg.flags = I2C_MSG_READ;
itc_msg.length = num_bytes;
itc_msg.data = &rx_buf[rx_buf_idx];
process();
process(stop);
rx_buf_len += itc_msg.xferred;
itc_msg.flags = 0;
return rx_buf_len;
}

uint8 WireBase::requestFrom(int address, int numBytes) {
return WireBase::requestFrom((uint8)address, numBytes);
uint8 WireBase::requestFrom(int address, int numBytes, bool stop) {
return WireBase::requestFrom((uint8)address, numBytes,stop);
}

size_t WireBase::write(uint8 value) {
Expand Down
5 changes: 3 additions & 2 deletions STM32F1/libraries/Wire/utility/WireBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,13 @@ class WireBase { // Abstraction is awesome!
* Request bytes from a slave device and process the request,
* storing into the receiving buffer.
*/
uint8 requestFrom(uint8, int);
uint8 requestFrom(uint8, int,bool stop=false);

/*
* Allow only 8 bit addresses to be used when requesting bytes
*/
uint8 requestFrom(int, int);
uint8 requestFrom(int address, int numBytes, bool stop=true);


/*
* Stack up bytes to be sent when transmitting
Expand Down

0 comments on commit 400f5fd

Please sign in to comment.