Skip to content

Commit c0ba2a8

Browse files
committed
Updates based on feedback from jepler
1 parent e99cf6e commit c0ba2a8

4 files changed

Lines changed: 6 additions & 2 deletions

File tree

ports/atmel-samd/common-hal/rtc/RTC.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
#include "supervisor/shared/translate.h"
4040

4141
// This is the time in seconds since 2000 that the RTC was started.
42+
// TODO: Change the offset to ticks so that it can be a subsecond adjustment.
4243
static uint32_t rtc_offset = 0;
4344

4445
void common_hal_rtc_get_time(timeutils_struct_time_t *tm) {

ports/cxd56/common-hal/pulseio/PulseIn.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ static int pulsein_interrupt_handler(int irq, FAR void *context, FAR void *arg)
5454
// Grab the current time first.
5555
struct timeval tv;
5656
gettimeofday(&tv, NULL);
57-
uint32_t current_us = tv.tv_sec * 1000000 + tv.tv_usec;
57+
uint64_t current_us = ((uint64_t) tv.tv_sec) * 1000000 + tv.tv_usec;
5858

5959
pulseio_pulsein_obj_t *self = pulsein_objects[irq - CXD56_IRQ_EXDEVICE_0];
6060

ports/cxd56/common-hal/pulseio/PulseIn.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ typedef struct {
3838
uint16_t maxlen;
3939
uint16_t start;
4040
uint16_t len;
41-
uint32_t last_us;
41+
uint64_t last_us;
4242
bool idle_state;
4343
bool first_edge;
4444
bool paused;

supervisor/shared/autoreload.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ inline bool autoreload_is_enabled() {
7171
}
7272

7373
void autoreload_start() {
74+
// Enable ticks if we haven't been tracking an autoreload delay. We check
75+
// our current state so that we only turn ticks on once. Multiple starts
76+
// can occur before we reload and then turn ticks off.
7477
if (autoreload_delay_ms == 0) {
7578
supervisor_enable_tick();
7679
}

0 commit comments

Comments
 (0)