static void twi_init(void) { unsigned int bus_clock = MASTER_CLOCK / 2; #if defined(CONFIG_TWI0) at91_twi0_base = AT91C_BASE_TWI0; at91_twi0_hw_init(); twi_configure_master_mode(0, bus_clock, TWI_CLOCK); #endif #if defined(CONFIG_TWI3) at91_twi3_base = AT91C_BASE_TWI3; at91_twi3_hw_init(); twi_configure_master_mode(3, bus_clock, TWI_CLOCK); #endif #if !defined(CONFIG_TWI0) && !defined(CONFIG_TWI3) #error "No proper TWI bus defined" #endif }
static void twi_init(void) { unsigned int bus_clock = MASTER_CLOCK; #if defined(CONFIG_TWI1) at91_twi1_base = AT91C_BASE_TWI1; at91_twi1_hw_init(); twi_configure_master_mode(1, bus_clock, TWI_CLOCK); #else #error "No proper TWI bus defined" #endif }