Skip to content

Commit eb8203a

Browse files
committed
update comments
1 parent 5d22dfc commit eb8203a

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

cores/esp32/Esp.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -537,44 +537,44 @@ uint64_t EspClass::getEfuseMac(void) {
537537
*/
538538
uint8_t EspClass::getFlashSourceFrequencyMHz(void) {
539539
#if CONFIG_IDF_TARGET_ESP32
540-
// ESP32 classic: Use HAL function
540+
// ESP32: Use HAL function
541541
return spi_flash_ll_get_source_clock_freq_mhz(0); // host_id = 0 for SPI0
542542
#else
543-
// For newer chips (S2, S3, C2, C3, C6, H2): Use spimem HAL function
543+
// All modern MCUs: Use spimem HAL function
544544
return spimem_flash_ll_get_source_freq_mhz();
545545
#endif
546546
}
547547

548548
/**
549549
* @brief Read the clock divider from hardware using HAL structures
550550
* Based on ESP-IDF HAL implementation:
551-
* - ESP32 classic: Uses SPI1.clock (typedef in spi_flash_ll.h line 52)
552-
* - All modern chips: Use SPIMEM1.clock (typedef in spimem_flash_ll.h)
551+
* - ESP32: Uses SPI1.clock (typedef in spi_flash_ll.h)
552+
* - All newer MCUs: Use SPIMEM1.clock (typedef in spimem_flash_ll.h)
553553
* @return Clock divider value (1 = no division, 2 = divide by 2, etc.)
554554
*/
555555
uint8_t EspClass::getFlashClockDivider(void) {
556556
#if CONFIG_IDF_TARGET_ESP32
557-
// ESP32 classic: Flash uses SPI1 peripheral (not SPI0)
558-
// See: esp-idf/components/hal/esp32/include/hal/spi_flash_ll.h line 52
557+
// ESP32: Flash uses SPI1
558+
// See: line 52: esp-idf/components/hal/esp32/include/hal/spi_flash_ll.h
559559
if (SPI1.clock.clk_equ_sysclk) {
560-
return 1; // 1:1 clock (no divider)
560+
return 1; // 1:1 clock
561561
}
562562
return SPI1.clock.clkcnt_n + 1;
563563
#else
564-
// All modern chips (S2, S3, C2, C3, C5, C6, C61, H2, P4): Flash uses SPIMEM1
564+
// All newer MCUs: Flash uses SPIMEM1
565565
// See: esp-idf/components/hal/esp32*/include/hal/spimem_flash_ll.h
566566
// Example S3: line 38: typedef typeof(SPIMEM1.clock.val) spimem_flash_ll_clock_reg_t;
567-
// Example C5: esp-idf/components/soc/esp32c5/mp/include/soc/spi_mem_struct.h lines 97-99
567+
// Example C5: lines 97-99: esp-idf/components/soc/esp32c5/mp/include/soc/spi_mem_struct.h
568568
if (SPIMEM1.clock.clk_equ_sysclk) {
569-
return 1; // 1:1 clock (no divider)
569+
return 1; // 1:1 clock
570570
}
571571
return SPIMEM1.clock.clkcnt_n + 1;
572572
#endif
573573
}
574574

575575
/**
576576
* @brief Get the actual flash frequency in MHz
577-
* @return Flash frequency in MHz (e.g., 80, 120, 160, 240)
577+
* @return Flash frequency in MHz (80, 120, 160, or 240)
578578
*/
579579
uint32_t EspClass::getFlashFrequencyMHz(void) {
580580
uint8_t source = getFlashSourceFrequencyMHz();

0 commit comments

Comments
 (0)