Skip to content

Commit 8f55981

Browse files
committed
Refactor: Change STATIC to static for consistency in openmv-libtf.cpp and tensorflow-microlite.c
1 parent 1135bf2 commit 8f55981

File tree

3 files changed

+24
-23
lines changed

3 files changed

+24
-23
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ boards/**/managed_components/
99
# Lock files under boards/**
1010
boards/**/dependencies.lock
1111
boards/**/*.lock
12+
/.idea/**

src/microlite/openmv-libtf.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include <stdio.h>
1717

1818
extern "C" {
19-
STATIC microlite::MicropythonErrorReporter micro_error_reporter;
19+
static microlite::MicropythonErrorReporter micro_error_reporter;
2020
/*
2121
Return the index'th tensor
2222
*/

src/microlite/tensorflow-microlite.c

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@
2121

2222
// The tensor object =================================================
2323

24-
STATIC const mp_obj_type_t microlite_tensor_type;
24+
static const mp_obj_type_t microlite_tensor_type;
2525

2626

27-
STATIC mp_obj_t tensor_get_value(mp_obj_t self_in, mp_obj_t index_obj) {
27+
static mp_obj_t tensor_get_value(mp_obj_t self_in, mp_obj_t index_obj) {
2828

2929
// Get our tensor object
3030
microlite_tensor_obj_t *self = MP_OBJ_TO_PTR(self_in);
@@ -64,7 +64,7 @@ STATIC mp_obj_t tensor_get_value(mp_obj_t self_in, mp_obj_t index_obj) {
6464
}
6565

6666

67-
STATIC mp_obj_t tensor_set_value (mp_obj_t self_in, mp_obj_t index_obj, mp_obj_t value) {
67+
static mp_obj_t tensor_set_value (mp_obj_t self_in, mp_obj_t index_obj, mp_obj_t value) {
6868

6969
// Get the index from the index object
7070
mp_int_t index = mp_obj_int_get_checked(index_obj);
@@ -99,7 +99,7 @@ STATIC mp_obj_t tensor_set_value (mp_obj_t self_in, mp_obj_t index_obj, mp_obj_t
9999
}
100100

101101

102-
STATIC mp_obj_t tensor_get_tensor_type(mp_obj_t self_in, mp_obj_t index_obj) {
102+
static mp_obj_t tensor_get_tensor_type(mp_obj_t self_in, mp_obj_t index_obj) {
103103

104104
// Get our tensor object
105105
microlite_tensor_obj_t *self = MP_OBJ_TO_PTR(self_in);
@@ -115,7 +115,7 @@ STATIC mp_obj_t tensor_get_tensor_type(mp_obj_t self_in, mp_obj_t index_obj) {
115115
}
116116

117117

118-
STATIC mp_obj_t tensor_quantize_float_to_int8(mp_obj_t self_in, mp_obj_t float_obj) {
118+
static mp_obj_t tensor_quantize_float_to_int8(mp_obj_t self_in, mp_obj_t float_obj) {
119119

120120
// Check that the object received is a float
121121
if (!mp_obj_is_float(float_obj)) {
@@ -144,7 +144,7 @@ STATIC mp_obj_t tensor_quantize_float_to_int8(mp_obj_t self_in, mp_obj_t float_o
144144
}
145145

146146

147-
STATIC mp_obj_t tensor_quantize_int8_to_float (mp_obj_t self_in, mp_obj_t int_obj) {
147+
static mp_obj_t tensor_quantize_int8_to_float (mp_obj_t self_in, mp_obj_t int_obj) {
148148

149149
// Check that the object received is an int
150150
if (!mp_obj_is_integer(int_obj)) {
@@ -178,7 +178,7 @@ MP_DEFINE_CONST_FUN_OBJ_2(microlite_tensor_quantize_float_to_int8, tensor_quanti
178178
MP_DEFINE_CONST_FUN_OBJ_2(microlite_tensor_quantize_int8_to_float, tensor_quantize_int8_to_float);
179179

180180

181-
STATIC void tensor_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
181+
static void tensor_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
182182
// Ignore the kind parameter
183183
(void)kind;
184184

@@ -203,7 +203,7 @@ STATIC void tensor_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kin
203203
// getType - returns the type of the tensor
204204
// quantizeFloatToInt8 - quantizes a float tensor to an int8 tensor
205205
// quantizeInt8ToFloat - quantizes an int8 tensor to a float tensor
206-
STATIC const mp_rom_map_elem_t tensor_locals_dict_table[] = {
206+
static const mp_rom_map_elem_t tensor_locals_dict_table[] = {
207207
{ MP_ROM_QSTR(MP_QSTR_getValue), MP_ROM_PTR(&microlite_tensor_get_value) },
208208
{ MP_ROM_QSTR(MP_QSTR_setValue), MP_ROM_PTR(&microlite_tensor_set_value) },
209209
{ MP_ROM_QSTR(MP_QSTR_getType), MP_ROM_PTR(&microlite_tensor_get_tensor_type) },
@@ -212,10 +212,10 @@ STATIC const mp_rom_map_elem_t tensor_locals_dict_table[] = {
212212
};
213213

214214

215-
STATIC MP_DEFINE_CONST_DICT(tensor_locals_dict, tensor_locals_dict_table);
215+
static MP_DEFINE_CONST_DICT(tensor_locals_dict, tensor_locals_dict_table);
216216

217217

218-
STATIC MP_DEFINE_CONST_OBJ_TYPE(
218+
static MP_DEFINE_CONST_OBJ_TYPE(
219219
microlite_tensor_type,
220220
MP_QSTR_tensor,
221221
MP_TYPE_FLAG_NONE,
@@ -226,10 +226,10 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
226226

227227
// Interpreter Object ================================================
228228

229-
STATIC const mp_obj_type_t microlite_interpreter_type;
229+
static const mp_obj_type_t microlite_interpreter_type;
230230

231231

232-
STATIC mp_obj_t interpreter_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
232+
static mp_obj_t interpreter_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
233233
// Args:
234234
// - model
235235
// - size of the tensor arena
@@ -294,7 +294,7 @@ STATIC mp_obj_t interpreter_make_new(const mp_obj_type_t *type, size_t n_args, s
294294
}
295295

296296

297-
STATIC mp_obj_t interpreter_invoke(mp_obj_t self_in) {
297+
static mp_obj_t interpreter_invoke(mp_obj_t self_in) {
298298

299299
// Get the interpreter object
300300
microlite_interpreter_obj_t *self = MP_OBJ_TO_PTR(self_in);
@@ -310,7 +310,7 @@ STATIC mp_obj_t interpreter_invoke(mp_obj_t self_in) {
310310
}
311311

312312

313-
STATIC mp_obj_t interpreter_get_input_tensor(mp_obj_t self_in, mp_obj_t index_obj) {
313+
static mp_obj_t interpreter_get_input_tensor(mp_obj_t self_in, mp_obj_t index_obj) {
314314

315315
// Convert the index to an unsigned integer
316316
mp_uint_t index = mp_obj_int_get_uint_checked(index_obj);
@@ -336,7 +336,7 @@ STATIC mp_obj_t interpreter_get_input_tensor(mp_obj_t self_in, mp_obj_t index_ob
336336
}
337337

338338

339-
STATIC mp_obj_t interpreter_get_output_tensor(mp_obj_t self_in, mp_obj_t index_obj) {
339+
static mp_obj_t interpreter_get_output_tensor(mp_obj_t self_in, mp_obj_t index_obj) {
340340
// Convert the index to an unsigned integer
341341
mp_uint_t index = mp_obj_int_get_uint_checked(index_obj);
342342

@@ -366,7 +366,7 @@ MP_DEFINE_CONST_FUN_OBJ_2(microlite_interpreter_get_input_tensor, interpreter_ge
366366
MP_DEFINE_CONST_FUN_OBJ_2(microlite_interpreter_get_output_tensor, interpreter_get_output_tensor);
367367

368368

369-
STATIC void interpreter_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
369+
static void interpreter_print(const mp_print_t *print, mp_obj_t self_in, mp_print_kind_t kind) {
370370
// Ignore the kind parameter
371371
(void)kind;
372372

@@ -389,17 +389,17 @@ STATIC void interpreter_print(const mp_print_t *print, mp_obj_t self_in, mp_prin
389389
// Invoke - Invokes the interpreter
390390
// getInputTensor - Returns the input tensor
391391
// getOutputTensor - Returns the output tensor
392-
STATIC const mp_rom_map_elem_t interpreter_locals_dict_table[] = {
392+
static const mp_rom_map_elem_t interpreter_locals_dict_table[] = {
393393
{ MP_ROM_QSTR(MP_QSTR_invoke), MP_ROM_PTR(&microlite_interpreter_invoke) },
394394
{ MP_ROM_QSTR(MP_QSTR_getInputTensor), MP_ROM_PTR(&microlite_interpreter_get_input_tensor) },
395395
{ MP_ROM_QSTR(MP_QSTR_getOutputTensor), MP_ROM_PTR(&microlite_interpreter_get_output_tensor) },
396396
};
397397

398398

399-
STATIC MP_DEFINE_CONST_DICT(interpreter_locals_dict, interpreter_locals_dict_table);
399+
static MP_DEFINE_CONST_DICT(interpreter_locals_dict, interpreter_locals_dict_table);
400400

401401

402-
STATIC MP_DEFINE_CONST_OBJ_TYPE(
402+
static MP_DEFINE_CONST_OBJ_TYPE(
403403
microlite_interpreter_type,
404404
MP_QSTR_interpreter,
405405
MP_TYPE_FLAG_NONE,
@@ -412,10 +412,10 @@ STATIC MP_DEFINE_CONST_OBJ_TYPE(
412412

413413

414414
// The microlite __version__ string
415-
STATIC const MP_DEFINE_STR_OBJ(microlite_version_string_obj, TFLITE_MICRO_VERSION);
415+
static const MP_DEFINE_STR_OBJ(microlite_version_string_obj, TFLITE_MICRO_VERSION);
416416

417417

418-
STATIC const mp_rom_map_elem_t microlite_module_globals_table[] = {
418+
static const mp_rom_map_elem_t microlite_module_globals_table[] = {
419419
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_microlite) },
420420
{ MP_ROM_QSTR(MP_QSTR___version__), MP_ROM_PTR(&microlite_version_string_obj) },
421421

@@ -424,7 +424,7 @@ STATIC const mp_rom_map_elem_t microlite_module_globals_table[] = {
424424
};
425425

426426

427-
STATIC MP_DEFINE_CONST_DICT(microlite_module_globals, microlite_module_globals_table);
427+
static MP_DEFINE_CONST_DICT(microlite_module_globals, microlite_module_globals_table);
428428

429429

430430
// Module Object ================================================

0 commit comments

Comments
 (0)