Skip to content

Commit

Permalink
Deprecate clock source selection from RTC driver
Browse files Browse the repository at this point in the history
32K clock is shared by RTC, WUTs, timers and system so it is better be
handled by the system driver.

Signed-off-by: Tahsin Mutlugun <[email protected]>
  • Loading branch information
ttmut committed Jan 13, 2025
1 parent 07b66bd commit 7afcda3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 45 deletions.
18 changes: 1 addition & 17 deletions Libraries/PeriphDrivers/Include/MAX32657/rtc.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

/******************************************************************************
*
* Copyright (C) 2024 Analog Devices, Inc.
* Copyright (C) 2024-2025 Analog Devices, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -75,15 +75,6 @@ typedef enum {
MXC_RTC_INT_FL_READY = MXC_F_RTC_CTRL_RDY, /**< Timer ready interrupt flag */
} mxc_rtc_int_fl_t;

/**
* @brief Clock settings
*/
typedef enum {
MXC_RTC_ERTCO_CLK = 0,
MXC_RTC_INRO_CLK = 1,
MXC_RTC_EXT_CLK = 2,
} mxc_rtc_clock_t;

/**
* @brief Set Time-of-Day alarm value and enable Interrupt
* @param ras 20-bit value 0-0xFFFFF
Expand All @@ -99,13 +90,6 @@ int MXC_RTC_SetTimeofdayAlarm(uint32_t ras);
*/
int MXC_RTC_SetSubsecondAlarm(uint32_t rssa);

/**
* @brief Set the RTC clock source
* @param clk_src Clock source to use
* @retval returns Success or Fail, see \ref MXC_ERROR_CODES
*/
int MXC_RTC_SetClockSource(mxc_rtc_clock_t clk_src);

/**
* @brief Start the Real Time Clock (Blocking function)
* @retval returns Success or Fail, see \ref MXC_ERROR_CODES
Expand Down
29 changes: 1 addition & 28 deletions Libraries/PeriphDrivers/Source/RTC/rtc_me30.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/******************************************************************************
*
* Copyright (C) 2024 Analog Devices, Inc.
* Copyright (C) 2024-2025 Analog Devices, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -65,33 +65,6 @@ int MXC_RTC_SetSubsecondAlarm(uint32_t rssa)
return MXC_RTC_RevA_SetSubsecondAlarm((mxc_rtc_reva_regs_t *)MXC_RTC, rssa);
}

int MXC_RTC_SetClockSource(mxc_rtc_clock_t clk_src)
{
uint8_t retval = E_NO_ERROR;

switch (clk_src) {
case MXC_RTC_ERTCO_CLK:
#ifndef MSDK_NO_GPIO_CLK_INIT
retval = MXC_SYS_ClockSourceEnable(MXC_SYS_CLOCK_ERTCO);
#endif // MSDK_NO_GPIO_CLK_INIT
MXC_SETFIELD(MXC_MCR->ctrl, MXC_F_MCR_CTRL_CLKSEL, MXC_S_MCR_CTRL_CLKSEL_ERTCO);
break;

case MXC_RTC_INRO_CLK:
MXC_SETFIELD(MXC_MCR->ctrl, MXC_F_MCR_CTRL_CLKSEL, MXC_S_MCR_CTRL_CLKSEL_INRO_DIV4);
break;

case MXC_RTC_EXT_CLK:
return E_NOT_SUPPORTED;

default:
// Invalid clock source
return E_BAD_PARAM;
}

return retval;
}

int MXC_RTC_Start(void)
{
return MXC_RTC_RevA_Start((mxc_rtc_reva_regs_t *)MXC_RTC);
Expand Down

0 comments on commit 7afcda3

Please sign in to comment.