Kaleidoscope
Macros | Functions
twi.c File Reference
#include <math.h>
#include <stdlib.h>
#include <inttypes.h>
#include <avr/io.h>
#include <avr/interrupt.h>
#include <compat/twi.h>
#include "pins_arduino.h"
#include "twi.h"
Include dependency graph for twi.c:

Macros

#define ENABLE_TWI_SLAVE_MODE   0
 
#define true   1
 
#define false   0
 
#define cbi(sfr, bit)   (_SFR_BYTE(sfr) &= ~_BV(bit))
 
#define sbi(sfr, bit)   (_SFR_BYTE(sfr) |= _BV(bit))
 

Functions

void twi_init (void)
 
void twi_disable (void)
 
void twi_setAddress (uint8_t address)
 
void twi_setFrequency (uint32_t frequency)
 
uint8_t twi_readFrom (uint8_t address, uint8_t *data, uint8_t length, uint8_t sendStop)
 
uint8_t twi_writeTo (uint8_t address, uint8_t *data, uint8_t length, uint8_t wait, uint8_t sendStop)
 
uint8_t twi_transmit (const uint8_t *data, uint8_t length)
 
void twi_attachSlaveRxEvent (void(*function)(uint8_t *, int))
 
void twi_attachSlaveTxEvent (void(*function)(void))
 
void twi_reply (uint8_t ack)
 
void twi_stop (void)
 
void twi_releaseBus (void)
 
 ISR (TWI_vect)
 

Macro Definition Documentation

◆ cbi

#define cbi (   sfr,
  bit 
)    (_SFR_BYTE(sfr) &= ~_BV(bit))

◆ ENABLE_TWI_SLAVE_MODE

#define ENABLE_TWI_SLAVE_MODE   0

◆ false

#define false   0

◆ sbi

#define sbi (   sfr,
  bit 
)    (_SFR_BYTE(sfr) |= _BV(bit))

◆ true

#define true   1

Function Documentation

◆ ISR()

ISR ( TWI_vect  )

◆ twi_attachSlaveRxEvent()

void twi_attachSlaveRxEvent ( void(*)(uint8_t *, int)  function)

◆ twi_attachSlaveTxEvent()

void twi_attachSlaveTxEvent ( void(*)(void)  function)

◆ twi_disable()

void twi_disable ( void  )

◆ twi_init()

void twi_init ( void  )

◆ twi_readFrom()

uint8_t twi_readFrom ( uint8_t  address,
uint8_t *  data,
uint8_t  length,
uint8_t  sendStop 
)

◆ twi_releaseBus()

void twi_releaseBus ( void  )

◆ twi_reply()

void twi_reply ( uint8_t  ack)

◆ twi_setAddress()

void twi_setAddress ( uint8_t  address)

◆ twi_setFrequency()

void twi_setFrequency ( uint32_t  frequency)

◆ twi_stop()

void twi_stop ( void  )

◆ twi_transmit()

uint8_t twi_transmit ( const uint8_t *  data,
uint8_t  length 
)

◆ twi_writeTo()

uint8_t twi_writeTo ( uint8_t  address,
uint8_t *  data,
uint8_t  length,
uint8_t  wait,
uint8_t  sendStop 
)