@@ -150,8 +150,9 @@ void TWI_MasterSetBaud(uint32_t frequency){
150150
151151// Formula is: BAUD = ((F_CLKPER/frequency) - F_CLKPER*T_RISE - 10)/2;
152152// Where T_RISE varies depending on operating frequency...
153- // From 1617 DS: 1000ns @ 100kHz / 300ns @ 400kHz / 120ns @ 1MHz
154- uint8_t t_rise ;
153+ // From 1617 DS: 1000ns @ 100kHz / 300ns @ 400kHz / 120ns @ 1MHz
154+
155+ uint16_t t_rise ;
155156
156157 if (frequency < 200000 ){
157158 frequency = 100000 ;
@@ -172,7 +173,7 @@ void TWI_MasterSetBaud(uint32_t frequency){
172173
173174 uint32_t baud = ((F_CPU_CORRECTED /frequency ) - (((F_CPU_CORRECTED * t_rise )/1000 )/1000 )/1000 - 10 )/2 ;
174175 TWI0 .MBAUD = (uint8_t )baud ;
175-
176+
176177}
177178
178179/*! \brief TWI write transaction.
@@ -694,24 +695,24 @@ void TWI_SlaveReadHandler(){
694695 }
695696}
696697
697- /*
698- * Function twi_attachSlaveRxEvent
699- * Desc sets function called before a slave read operation
700- * Input function: callback function to use
701- * Output none
702- */
703- void TWI_attachSlaveRxEvent ( void (* function )(uint8_t * , int ) ){
704- TWI_onSlaveReceive = function ;
705- }
706-
707- /*
708- * Function twi_attachSlaveTxEvent
709- * Desc sets function called before a slave write operation
710- * Input function: callback function to use
711- * Output none
712- */
713- void TWI_attachSlaveTxEvent ( void (* function )(void ) ){
714- TWI_onSlaveTransmit = function ;
698+ /*
699+ * Function twi_attachSlaveRxEvent
700+ * Desc sets function called before a slave read operation
701+ * Input function: callback function to use
702+ * Output none
703+ */
704+ void TWI_attachSlaveRxEvent ( void (* function )(volatile uint8_t * , int ) ){
705+ TWI_onSlaveReceive = function ;
706+ }
707+
708+ /*
709+ * Function twi_attachSlaveTxEvent
710+ * Desc sets function called before a slave write operation
711+ * Input function: callback function to use
712+ * Output none
713+ */
714+ void TWI_attachSlaveTxEvent ( void (* function )(void ) ){
715+ TWI_onSlaveTransmit = function ;
715716}
716717
717718
0 commit comments