@@ -65,9 +65,6 @@ typedef enum TWI_MODE_enum {
6565 TWI_MODE_SLAVE_RECEIVE = 6
6666} TWI_MODE_t ;
6767
68- /*! Buffer size define */
69- #define TWI_BUFFER_SIZE 128
70-
7168/*! For adding R/_W bit to address */
7269#define ADD_READ_BIT (address ) (address | 0x01)
7370#define ADD_WRITE_BIT (address ) (address & ~0x01)
@@ -86,11 +83,12 @@ register8_t master_result; /*!< Result of transactio
8683
8784/* Slave variables */
8885static void (* TWI_onSlaveTransmit )(void ) __attribute__((unused ));
89- static void (* TWI_onSlaveReceive )(volatile uint8_t * , int ) __attribute__((unused ));
86+ static void (* TWI_onSlaveReceive )(int ) __attribute__((unused ));
9087register8_t * slave_writeData ;
91- register8_t slave_readData [ TWI_BUFFER_SIZE ] ;
88+ register8_t * slave_readData ;
9289register8_t slave_bytesToWrite ;
9390register8_t slave_bytesWritten ;
91+ register8_t slave_bytesToRead ;
9492register8_t slave_bytesRead ;
9593register8_t slave_trans_status ;
9694register8_t slave_result ;
@@ -136,7 +134,7 @@ void TWI_SlaveStopHandler(void);
136134void TWI_SlaveDataHandler (void );
137135void TWI_SlaveWriteHandler (void );
138136void TWI_SlaveReadHandler (void );
139- void TWI_attachSlaveRxEvent ( void (* function )(volatile uint8_t * , int ) );
137+ void TWI_attachSlaveRxEvent ( void (* function )(int ), uint8_t * read_data , uint8_t bytes_to_read );
140138void TWI_attachSlaveTxEvent ( void (* function )(void ) );
141139void TWI_SlaveTransactionFinished (uint8_t result );
142140/*! TWI master interrupt service routine.
0 commit comments