8f20cdc353
For time-based functions that work with absolute time there is the need for an Epoch, to set the zero-point at which the absolute time starts counting. Such functions include time.time() and filesystem stat return values. And different ports may use a different Epoch. To make it clearer what functions use the Epoch (whatever it may be), and make the ports more consistent with their use of the Epoch, this commit renames all Epoch related functions to include the word "epoch" in their name (and remove references to "2000"). Along with this rename, the following things have changed: - mp_hal_time_ns() is now specified to return the number of nanoseconds since the Epoch, rather than since 1970 (but since this is an internal function it doesn't change anything for the user). - littlefs timestamps on the esp8266 have been fixed (they were previously off by 30 years in nanoseconds). Otherwise, there is no functional change made by this commit. Signed-off-by: Damien George <damien@micropython.org>
40 lines
1.1 KiB
C
40 lines
1.1 KiB
C
#ifndef MICROPY_INCLUDED_ESP8266_MODMACHINE_H
|
|
#define MICROPY_INCLUDED_ESP8266_MODMACHINE_H
|
|
|
|
#include "py/obj.h"
|
|
|
|
extern const mp_obj_type_t pyb_pin_type;
|
|
extern const mp_obj_type_t pyb_pwm_type;
|
|
extern const mp_obj_type_t machine_adc_type;
|
|
extern const mp_obj_type_t pyb_rtc_type;
|
|
extern const mp_obj_type_t pyb_uart_type;
|
|
extern const mp_obj_type_t pyb_i2c_type;
|
|
extern const mp_obj_type_t machine_hspi_type;
|
|
|
|
MP_DECLARE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_info_obj);
|
|
|
|
typedef struct _pyb_pin_obj_t {
|
|
mp_obj_base_t base;
|
|
uint16_t phys_port;
|
|
uint16_t func;
|
|
uint32_t periph;
|
|
} pyb_pin_obj_t;
|
|
|
|
const pyb_pin_obj_t pyb_pin_obj[16 + 1];
|
|
|
|
void pin_init0(void);
|
|
|
|
uint mp_obj_get_pin(mp_obj_t pin_in);
|
|
pyb_pin_obj_t *mp_obj_get_pin_obj(mp_obj_t pin_in);
|
|
int pin_get(uint pin);
|
|
void pin_set(uint pin, int value);
|
|
|
|
extern uint32_t pyb_rtc_alarm0_wake;
|
|
extern uint64_t pyb_rtc_alarm0_expiry;
|
|
|
|
void pyb_rtc_set_us_since_epoch(uint64_t nowus);
|
|
uint64_t pyb_rtc_get_us_since_epoch();
|
|
void rtc_prepare_deepsleep(uint64_t sleep_us);
|
|
|
|
#endif // MICROPY_INCLUDED_ESP8266_MODMACHINE_H
|