Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
et:software:homelab:library:twi [2015/02/25 16:33] – tekitatud raivo.sellet:software:homelab:library:twi [2020/07/20 12:00] (current) – external edit 127.0.0.1
Line 1: Line 1:
 ====== Kahejuhtmeliides TWI ====== ====== Kahejuhtmeliides TWI ======
 +<code c>
  
 +/*! \brief Initialize the TWI module.
 + *
 +  TWI module initialization function.
 +  Enables master read and write interrupts.
 +  Remember to enable interrupts globally from the main application.
 + *
 +  \param twi                      The TWI_Master_t struct instance.
 +  \param module                   The TWI module to use.
 +  \param intLevel                 Master interrupt level.
 +  \param baudRateRegisterSetting  The baud rate register value.
 + */
 +void TWI_MasterInit(TWI_Master_t *twi,TWI_t *module,TWI_MASTER_INTLVL_t intLevel, uint8_t baudRateRegisterSetting);
 +/*! \brief TWI write transaction.
 + *
 +  This function is TWI Master wrapper for a write-only transaction.
 + *
 +  \param twi          The TWI_Master_t struct instance.
 +  \param address      Slave address.
 +  \param writeData    Pointer to data to write.
 +  \param bytesToWrite Number of data bytes to write.
 + *
 +  \retval true  If transaction could be started.
 +  \retval false If transaction could not be started.
 + */
 +bool TWI_MasterWrite(TWI_Master_t *twi,uint8_t address,uint8_t * writeData, uint8_t bytesToWrite);
 +/*! \brief TWI read transaction.
 + *
 +  This function is a TWI Maste wrapper for read-only transaction.
 + *
 +  \param twi            The TWI_Master_t struct instance.
 +  \param address        The slave address.
 +  \param bytesToRead    The number of bytes to read.
 + *
 +  \retval true  If transaction could be started.
 +  \retval false If transaction could not be started.
 + */
 +bool TWI_MasterRead(TWI_Master_t *twi,uint8_t address,uint8_t bytesToRead);
 +/*! \brief TWI write and/or read transaction.
 + *
 +  This function is a TWI Master write and/or read transaction. The function
 +  can be used to both write and/or read bytes to/from the TWI Slave in one
 +  transaction.
 + *
 +  \param twi            The TWI_Master_t struct instance.
 +  \param address        The slave address.
 +  \param writeData      Pointer to data to write.
 +  \param bytesToWrite   Number of bytes to write.
 +  \param bytesToRead    Number of bytes to read.
 + *
 +  \retval true  If transaction could be started.
 +  \retval false If transaction could not be started.
 + */
 +bool TWI_MasterWriteRead(TWI_Master_t *twi,uint8_t address,uint8_t *writeData,uint8_t bytesToWrite,uint8_t bytesToRead);
 +/*! \brief Common TWI master interrupt service routine.
 + *
 +  Check current status and calls the appropriate handler.
 + *
 +  \param twi  The TWI_Master_t struct instance.
 + */
 +void TWI_MasterInterruptHandler(TWI_Master_t *twi);
 +
 +</code>
et/software/homelab/library/twi.1424874836.txt.gz · Last modified: (external edit)
CC Attribution-Share Alike 4.0 International
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0