Ejemplo n.º 1
0
/**
 * @brief   Low level I2C driver initialization.
 *
 * @notapi
 */
void i2c_lld_init(void) {

#if STM32_I2C_USE_I2C1
  i2cObjectInit(&I2CD1);
  I2CD1.thread = NULL;
  I2CD1.i2c    = I2C1;
  I2CD1.dmarx  = STM32_DMA_STREAM(STM32_I2C_I2C1_RX_DMA_STREAM);
  I2CD1.dmatx  = STM32_DMA_STREAM(STM32_I2C_I2C1_TX_DMA_STREAM);
#endif /* STM32_I2C_USE_I2C1 */

#if STM32_I2C_USE_I2C2
  i2cObjectInit(&I2CD2);
  I2CD2.thread = NULL;
  I2CD2.i2c    = I2C2;
  I2CD2.dmarx  = STM32_DMA_STREAM(STM32_I2C_I2C2_RX_DMA_STREAM);
  I2CD2.dmatx  = STM32_DMA_STREAM(STM32_I2C_I2C2_TX_DMA_STREAM);
#endif /* STM32_I2C_USE_I2C2 */

#if STM32_I2C_USE_I2C3
  i2cObjectInit(&I2CD3);
  I2CD3.thread = NULL;
  I2CD3.i2c    = I2C3;
  I2CD3.dmarx  = STM32_DMA_STREAM(STM32_I2C_I2C3_RX_DMA_STREAM);
  I2CD3.dmatx  = STM32_DMA_STREAM(STM32_I2C_I2C3_TX_DMA_STREAM);
#endif /* STM32_I2C_USE_I2C3 */
}
Ejemplo n.º 2
0
/**
 * @brief   Low level I2C driver initialization.
 *
 * @notapi
 */
void i2c_lld_init(void) {

#if KINETIS_I2C_USE_I2C0
  i2cObjectInit(&I2CD1);
  I2CD1.thread = NULL;
  I2CD1.i2c = I2C0;
#endif

#if KINETIS_I2C_USE_I2C1
  i2cObjectInit(&I2CD2);
  I2CD2.thread = NULL;
  I2CD2.i2c = I2C1;
#endif

}
Ejemplo n.º 3
0
/**
 * @brief   Low level I2C driver initialization.
 *
 * @notapi
 */
void i2c_lld_init(void) {

#if NRF5_I2C_USE_I2C0
  i2cObjectInit(&I2CD1);
  I2CD1.thread = NULL;
  I2CD1.i2c = NRF_TWIM0;
#endif

#if NRF5_I2C_USE_I2C1
  i2cObjectInit(&I2CD2);
  I2CD2.thread = NULL;
  I2CD2.i2c = NRF_TWIM1;
#endif

}
Ejemplo n.º 4
0
/**
 * @brief   Low level I2C driver initialization.
 *
 * @notapi
 */
void i2c_lld_init(void) {

#if SAM3X_I2C_USE_I2C1
    i2cObjectInit(&I2CD1);
    pmc_enable_periph_clk(ID_TWI0);
    I2CD1.i2c = TWI0;
    nvicEnableVector(TWI0_IRQn, CORTEX_PRIORITY_MASK(SAM3X_I2C_IRQ_PRIORITY));
#endif

#if SAM3X_I2C_USE_I2C2
    i2cObjectInit(&I2CD2);
    pmc_enable_periph_clk(ID_TWI1);
    I2CD2.i2c = TWI1;
    nvicEnableVector(TWI1_IRQn, CORTEX_PRIORITY_MASK(SAM3X_I2C_IRQ_PRIORITY));
#endif

}
Ejemplo n.º 5
0
/**
 * @brief   Low level I2C driver initialization.
 *
 * @notapi
 */
void i2c_lld_init(void) {

  i2cObjectInit(&I2CD1);
  I2CD1.thread = NULL;
  I2CD1.i2c    = LPC_I2C;

  LPC_IOCON->PIO0_4 = 0x01;  /* Set I2C SCL pin function */
  LPC_IOCON->PIO0_5 = 0x01;  /* Set I2C SDA pin function */
}
Ejemplo n.º 6
0
void initialiseSensorHw(void)
{
    /* I2C for sensors */
    palSetPadMode(I2C_PORT, I2C_SDA, PAL_MODE_ALTERNATE(4) | 
                                     PAL_STM32_OTYPE_OPENDRAIN |
                                     PAL_STM32_OSPEED_LOWEST);
    palSetPadMode(I2C_PORT, I2C_SCL, PAL_MODE_ALTERNATE(4) | 
                                     PAL_STM32_OTYPE_OPENDRAIN |
                                     PAL_STM32_OSPEED_LOWEST);

    i2cObjectInit(&I2C_DRIVER);

    i2cConfig.op_mode = OPMODE_I2C;
    i2cConfig.duty_cycle = STD_DUTY_CYCLE;
    i2cConfig.clock_speed = 100000;
}
Ejemplo n.º 7
0
/**
 * @brief   Low level I2C driver initialization.
 *
 * @notapi
 */
