Added a timeout value to the TWI_StartTransmission() function, within which the addressed device must respond.
Fixed TWI_StartTransmission() corrupting the contents of the GPIOR0 register.
This commit is contained in:
		
							parent
							
								
									14a5a94084
								
							
						
					
					
						commit
						c0c982df7a
					
				
					 6 changed files with 56 additions and 30 deletions
				
			
		| 
						 | 
				
			
			@ -56,6 +56,7 @@
 | 
			
		|||
		#include <avr/io.h>
 | 
			
		||||
		#include <stdbool.h>
 | 
			
		||||
		#include <util/twi.h>
 | 
			
		||||
		#include <util/delay.h>
 | 
			
		||||
		
 | 
			
		||||
	/* Enable C linkage for C++ Compilers: */
 | 
			
		||||
		#if defined(__cplusplus)
 | 
			
		||||
| 
						 | 
				
			
			@ -131,10 +132,11 @@
 | 
			
		|||
			/** Begins a master mode TWI bus communication with the given slave device address.
 | 
			
		||||
			 *
 | 
			
		||||
			 *  \param[in] SlaveAddress  Address of the slave TWI device to communicate with
 | 
			
		||||
			 *  \param[in] TimeoutMS     Timeout period within which the slave must respond, in milliseconds
 | 
			
		||||
			 *
 | 
			
		||||
			 *  \return Boolean true if the device is ready for data, false otherwise
 | 
			
		||||
			 */
 | 
			
		||||
			bool TWI_StartTransmission(uint8_t SlaveAddress);
 | 
			
		||||
			bool TWI_StartTransmission(uint8_t SlaveAddress, uint8_t TimeoutMS);
 | 
			
		||||
 | 
			
		||||
	/* Disable C linkage for C++ Compilers: */
 | 
			
		||||
		#if defined(__cplusplus)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue