From 43135dc34827b99ff494972179db73c097d9adcb Mon Sep 17 00:00:00 2001 From: "Michael (XIAO Xufeng)" Date: Sun, 18 Aug 2019 13:30:39 +0800 Subject: [PATCH] spi: convenient LL macro --- components/soc/esp32/include/hal/spi_ll.h | 2 ++ components/soc/esp32s2beta/include/hal/spi_ll.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/components/soc/esp32/include/hal/spi_ll.h b/components/soc/esp32/include/hal/spi_ll.h index b66bc1baaf..aaa4fa7aba 100644 --- a/components/soc/esp32/include/hal/spi_ll.h +++ b/components/soc/esp32/include/hal/spi_ll.h @@ -36,6 +36,8 @@ /// Swap the bit order to its correct place to send #define HAL_SPI_SWAP_DATA_TX(data, len) HAL_SWAP32((uint32_t)data<<(32-len)) +#define SPI_LL_GET_HW(ID) ((ID)==0? &SPI1:((ID)==1? &SPI2 : &SPI3)) + /** * The data structure holding calculated clock configuration. Since the * calculation needs long time, it should be calculated during initialization and diff --git a/components/soc/esp32s2beta/include/hal/spi_ll.h b/components/soc/esp32s2beta/include/hal/spi_ll.h index c6c11e215e..70b0c170ad 100644 --- a/components/soc/esp32s2beta/include/hal/spi_ll.h +++ b/components/soc/esp32s2beta/include/hal/spi_ll.h @@ -36,6 +36,8 @@ /// Swap the bit order to its correct place to send #define HAL_SPI_SWAP_DATA_TX(data, len) HAL_SWAP32((uint32_t)data<<(32-len)) +#define SPI_LL_GET_HW(ID) ((ID)==0? ({abort();NULL;}):((ID)==1? &GPSPI2 : ((ID)==2? &GPSPI3: &GPSPI4))) + /** * The data structure holding calculated clock configuration. Since the * calculation needs long time, it should be calculated during initialization and