Linux Audio

Check our new training course

Embedded Linux Audio

Check our new training course
with Creative Commons CC-BY-SA
lecture materials

Bootlin logo

Elixir Cross Referencer

Loading...
# nrfx I2C support

# Copyright (c) 2018, Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0

menuconfig I2C_NRFX
	bool "nRF TWI nrfx drivers"
	default y
	depends on SOC_FAMILY_NRF
	help
	  Enable support for nrfx TWI drivers for nRF MCU series.
	  Peripherals with the same instance ID cannot be used together,
	  e.g. I2C_0 and SPI_0. You may need to disable SPI_0 or SPI_1.

if I2C_NRFX

# In most Nordic SoCs, SPI and TWI peripherals with the same instance number
# share certain resources and therefore cannot be used at the same time
# (in nRF91 Series this limitation concerns UART peripherals as well).
# In nRF52810 though, there are only single instances of these peripherals
# and they are arranged in a different way, so this limitation does not apply.
if I2C_0 && (SOC_NRF52810 || \
             (!SPI_0 && !(SOC_SERIES_NRF91X && UART_0_NRF_UARTE)))

choice I2C_0_NRF_TYPE
	prompt "I2C Port 0 Driver type"

config I2C_0_NRF_TWI
	bool "nRF TWI 0"
	depends on HAS_HW_NRF_TWI0
	select NRFX_TWI0
	help
	  Enable nRF TWI Master without EasyDMA on port 0.

config I2C_0_NRF_TWIM
	bool "nRF TWIM 0"
	depends on HAS_HW_NRF_TWIM0
	select NRFX_TWIM0
	help
	  Enable nRF TWI Master with EasyDMA on port 0.
	  This peripheral accepts transfers from RAM only,
	  if provided buffer is placed in flash, transfer will fail.

endchoice

endif # I2C_0 && (SOC_NRF52810 || ...

# In Nordic SoCs, SPI and TWI peripherals with the same instance number
# share certain resources and therefore cannot be used at the same time
# (in nRF91 Series this limitation concerns UART peripherals as well).
if I2C_1 && !SPI_1 && !(SOC_SERIES_NRF91X && UART_1_NRF_UARTE)

choice I2C_1_NRF_TYPE
	prompt "I2C Port 1 Driver type"

config I2C_1_NRF_TWI
	bool "nRF TWI 1"
	depends on HAS_HW_NRF_TWI1
	select NRFX_TWI1
	help
	  Enable nRF TWI Master without EasyDMA on port 1.

config I2C_1_NRF_TWIM
	bool "nRF TWIM 1"
	depends on HAS_HW_NRF_TWIM1
	select NRFX_TWIM1
	help
	  Enable nRF TWI Master with EasyDMA on port 1.
	  This peripheral accepts transfers from RAM only,
	  if provided buffer is placed in flash, transfer will fail.

endchoice

endif # I2C_1 && !SPI_1 && !(SOC_SERIES_NRF91X && UART_1_NRF_UARTE)

# In Nordic SoCs, SPI and TWI peripherals with the same instance number
# share certain resources and therefore cannot be used at the same time
# (in nRF91 Series this limitation concerns UART peripherals as well).
if I2C_2 && !SPI_2 && !(SOC_SERIES_NRF91X && UART_2_NRF_UARTE)

choice I2C_2_NRF_TYPE
	prompt "I2C Port 2 Driver type"

config I2C_2_NRF_TWIM
	bool "nRF TWIM 2"
	depends on HAS_HW_NRF_TWIM2
	select NRFX_TWIM2
	help
	  Enable nRF TWI Master with EasyDMA on port 2.
	  This peripheral accepts transfers from RAM only,
	  if provided buffer is placed in flash, transfer will fail.

endchoice

endif # I2C_2 && !SPI_2 && !(SOC_SERIES_NRF91X && UART_2_NRF_UARTE)

# In Nordic SoCs, SPI and TWI peripherals with the same instance number
# share certain resources and therefore cannot be used at the same time
# (in nRF91 Series SoCs this limitation concerns UART peripherals as well).
if I2C_3 && !SPI_3 && !(SOC_SERIES_NRF91X && UART_3_NRF_UARTE)

choice I2C_3_NRF_TYPE
	prompt "I2C Port 3 Driver type"

config I2C_3_NRF_TWIM
	bool "nRF TWIM 3"
	depends on HAS_HW_NRF_TWIM3
	select NRFX_TWIM3
	help
	  Enable nRF TWI Master with EasyDMA on port 3.
	  This peripheral accepts transfers from RAM only,
	  if provided buffer is placed in flash, transfer will fail.

endchoice

endif # I2C_3 && !SPI_3 && !(SOC_SERIES_NRF91X && UART_3_NRF_UARTE)

endif # I2C_NRFX