Skip to content

Commit cb707b8

Browse files
committed
Moved macros from twi.h to twi.cpp.
Placed TWI states in enum TWI_STATE : uint8_t.
1 parent 56ef4a4 commit cb707b8

File tree

2 files changed

+11
-12
lines changed

2 files changed

+11
-12
lines changed

Diff for: libraries/Wire/src/utility/twi.cpp

+11-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,17 @@
4141
#include "pins_arduino.h"
4242
#include "twi.h"
4343

44-
static volatile uint8_t twi_state;
44+
constexpr uint32_t TWI_FREQ = 100000L;
45+
46+
enum TWI_STATE : uint8_t {
47+
TWI_READY = 0,
48+
TWI_MRX = 1,
49+
TWI_MTX = 2,
50+
TWI_SRX = 3,
51+
TWI_STX = 4,
52+
};
53+
54+
static volatile TWI_STATE twi_state;
4555
static volatile uint8_t twi_slarw;
4656
static volatile uint8_t twi_sendStop; // should the transaction end with a stop
4757
static volatile uint8_t twi_inRepStart; // in the middle of a repeated start

Diff for: libraries/Wire/src/utility/twi.h

-11
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,6 @@
2727
#include <inttypes.h>
2828
//#define ATMEGA8
2929

30-
#ifndef TWI_FREQ
31-
#define TWI_FREQ 100000L
32-
#endif
33-
34-
#define TWI_READY 0
35-
#define TWI_MRX 1
36-
#define TWI_MTX 2
37-
#define TWI_SRX 3
38-
#define TWI_STX 4
39-
40-
4130
void twi_init(void);
4231
void twi_disable(void);
4332
void twi_setAddress(uint8_t);

0 commit comments

Comments
 (0)