Updates based on feedback from jepler

This commit is contained in:
Scott Shawcroft 2020-04-06 16:03:31 -07:00
parent e99cf6e441
commit c0ba2a839f
No known key found for this signature in database
GPG Key ID: 9349BC7E64B1921E
4 changed files with 6 additions and 2 deletions

View File

@ -39,6 +39,7 @@
#include "supervisor/shared/translate.h"
// This is the time in seconds since 2000 that the RTC was started.
// TODO: Change the offset to ticks so that it can be a subsecond adjustment.
static uint32_t rtc_offset = 0;
void common_hal_rtc_get_time(timeutils_struct_time_t *tm) {

View File

@ -54,7 +54,7 @@ static int pulsein_interrupt_handler(int irq, FAR void *context, FAR void *arg)
// Grab the current time first.
struct timeval tv;
gettimeofday(&tv, NULL);
uint32_t current_us = tv.tv_sec * 1000000 + tv.tv_usec;
uint64_t current_us = ((uint64_t) tv.tv_sec) * 1000000 + tv.tv_usec;
pulseio_pulsein_obj_t *self = pulsein_objects[irq - CXD56_IRQ_EXDEVICE_0];

View File

@ -38,7 +38,7 @@ typedef struct {
uint16_t maxlen;
uint16_t start;
uint16_t len;
uint32_t last_us;
uint64_t last_us;
bool idle_state;
bool first_edge;
bool paused;

View File

@ -71,6 +71,9 @@ inline bool autoreload_is_enabled() {
}
void autoreload_start() {
// Enable ticks if we haven't been tracking an autoreload delay. We check
// our current state so that we only turn ticks on once. Multiple starts
// can occur before we reload and then turn ticks off.
if (autoreload_delay_ms == 0) {
supervisor_enable_tick();
}