Skip to content

Commit 8fc0880

Browse files
committed
Remove STATIC macro
1 parent 8f60724 commit 8fc0880

File tree

2 files changed

+6
-113
lines changed

2 files changed

+6
-113
lines changed

ports/nrf/modules/machine/rtc.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,17 +80,17 @@ typedef struct _machine_rtc_obj_t {
8080
} machine_rtc_obj_t;
8181

8282
// singleton RTC object
83-
STATIC const machine_rtc_obj_t machine_rtc_obj = {{&machine_rtc_type}};
83+
static const machine_rtc_obj_t machine_rtc_obj = {{&machine_rtc_type}};
8484

85-
STATIC mp_obj_t machine_rtc_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
85+
static mp_obj_t machine_rtc_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
8686
// check arguments
8787
mp_arg_check_num(n_args, n_kw, 0, 0, false);
8888

8989
// return constant object
9090
return (mp_obj_t)&machine_rtc_obj;
9191
}
9292

93-
STATIC mp_obj_t machine_rtc_datetime(mp_uint_t n_args, const mp_obj_t *args) {
93+
static mp_obj_t machine_rtc_datetime(mp_uint_t n_args, const mp_obj_t *args) {
9494
if (n_args == 1) {
9595
timeutils_struct_time_t t;
9696

@@ -129,12 +129,12 @@ STATIC mp_obj_t machine_rtc_datetime(mp_uint_t n_args, const mp_obj_t *args) {
129129
}
130130
return mp_const_none;
131131
}
132-
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_rtc_datetime_obj, 1, 2, machine_rtc_datetime);
132+
static MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_rtc_datetime_obj, 1, 2, machine_rtc_datetime);
133133

