Skip to content

Commit 6b66d9e

Browse files
authored
Merge pull request #77 from SummerGGift/optimize_code
【完善】修复一些警告提示信息
2 parents 6715862 + fac45d4 commit 6b66d9e

File tree

2 files changed

+0
-20
lines changed

2 files changed

+0
-20
lines changed

port/machine_hw_spi.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,6 @@ STATIC void machine_hard_spi_init(mp_obj_base_t *self_in, size_t n_args, const m
114114
}
115115
}
116116

117-
STATIC void machine_hard_spi_deinit(mp_obj_base_t *self_in) {
118-
return;
119-
}
120-
121117
STATIC void machine_hard_spi_transfer(mp_obj_base_t *self_in, size_t len, const uint8_t *src, uint8_t *dest) {
122118
machine_hard_spi_obj_t *self = (machine_hard_spi_obj_t*)self_in;
123119

port/machine_lcd.c

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ STATIC void error_check(bool status, const char *msg) {
5151
///
5252
/// Construct an LCD object.
5353
STATIC mp_obj_t machine_lcd_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) {
54-
5554
// check arguments
5655
mp_arg_check_num(n_args, n_kw, 0, 0, false);
5756

@@ -66,7 +65,6 @@ STATIC mp_obj_t machine_lcd_make_new(const mp_obj_type_t *type, size_t n_args, s
6665
///
6766
/// Turn the backlight on/off. True or 1 turns it on, False or 0 turns it off.
6867
STATIC mp_obj_t machine_lcd_light(mp_obj_t self_in, mp_obj_t value) {
69-
machine_lcd_obj_t *self = MP_OBJ_TO_PTR(self_in);
7068
if (mp_obj_is_true(value)) {
7169
lcd_display_on(); // set pin high to turn backlight on
7270
} else {
@@ -81,8 +79,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(machine_lcd_light_obj, machine_lcd_light);
8179
/// Fill the screen with the given colour.
8280
///
8381
STATIC mp_obj_t machine_lcd_fill(mp_obj_t self_in, mp_obj_t col_in) {
84-
machine_lcd_obj_t *self = MP_OBJ_TO_PTR(self_in);
85-
8682
int col = mp_obj_get_int(col_in);
8783
lcd_clear(col);
8884

@@ -95,7 +91,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_2(machine_lcd_fill_obj, machine_lcd_fill);
9591
/// Set the pixel at `(x, y)` to the given colour.
9692
///
9793
STATIC mp_obj_t machine_lcd_pixel(size_t n_args, const mp_obj_t *args) {
98-
machine_lcd_obj_t *self = MP_OBJ_TO_PTR(args[0]);
9994
int x = mp_obj_get_int(args[1]);
10095
int y = mp_obj_get_int(args[2]);
10196

@@ -113,8 +108,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_lcd_pixel_obj, 4, 4, machine_
113108
/// Draw the given text to the position `(x, y)` using the given size (16 24 32).
114109
///
115110
STATIC mp_obj_t machine_lcd_text(size_t n_args, const mp_obj_t *args) {
116-
// extract arguments
117-
machine_lcd_obj_t *self = MP_OBJ_TO_PTR(args[0]);
118111
size_t len;
119112
const char *data = mp_obj_str_get_data(args[1], &len);
120113
int x = mp_obj_get_int(args[2]);
@@ -136,9 +129,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_lcd_text_obj, 5, 5, machine_l
136129
/// display a line on the lcd, from (x1, y1) to (x2, y2).
137130
///
138131
STATIC mp_obj_t machine_lcd_line(size_t n_args, const mp_obj_t *args) {
139-
// extract arguments
140-
machine_lcd_obj_t *self = MP_OBJ_TO_PTR(args[0]);
141-
142132
int x1 = mp_obj_get_int(args[1]);
143133
int y1 = mp_obj_get_int(args[2]);
144134
int x2 = mp_obj_get_int(args[3]);
@@ -157,9 +147,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_lcd_line_obj, 5, 5, machine_l
157147
/// display a rectangle on the lcd, from (x1, y1) to (x2, y2).
158148
///
159149
STATIC mp_obj_t machine_lcd_rectangle(size_t n_args, const mp_obj_t *args) {
160-
// extract arguments
161-
machine_lcd_obj_t *self = MP_OBJ_TO_PTR(args[0]);
162-
163150
int x1 = mp_obj_get_int(args[1]);
164151
int y1 = mp_obj_get_int(args[2]);
165152
int x2 = mp_obj_get_int(args[3]);
@@ -178,9 +165,6 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_lcd_rectangle_obj, 5, 5, mach
178165
/// display a circle on the lcd, center(x1, y1) R = r.
179166
///
180167
STATIC mp_obj_t machine_lcd_circle(size_t n_args, const mp_obj_t *args) {
181-
// extract arguments
182-
machine_lcd_obj_t *self = MP_OBJ_TO_PTR(args[0]);
183-
184168
int x1 = mp_obj_get_int(args[1]);
185169
int y1 = mp_obj_get_int(args[2]);
186170
int r = mp_obj_get_int(args[3]);

0 commit comments

Comments
 (0)