diff --git a/cpu/esp_common/periph/i2c_sw.c b/cpu/esp_common/periph/i2c_sw.c index 079723c166..ea8f333cc9 100644 --- a/cpu/esp_common/periph/i2c_sw.c +++ b/cpu/esp_common/periph/i2c_sw.c @@ -60,13 +60,13 @@ /* gpio access macros */ #if defined(CPU_FAM_ESP32) || defined(CPU_FAM_ESP32S2) || defined(CPU_FAM_ESP32S3) -#define GPIO_SET(lo, hi, b) if (b < 32) { GPIO.lo = BIT(b); } else { GPIO.hi.val = BIT(b-32); } -#define GPIO_GET(lo, hi, b) ((b < 32) ? GPIO.lo & BIT(b) : GPIO.hi.val & BIT(b-32)) -#elif defined(CPU_FAM_ESP32C3) || defined(CPU_FAM_ESP32H2) -#define GPIO_SET(lo, hi, b) GPIO.lo.val = BIT(b) -#define GPIO_GET(lo, hi, b) GPIO.lo.val & BIT(b) +# define GPIO_SET(lo, hi, b) if (b < 32) { GPIO.lo = BIT(b); } else { GPIO.hi.val = BIT(b-32); } +# define GPIO_GET(lo, hi, b) ((b < 32) ? GPIO.lo & BIT(b) : GPIO.hi.val & BIT(b-32)) +#elif defined(CPU_FAM_ESP32C3) || defined(CPU_FAM_ESP32C6) || defined(CPU_FAM_ESP32H2) +# define GPIO_SET(lo, hi, b) GPIO.lo.val = BIT(b) +# define GPIO_GET(lo, hi, b) GPIO.lo.val & BIT(b) #else -#error "Platform implementation is missing" +# error "Platform implementation is missing" #endif #else /* CPU_ESP8266 */ @@ -83,7 +83,7 @@ */ #ifndef I2C_CLOCK_STRETCH /* max clock stretching counter (ca. 10 ms) */ -#define I2C_CLOCK_STRETCH 40000 +# define I2C_CLOCK_STRETCH 40000 #endif /* I2C_CLOCK_STRETCH */ /* following functions have to be declared as extern since it is not possible */ @@ -116,19 +116,21 @@ static _i2c_bus_t _i2c_bus[I2C_NUMOF] = {}; #pragma GCC optimize ("O2") #if defined(CPU_FAM_ESP32) -#define I2C_CLK_CAL 62 /* clock calibration offset */ +# define I2C_CLK_CAL 62 /* clock calibration offset */ #elif defined(CPU_FAM_ESP32C3) -#define I2C_CLK_CAL 32 /* clock calibration offset */ +# define I2C_CLK_CAL 32 /* clock calibration offset */ +#elif defined(CPU_FAM_ESP32C6) +# define I2C_CLK_CAL 32 /* clock calibration offset */ #elif defined(CPU_FAM_ESP32H2) -#define I2C_CLK_CAL 24 /* clock calibration offset */ +# define I2C_CLK_CAL 24 /* clock calibration offset */ #elif defined(CPU_FAM_ESP32S2) -#define I2C_CLK_CAL 82 /* clock calibration offset */ +# define I2C_CLK_CAL 82 /* clock calibration offset */ #elif defined(CPU_FAM_ESP32S3) -#define I2C_CLK_CAL 82 /* clock calibration offset */ +# define I2C_CLK_CAL 82 /* clock calibration offset */ #elif defined(CPU_ESP8266) -#define I2C_CLK_CAL 47 /* clock calibration offset */ +# define I2C_CLK_CAL 47 /* clock calibration offset */ #else -#error "Platform implementation is missing" +# error "Platform implementation is missing" #endif static const uint32_t _i2c_clocks[] = { diff --git a/cpu/esp_common/periph/uart.c b/cpu/esp_common/periph/uart.c index 27e22819e0..fd5fd21a2e 100644 --- a/cpu/esp_common/periph/uart.c +++ b/cpu/esp_common/periph/uart.c @@ -83,11 +83,13 @@ * For lower CPU clock frequencies, the APB clock corresponds to the CPU clock * frequency. Therefore, we need to determine the actual UART clock frequency * from the actual APB clock frequency. */ -#define UART_CLK_FREQ rtc_clk_apb_freq_get() /* APB_CLK is used */ +# define UART_CLK_FREQ rtc_clk_apb_freq_get() /* APB_CLK is used */ +#elif CPU_FAM_ESP32C6 +# define UART_CLK_FREQ (CLK_LL_PLL_80M_FREQ_MHZ * MHZ) /* PLL_F80M_CLK is used */ #elif CPU_FAM_ESP32H2 -#define UART_CLK_FREQ (CLK_LL_PLL_48M_FREQ_MHZ * MHZ) /* PLL_F48M_CLK is used */ +# define UART_CLK_FREQ (CLK_LL_PLL_48M_FREQ_MHZ * MHZ) /* PLL_F48M_CLK is used */ #else -#error "Platform implementation is missing" +# error "Platform implementation is missing" #endif #endif /* defined(CPU_ESP8266) */