134-
STATIC const mp_rom_map_elem_t machine_rtc_locals_dict_table[] = {
134+
static const mp_rom_map_elem_t machine_rtc_locals_dict_table[] = {
135135
{ MP_ROM_QSTR(MP_QSTR_datetime), MP_ROM_PTR(&machine_rtc_datetime_obj) },
136136
};
137-
STATIC MP_DEFINE_CONST_DICT(machine_rtc_locals_dict, machine_rtc_locals_dict_table);
137+
static MP_DEFINE_CONST_DICT(machine_rtc_locals_dict, machine_rtc_locals_dict_table);
138138

139139
MP_DEFINE_CONST_OBJ_TYPE(
140140
machine_rtc_type,

ports/webassembly/modjs.c

Lines changed: 0 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,11 @@
2828
#include "py/runtime.h"
2929
#include "proxy_c.h"
3030

31-
<<<<<<< HEAD:ports/webassembly/modjs.c
3231
#if MICROPY_PY_JS
33-
=======
34-
#include "py/nlr.h"
35-
#include "py/smallint.h"
36-
#include "py/obj.h"
37-
#include "py/runtime.h"
38-
#include "shared/timeutils/timeutils.h"
39-
#include "extmod/utime_mphal.h"
40-
>>>>>>> 38a15c3c21 (ports/nrf: Squashing early commits.):ports/nrf/modules/utime/modutime.c
4132

4233
/******************************************************************************/
4334
// js module
4435

45-
<<<<<<< HEAD:ports/webassembly/modjs.c
4636
void mp_module_js_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
4737
mp_obj_jsproxy_t global_this;
4838
global_this.ref = 0;
@@ -51,103 +41,6 @@ void mp_module_js_attr(mp_obj_t self_in, qstr attr, mp_obj_t *dest) {
5141

5242
static const mp_rom_map_elem_t mp_module_js_globals_table[] = {
5343
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_js) },
54-
=======
55-
void rtc_get_time(timeutils_struct_time_t *time);
56-
57-
// localtime([secs])
58-
// Convert a time expressed in seconds since the Epoch into an 8-tuple which
59-
// contains: (year, month, mday, hour, minute, second, weekday, yearday)
60-
// If secs is not provided or None, then the current time from is used.
61-
STATIC mp_obj_t time_localtime(size_t n_args, const mp_obj_t *args) {
62-
if (n_args == 0 || args[0] == mp_const_none) {
63-
// Get current date and time.
64-
timeutils_struct_time_t t;
65-
rtc_get_time(&t);
66-
mp_obj_t tuple[8] = {
67-
mp_obj_new_int(t.tm_year),
68-
mp_obj_new_int(t.tm_mon),
69-
mp_obj_new_int(t.tm_mday),
70-
mp_obj_new_int(t.tm_hour),
71-
mp_obj_new_int(t.tm_min),
72-
mp_obj_new_int(t.tm_sec),
73-
mp_obj_new_int(t.tm_wday),
74-
mp_obj_new_int(timeutils_year_day(t.tm_year, t.tm_mon, t.tm_mday)),
75-
};
76-
return mp_obj_new_tuple(8, tuple);
77-
} else {
78-
// Convert given seconds to tuple.
79-
mp_int_t seconds = mp_obj_get_int(args[0]);
80-
timeutils_struct_time_t tm;
81-
timeutils_seconds_since_epoch_to_struct_time(seconds, &tm);
82-
mp_obj_t tuple[8] = {
83-
tuple[0] = mp_obj_new_int(tm.tm_year),
84-
tuple[1] = mp_obj_new_int(tm.tm_mon),
85-
tuple[2] = mp_obj_new_int(tm.tm_mday),
86-
tuple[3] = mp_obj_new_int(tm.tm_hour),
87-
tuple[4] = mp_obj_new_int(tm.tm_min),
88-
tuple[5] = mp_obj_new_int(tm.tm_sec),
89-
tuple[6] = mp_obj_new_int(tm.tm_wday),
90-
tuple[7] = mp_obj_new_int(tm.tm_yday),
91-
};
92-
return mp_obj_new_tuple(8, tuple);
93-
}
94-
}
95-
MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(time_localtime_obj, 0, 1, time_localtime);
96-
97-
// mktime()
98-
// This is inverse function of localtime. It's argument is a full 8-tuple
99-
// which expresses a time as per localtime. It returns an integer which is
100-
// the number of seconds since the Epoch.
101-
STATIC mp_obj_t time_mktime(mp_obj_t tuple) {
102-
size_t len;
103-
mp_obj_t *elem;
104-
mp_obj_get_array(tuple, &len, &elem);
105-
106-
// localtime generates a tuple of len 8. CPython uses 9, so we accept both.
107-
if (len < 8 || len > 9) {
108-
mp_raise_TypeError(MP_ERROR_TEXT("mktime needs a tuple of length 8 or 9"));
109-
}
110-
111-
return mp_obj_new_int_from_uint(timeutils_mktime(mp_obj_get_int(elem[0]),
112-
mp_obj_get_int(elem[1]), mp_obj_get_int(elem[2]), mp_obj_get_int(elem[3]),
113-
mp_obj_get_int(elem[4]), mp_obj_get_int(elem[5])));
114-
}
115-
MP_DEFINE_CONST_FUN_OBJ_1(time_mktime_obj, time_mktime);
116-
117-
#if MICROPY_PY_MACHINE_RTC
118-
// time()
119-
// Return the number of seconds since the Epoch.
120-
STATIC mp_obj_t time_time(void) {
121-
// datetime_t t;
122-
timeutils_struct_time_t t;
123-
rtc_get_time(&t);
124-
return mp_obj_new_int_from_ull(timeutils_seconds_since_epoch(t.tm_year, t.tm_mon, t.tm_mday, t.tm_hour, t.tm_min, t.tm_sec));
125-
}
126-
127-
STATIC MP_DEFINE_CONST_FUN_OBJ_0(time_time_obj, time_time);
128-
#endif
129-
130-
STATIC const mp_rom_map_elem_t time_module_globals_table[] = {
131-
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_utime) },
132-
133-
#if MICROPY_PY_MACHINE_RTC
134-
{ MP_ROM_QSTR(MP_QSTR_gmtime), MP_ROM_PTR(&time_localtime_obj) },
135-
{ MP_ROM_QSTR(MP_QSTR_localtime), MP_ROM_PTR(&time_localtime_obj) },
136-
{ MP_ROM_QSTR(MP_QSTR_mktime), MP_ROM_PTR(&time_mktime_obj) },
137-
138-
{ MP_ROM_QSTR(MP_QSTR_time), MP_ROM_PTR(&time_time_obj) },
139-
{ MP_ROM_QSTR(MP_QSTR_time_ns), MP_ROM_PTR(&mp_utime_time_ns_obj) },
140-
#endif
141-
{ MP_ROM_QSTR(MP_QSTR_sleep), MP_ROM_PTR(&mp_utime_sleep_obj) },
142-
{ MP_ROM_QSTR(MP_QSTR_sleep_ms), MP_ROM_PTR(&mp_utime_sleep_ms_obj) },
143-
{ MP_ROM_QSTR(MP_QSTR_sleep_us), MP_ROM_PTR(&mp_utime_sleep_us_obj) },
144-
145-
{ MP_ROM_QSTR(MP_QSTR_ticks_ms), MP_ROM_PTR(&mp_utime_ticks_ms_obj) },
146-
{ MP_ROM_QSTR(MP_QSTR_ticks_us), MP_ROM_PTR(&mp_utime_ticks_us_obj) },
147-
{ MP_ROM_QSTR(MP_QSTR_ticks_cpu), MP_ROM_PTR(&mp_utime_ticks_cpu_obj) },
148-
{ MP_ROM_QSTR(MP_QSTR_ticks_add), MP_ROM_PTR(&mp_utime_ticks_add_obj) },
149-
{ MP_ROM_QSTR(MP_QSTR_ticks_diff), MP_ROM_PTR(&mp_utime_ticks_diff_obj) },
150-
>>>>>>> 38a15c3c21 (ports/nrf: Squashing early commits.):ports/nrf/modules/utime/modutime.c
15144
};
15245
static MP_DEFINE_CONST_DICT(mp_module_js_globals, mp_module_js_globals_table);
15346

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy