void TwoWire::begin(uint8_t address) { if (onBeginCallback) onBeginCallback(); status = SLAVE_IDLE; if (twi==I2C1) { RCC_I2CCLKConfig(RCC_I2C1CLK_HSI); RCC_APB1PeriphClockCmd(RCC_APB1Periph_I2C1, ENABLE); pinMode(SDA, ALTERNATE); pinMode(SCL, ALTERNATE); } I2C_DeInit(twi); I2C_InitStructure.I2C_Mode = I2C_Mode_I2C; I2C_InitStructure.I2C_AnalogFilter = I2C_AnalogFilter_Enable; I2C_InitStructure.I2C_DigitalFilter = 0x00; I2C_InitStructure.I2C_OwnAddress1 = address; I2C_InitStructure.I2C_Ack = I2C_Ack_Enable; I2C_InitStructure.I2C_AcknowledgedAddress = I2C_AcknowledgedAddress_7bit; I2C_InitStructure.I2C_Timing = 0x00E0D3FF; I2C_Init(twi, &I2C_InitStructure); NVIC_SetPriority(I2C1_IRQn, 0); NVIC_EnableIRQ(I2C1_IRQn); I2C_Cmd(twi, ENABLE); I2C_ITConfig(twi, I2C_IT_ADDRI, ENABLE); }
void TwoWire::begin(uint8_t address) { if (onBeginCallback) onBeginCallback(); vAHI_SiSlaveConfigure(address, false, true, 0xFF, false) ; status = SLAVE_IDLE; }
void TwoWire::begin(void) { // muxSelectI2c(0); if (onBeginCallback) onBeginCallback(); adapter_nr = 255; // if ((adapter_nr = i2c_getadapter(I2C2)) < 0) { // return; // } // if (BOARD == RUN_RASPBERRYPI) // { // adapter_nr = -1; // } // else if (BOARD == RUN_GALILEO) // { // adapter_nr = 0; // } // else // if (BOARD == RUN_EDISON) // { // adapter_nr = 6; // } // else // if (BOARD == RUN_BEAGLEBONE) // { // adapter_nr = 1; // } if ((i2c_fd = i2c_openadapter(adapter_nr)) < 0) { // printf ("i2c initialization problem\n"); return; } }
void TwoWire::begin(void) { if (onBeginCallback) onBeginCallback(); vAHI_SiSetLocation(false); vAHI_SiMasterConfigure(true, false, SI_CLOCK2PRESCALER(twiClock) ); // set to 100KHz status = MASTER_IDLE; }
void WireClass::begin(uint8_t address) { if (onBeginCallback) onBeginCallback(); Board_I2C_Slave_Init(pDeviceHandle, address); status = SLAVE_IDLE; }
void WireClass::begin(void) { if (onBeginCallback) onBeginCallback(); Board_I2C_Master_Init(pDeviceHandle); status = MASTER_IDLE; }
void TwoWire::begin(void) { if (onBeginCallback) onBeginCallback(); // Disable PDC channel twi->TWI_PTCR = UART_PTCR_RXTDIS | UART_PTCR_TXTDIS; TWI_ConfigureMaster(twi, twiClock, VARIANT_MCK); status = MASTER_IDLE; }
void TwoWire::begin(uint8_t address) { if (onBeginCallback) onBeginCallback(); // Disable PDC channel twi->TWI_PTCR = UART_PTCR_RXTDIS | UART_PTCR_TXTDIS; TWI_ConfigureSlave(twi, address); status = SLAVE_IDLE; TWI_EnableIt(twi, TWI_IER_SVACC); //| TWI_IER_RXRDY | TWI_IER_TXRDY | TWI_IER_TXCOMP); }
void TwoWire::begin(uint8_t address) { if (onBeginCallback != nullptr) { onBeginCallback(); } // Disable PDC channel twi->TWI_PTCR = UART_PTCR_RXTDIS | UART_PTCR_TXTDIS; twi_slave_init(twi, address); status = SLAVE_IDLE; twi_enable_interrupt(twi, TWI_IER_SVACC); //| TWI_IER_RXRDY | TWI_IER_TXRDY | TWI_IER_TXCOMP); }
void DFTwoWire::begin(void) { muxSelectI2c(0); if (onBeginCallback) onBeginCallback(); if(adapter_nr < 0){ if ((adapter_nr = i2c_getadapter(I2C2)) < 0) { return; } } if(i2c_fd < 0){ if ((i2c_fd = i2c_openadapter(1)) < 0) { return; } } }
void TwoWire::begin(void) { if (onBeginCallback) onBeginCallback(); if (twi==I2C1) { RCC_I2CCLKConfig(RCC_I2C1CLK_HSI); RCC_APB1PeriphClockCmd(RCC_APB1Periph_I2C1, ENABLE); pinMode(SDA, ALTERNATE); pinMode(SCL, ALTERNATE); } else if (twi == I2C2) { RCC_APB1PeriphClockCmd(RCC_APB1Periph_I2C2, ENABLE); pinMode(SDA1, ALTERNATE); pinMode(SCL1, ALTERNATE); } I2C_DeInit(twi); I2C_InitStructure.I2C_Mode = I2C_Mode_I2C; I2C_InitStructure.I2C_AnalogFilter = I2C_AnalogFilter_Enable; I2C_InitStructure.I2C_DigitalFilter = 0x00; if (status == UNINITIALIZED) { I2C_InitStructure.I2C_OwnAddress1 = 0x00; status = MASTER_IDLE; } I2C_InitStructure.I2C_Ack = I2C_Ack_Enable; I2C_InitStructure.I2C_AcknowledgedAddress = I2C_AcknowledgedAddress_7bit; I2C_InitStructure.I2C_Timing = 0x00E0D3FF; I2C_Init(twi, &I2C_InitStructure); I2C_Cmd(twi, ENABLE); }
void TwoWire::begin(uint8_t address) { if (onBeginCallback) onBeginCallback(); begin (); }