File tree 1 file changed +19
-1
lines changed 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -53,6 +53,18 @@ TwoWire::TwoWire()
53
53
54
54
void TwoWire::begin (void )
55
55
{
56
+ /* make sure all slaves can finish their messages started before a reset*/
57
+ pinMode (SCL, OUTPUT);
58
+ for (int i = 0 ; i < 8 ; i++)
59
+ {
60
+ digitalWrite (SCL, HIGH);
61
+ delayMicroseconds (3 );
62
+ digitalWrite (SCL, LOW);
63
+ delayMicroseconds (3 );
64
+ }
65
+ pinMode (SCL, INPUT);
66
+ /* End of: make sure all slaves can finish their messages started before a reset*/
67
+
56
68
rxBufferIndex = 0 ;
57
69
rxBufferLength = 0 ;
58
70
@@ -67,7 +79,13 @@ void TwoWire::begin(uint8_t address)
67
79
twi_setAddress (address);
68
80
twi_attachSlaveTxEvent (onRequestService);
69
81
twi_attachSlaveRxEvent (onReceiveService);
70
- begin ();
82
+ rxBufferIndex = 0 ;
83
+ rxBufferLength = 0 ;
84
+
85
+ txBufferIndex = 0 ;
86
+ txBufferLength = 0 ;
87
+
88
+ twi_init ();
71
89
}
72
90
73
91
void TwoWire::begin (int address)
You can’t perform that action at this time.
0 commit comments