Updates based on feedback from jepler
This commit is contained in:
parent
e99cf6e441
commit
c0ba2a839f
|
@ -39,6 +39,7 @@
|
||||||
#include "supervisor/shared/translate.h"
|
#include "supervisor/shared/translate.h"
|
||||||
|
|
||||||
// This is the time in seconds since 2000 that the RTC was started.
|
// 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;
|
static uint32_t rtc_offset = 0;
|
||||||
|
|
||||||
void common_hal_rtc_get_time(timeutils_struct_time_t *tm) {
|
void common_hal_rtc_get_time(timeutils_struct_time_t *tm) {
|
||||||
|
|
|
@ -54,7 +54,7 @@ static int pulsein_interrupt_handler(int irq, FAR void *context, FAR void *arg)
|
||||||
// Grab the current time first.
|
// Grab the current time first.
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
gettimeofday(&tv, NULL);
|
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];
|
pulseio_pulsein_obj_t *self = pulsein_objects[irq - CXD56_IRQ_EXDEVICE_0];
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ typedef struct {
|
||||||
uint16_t maxlen;
|
uint16_t maxlen;
|
||||||
uint16_t start;
|
uint16_t start;
|
||||||
uint16_t len;
|
uint16_t len;
|
||||||
uint32_t last_us;
|
uint64_t last_us;
|
||||||
bool idle_state;
|
bool idle_state;
|
||||||
bool first_edge;
|
bool first_edge;
|
||||||
bool paused;
|
bool paused;
|
||||||
|
|
|
@ -71,6 +71,9 @@ inline bool autoreload_is_enabled() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void autoreload_start() {
|
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) {
|
if (autoreload_delay_ms == 0) {
|
||||||
supervisor_enable_tick();
|
supervisor_enable_tick();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue