Skip to content

Allow customization of transmit and receive buffer sizes for I2C 'Wire' object. #589

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Moved macros from twi.h to twi.cpp.
Placed TWI states in enum TWI_STATE : uint8_t.
  • Loading branch information
dac1e committed Jan 3, 2025
commit cb707b8414a31c89744fae497d99850c004522ab
12 changes: 11 additions & 1 deletion libraries/Wire/src/utility/twi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,17 @@
#include "pins_arduino.h"
#include "twi.h"

static volatile uint8_t twi_state;
constexpr uint32_t TWI_FREQ = 100000L;

enum TWI_STATE : uint8_t {
TWI_READY = 0,
TWI_MRX = 1,
TWI_MTX = 2,
TWI_SRX = 3,
TWI_STX = 4,
};

static volatile TWI_STATE twi_state;
static volatile uint8_t twi_slarw;
static volatile uint8_t twi_sendStop; // should the transaction end with a stop
static volatile uint8_t twi_inRepStart; // in the middle of a repeated start
Expand Down
11 changes: 0 additions & 11 deletions libraries/Wire/src/utility/twi.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,6 @@
#include <inttypes.h>
//#define ATMEGA8

#ifndef TWI_FREQ
#define TWI_FREQ 100000L
#endif

#define TWI_READY 0
#define TWI_MRX 1
#define TWI_MTX 2
#define TWI_SRX 3
#define TWI_STX 4


void twi_init(void);
void twi_disable(void);
void twi_setAddress(uint8_t);
Expand Down