/** * @brief Initializes the standard part of a @p I2CDriver structure. * * @param[out] i2cp pointer to the @p I2CDriver object * * @init */ void i2cObjectInit(I2CDriver *i2cp) { i2cp->state = I2C_STOP; i2cp->config = NULL; #if I2C_USE_MUTUAL_EXCLUSION == TRUE osalMutexObjectInit(&i2cp->mutex); #endif #if defined(I2C_DRIVER_EXT_INIT_HOOK) I2C_DRIVER_EXT_INIT_HOOK(i2cp); #endif }
/** * @brief Initializes the standard part of a @p SPIDriver structure. * * @param[out] spip pointer to the @p SPIDriver object * * @init */ void spiObjectInit(SPIDriver *spip) { spip->state = SPI_STOP; spip->config = NULL; #if SPI_USE_WAIT == TRUE spip->thread = NULL; #endif #if SPI_USE_MUTUAL_EXCLUSION == TRUE osalMutexObjectInit(&spip->mutex); #endif #if defined(SPI_DRIVER_EXT_INIT_HOOK) SPI_DRIVER_EXT_INIT_HOOK(spip); #endif }
/** * @brief Initializes the standard part of a @p QSPIDriver structure. * * @param[out] qspip pointer to the @p QSPIDriver object * * @init */ void qspiObjectInit(QSPIDriver *qspip) { qspip->state = QSPI_STOP; qspip->config = NULL; #if QSPI_USE_WAIT == TRUE qspip->thread = NULL; #endif #if QSPI_USE_MUTUAL_EXCLUSION == TRUE osalMutexObjectInit(&qspip->mutex); #endif #if defined(QSPI_DRIVER_EXT_INIT_HOOK) QSPI_DRIVER_EXT_INIT_HOOK(qspip); #endif }
/** * @brief Initializes the standard part of a @p DACDriver structure. * * @param[out] dacp pointer to the @p DACDriver object * * @init */ void dacObjectInit(DACDriver *dacp) { dacp->state = DAC_STOP; dacp->config = NULL; #if DAC_USE_WAIT dacp->thread = NULL; #endif #if DAC_USE_MUTUAL_EXCLUSION osalMutexObjectInit(&dacp->mutex); #endif #if defined(DAC_DRIVER_EXT_INIT_HOOK) DAC_DRIVER_EXT_INIT_HOOK(dacp); #endif }
/** * @brief Initializes the standard part of a @p ADCDriver structure. * * @param[out] adcp pointer to the @p ADCDriver object * * @init */ void adcObjectInit(ADCDriver *adcp) { adcp->state = ADC_STOP; adcp->config = NULL; adcp->samples = NULL; adcp->depth = 0; adcp->grpp = NULL; #if ADC_USE_WAIT == TRUE adcp->thread = NULL; #endif #if ADC_USE_MUTUAL_EXCLUSION == TRUE osalMutexObjectInit(&adcp->mutex); #endif #if defined(ADC_DRIVER_EXT_INIT_HOOK) ADC_DRIVER_EXT_INIT_HOOK(adcp); #endif }
/** * @brief Initializes the standard part of a @p UARTDriver structure. * * @param[out] uartp pointer to the @p UARTDriver object * * @init */ void uartObjectInit(UARTDriver *uartp) { uartp->state = UART_STOP; uartp->txstate = UART_TX_IDLE; uartp->rxstate = UART_RX_IDLE; uartp->config = NULL; #if UART_USE_WAIT == TRUE uartp->early = false; uartp->threadrx = NULL; uartp->threadtx = NULL; #endif /* UART_USE_WAIT */ #if UART_USE_MUTUAL_EXCLUSION == TRUE osalMutexObjectInit(&uartp->mutex); #endif /* UART_USE_MUTUAL_EXCLUSION */ /* Optional, user-defined initializer.*/ #if defined(UART_DRIVER_EXT_INIT_HOOK) UART_DRIVER_EXT_INIT_HOOK(uartp); #endif }
void samaCryptoDriverInit(CRYDriver *cryp) { cryp->enabledPer = 0; cryp->thread = NULL; osalMutexObjectInit(&cryp->mutex); }