Skip to content

Commit 487d1cb

Browse files
committed
address comments and improve api
1 parent d817be2 commit 487d1cb

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

components/rx8130ce/example/main/rx8130ce_example.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ extern "C" void app_main(void) {
9191
logger.info("Testing timer functionality");
9292

9393
// Set a 5-second timer
94-
if (rtc.set_timer(5, Rtc::TimerClockSource::FREQ_1_HZ, false, ec)) {
94+
if (rtc.set_timer(5, Rtc::TimerClockSource::FREQ_1_HZ, ec)) {
9595
logger.info("Timer set for 5 seconds");
9696
}
9797

@@ -124,7 +124,7 @@ extern "C" void app_main(void) {
124124
rtc.clear_timer_flag(ec);
125125

126126
// Restart timer for another 5 seconds
127-
rtc.set_timer(5, Rtc::TimerClockSource::FREQ_1_HZ, false, ec);
127+
rtc.set_timer(5, Rtc::TimerClockSource::FREQ_1_HZ, ec);
128128
logger.info("Timer restarted");
129129
}
130130
}

components/rx8130ce/include/rx8130ce.hpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -323,16 +323,17 @@ class Rx8130ce : public espp::BasePeripheral<uint8_t, UseAddress> {
323323

324324
/// @brief Set an alarm using std::tm structure
325325
/// @param alarm_time The time to trigger the alarm
326-
/// @param is_day_target True to use day as target of alarm function, false to use week
326+
/// @param is_week_day_target True to use week day as target of alarm
327+
/// function, false to use month day
327328
/// @param ec The error code to set if an error occurs
328329
/// @return True if the alarm was set successfully, false otherwise
329-
/// @note If is_day_target is true, the alarm will trigger on the specified
330+
/// @note If is_week_day_target is true, the alarm will trigger on the specified
330331
/// day of the month. If false, it will trigger on the specified day of
331332
/// the week.
332333
/// @note This will match exactly the minute, hour, and day/week specified
333334
/// because it will set all the alarm bits to 0 (enabled for exact
334335
/// match).
335-
bool set_alarm(const std::tm &alarm_time, bool is_day_target, std::error_code &ec) {
336+
bool set_alarm(const std::tm &alarm_time, bool is_week_day_target, std::error_code &ec) {
336337
std::lock_guard<std::recursive_mutex> lock(base_mutex_);
337338

338339
// Note: this will match exactly the minute,hour and day/week specified
@@ -343,7 +344,7 @@ class Rx8130ce : public espp::BasePeripheral<uint8_t, UseAddress> {
343344
uint8_t data[3];
344345
data[0] = decimal_to_bcd(alarm_time.tm_min);
345346
data[1] = decimal_to_bcd(alarm_time.tm_hour);
346-
if (is_day_target) {
347+
if (is_week_day_target) {
347348
data[2] = decimal_to_bcd(alarm_time.tm_wday);
348349
} else {
349350
data[2] = decimal_to_bcd(alarm_time.tm_mday);
@@ -354,7 +355,7 @@ class Rx8130ce : public espp::BasePeripheral<uint8_t, UseAddress> {
354355

355356
// Set week/day alarm bit
356357
set_bits_in_register_by_mask(static_cast<uint8_t>(Register::EXTENSION), WEEK_DAY_ALARM_BIT,
357-
is_day_target ? WEEK_DAY_ALARM_BIT : 0x00, ec);
358+
is_week_day_target ? WEEK_DAY_ALARM_BIT : 0x00, ec);
358359

359360
return !ec;
360361
}
@@ -420,10 +421,9 @@ class Rx8130ce : public espp::BasePeripheral<uint8_t, UseAddress> {
420421
/// @brief Set the countdown timer
421422
/// @param value Timer value (0-4095)
422423
/// @param clock_source Timer clock source
423-
/// @param repeat Whether to repeat the timer
424424
/// @param ec The error code to set if an error occurs
425425
/// @return True if the timer was set successfully, false otherwise
426-
bool set_timer(uint16_t value, TimerClockSource clock_source, bool repeat, std::error_code &ec) {
426+
bool set_timer(uint16_t value, TimerClockSource clock_source, std::error_code &ec) {
427427
std::lock_guard<std::recursive_mutex> lock(base_mutex_);
428428

429429
// ensure timer enable (TE) bit is 0 before writing to timer registers

0 commit comments

Comments
 (0)