void i2c_lld_init(void) {

#if SAM7_I2C_USE_I2C1
  i2cObjectInit(&I2CD1);
  I2CD1.thread  = NULL;
  I2CD1.txbuf   = NULL;
  I2CD1.rxbuf   = NULL;
  I2CD1.txbytes = 0;
  I2CD1.rxbytes = 0;

  AT91C_BASE_PIOA->PIO_PDR   = AT91C_PA0_TWD | AT91C_PA1_TWCK;
  AT91C_BASE_PIOA->PIO_ASR   = AT91C_PA0_TWD | AT91C_PA1_TWCK;
  AT91C_BASE_PIOA->PIO_MDER  = AT91C_PA0_TWD | AT91C_PA1_TWCK;
  AT91C_BASE_PIOA->PIO_PPUDR = AT91C_PA0_TWD | AT91C_PA1_TWCK;

  AIC_ConfigureIT(AT91C_ID_TWI,
                  AT91C_AIC_SRCTYPE_INT_HIGH_LEVEL, TWI_IRQHandler);
#endif /* STM32_I2C_USE_I2C1 */
}
Ejemplo n.º 8
0
void I2C::init(){
	if(!(refcnt++)){
		i2cObjectInit(&driver);
		i2cStart(&driver, &config);
	}
}
Ejemplo n.º 9
0
/**
 * @brief   Low level I2C driver initialization.
 *
 * @notapi
 */
void i2c_lld_init(void) {

  i2cObjectInit(&I2CD1);
  I2CD1.thread = NULL;
}
Ejemplo n.º 10
0
/**
 * @brief   Low level I2C driver initialization.
 *
 * @notapi
 */
void i2c_lld_init(void) {

#if PLATFORM_I2C_USE_I2C1
  i2cObjectInit(&I2CD1);
#endif /* PLATFORM_I2C_USE_I2C1 */
}
Ejemplo n.º 11
0
/**
 * @brief   Low level I2C driver initialization.
 *
 * @notapi
 */
void i2c_lld_init(void) {

#if TIVA_I2C_USE_I2C0
  i2cObjectInit(&I2CD1);
  I2CD1.thread = NULL;
  I2CD1.i2c    = I2C0;
#endif /* TIVA_I2C_USE_I2C0 */

#if TIVA_I2C_USE_I2C1
  i2cObjectInit(&I2CD2);
  I2CD2.thread = NULL;
  I2CD2.i2c    = I2C1;
#endif /* TIVA_I2C_USE_I2C1 */

#if TIVA_I2C_USE_I2C2
  i2cObjectInit(&I2CD3);
  I2CD3.thread = NULL;
  I2CD3.i2c    = I2C2;
#endif /* TIVA_I2C_USE_I2C2 */

#if TIVA_I2C_USE_I2C3
  i2cObjectInit(&I2CD4);
  I2CD4.thread = NULL;
  I2CD4.i2c    = I2C3;
#endif /* TIVA_I2C_USE_I2C3 */

#if TIVA_I2C_USE_I2C4
  i2cObjectInit(&I2CD5);
  I2CD5.thread = NULL;
  I2CD5.i2c    = I2C4;
#endif /* TIVA_I2C_USE_I2C4 */

#if TIVA_I2C_USE_I2C5
  i2cObjectInit(&I2CD6);
  I2CD6.thread = NULL;
  I2CD6.i2c    = I2C5;
#endif /* TIVA_I2C_USE_I2C5 */

#if TIVA_I2C_USE_I2C6
  i2cObjectInit(&I2CD7);
  I2CD7.thread = NULL;
  I2CD7.i2c    = I2C6;
#endif /* TIVA_I2C_USE_I2C6 */

#if TIVA_I2C_USE_I2C7
  i2cObjectInit(&I2CD8);
  I2CD8.thread = NULL;
  I2CD8.i2c    = I2C7;
#endif /* TIVA_I2C_USE_I2C7 */

#if TIVA_I2C_USE_I2C8
  i2cObjectInit(&I2CD9);
  I2CD9.thread = NULL;
  I2CD9.i2c    = I2C8;
#endif /* TIVA_I2C_USE_I2C8 */

#if TIVA_I2C_USE_I2C9
  i2cObjectInit(&I2CD10);
  I2CD10.thread = NULL;
  I2CD10.i2c    = I2C9;
#endif /* TIVA_I2C_USE_I2C9 */
}
Ejemplo n.º 12
0
/**
 * @brief   Low level I2C driver initialization.
 *
 * @notapi
 */
void i2c_lld_init(void) {
    i2cObjectInit(&I2CD);
}
Ejemplo n.º 13
0
/**
 * @brief   Low level I2C driver initialization.
 *
 * @notapi
 */
void i2c_lld_init(void) {
  I2C0.device = BSC0_ADDR;
  i2cObjectInit(&I2C0);
}