Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitcea5503

Browse files
committed
Fixup warnings from merge about undefined macro values, switch to
VM keyboard exception and switch to FATFS reader.
1 parentdfb61f0 commitcea5503

File tree

13 files changed

+25
-55
lines changed

13 files changed

+25
-55
lines changed

‎atmel-samd/Makefile‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ SRC_C = \
197197
lib/fatfs/ff.c\
198198
lib/fatfs/option/ccsbcs.c\
199199
lib/timeutils/timeutils.c\
200+
lib/utils/interrupt_char.c\
200201
lib/utils/pyexec.c\
201202
lib/utils/pyhelp.c\
202203
lib/utils/stdout_helpers.c\

‎atmel-samd/autoreset.c‎

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,22 @@
2727
#include"autoreset.h"
2828

2929
#include"asf/sam0/drivers/tc/tc_interrupt.h"
30+
#include"lib/utils/interrupt_char.h"
3031
#include"py/mphal.h"
3132

32-
voidmp_keyboard_interrupt(void);
33-
3433
volatileuint32_tautoreset_delay_ms=0;
3534
boolautoreset_enabled= false;
3635
volatileboolreset_next_character= false;
3736

3837
inlinevoidautoreset_tick() {
39-
if (autoreset_delay_ms==0) {
40-
return;
41-
}
42-
if (autoreset_delay_ms==1&&autoreset_enabled&& !reset_next_character) {
43-
mp_keyboard_interrupt();
44-
reset_next_character= true;
45-
}
46-
autoreset_delay_ms--;
38+
if (autoreset_delay_ms==0) {
39+
return;
40+
}
41+
if (autoreset_delay_ms==1&&autoreset_enabled&& !reset_next_character) {
42+
mp_keyboard_interrupt();
43+
reset_next_character= true;
44+
}
45+
autoreset_delay_ms--;
4746
}
4847

4948
voidautoreset_enable() {

‎atmel-samd/main.c‎

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,6 @@ void reset_mp(void) {
125125
mp_obj_list_append(mp_sys_path,MP_OBJ_NEW_QSTR(MP_QSTR__slash_flash));
126126
mp_obj_list_append(mp_sys_path,MP_OBJ_NEW_QSTR(MP_QSTR__slash_flash_slash_lib));
127127
mp_obj_list_init(mp_sys_argv,0);
128-
129-
MP_STATE_PORT(mp_kbd_exception)=mp_obj_new_exception(&mp_type_KeyboardInterrupt);
130128
}
131129

132130
#ifdefEXPRESS_BOARD
@@ -480,16 +478,6 @@ void gc_collect(void) {
480478
gc_collect_end();
481479
}
482480

483-
mp_lexer_t*fat_vfs_lexer_new_from_file(constchar*filename);
484-
mp_lexer_t*mp_lexer_new_from_file(constchar*filename) {
485-
#ifMICROPY_VFS_FAT
486-
returnfat_vfs_lexer_new_from_file(filename);
487-
#else
488-
(void)filename;
489-
returnNULL;
490-
#endif
491-
}
492-
493481
mp_import_stat_tfat_vfs_import_stat(constchar*path);
494482
mp_import_stat_tmp_import_stat(constchar*path) {
495483
#ifMICROPY_VFS_FAT
@@ -500,10 +488,6 @@ mp_import_stat_t mp_import_stat(const char *path) {
500488
#endif
501489
}
502490

503-
voidmp_keyboard_interrupt(void) {
504-
MP_STATE_VM(mp_pending_exception)=MP_STATE_PORT(mp_kbd_exception);
505-
}
506-
507491
voidnlr_jump_fail(void*val) {
508492
}
509493

‎atmel-samd/mpconfigport.h‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,12 @@
8686
#defineMICROPY_USE_INTERNAL_PRINTF (1)
8787
#defineMICROPY_PY_SYS_STDFILES (1)
8888
#defineMICROPY_PY_IO_FILEIO (1)
89+
#defineMICROPY_READER_FATFS (1)
8990
#defineMICROPY_PERSISTENT_CODE_LOAD (1)
9091
#defineMICROPY_PY_BUILTINS_STR_UNICODE (1)
9192

93+
#defineMICROPY_KBD_EXCEPTION (1)
94+
9295
// type definitions for the specific machine
9396

9497
#defineBYTES_PER_WORD (4)
@@ -172,7 +175,6 @@ extern const struct _mp_obj_module_t samd_module;
172175
#defineMICROPY_PORT_ROOT_POINTERS \
173176
const char *readline_hist[8]; \
174177
vstr_t *repl_line; \
175-
mp_obj_t mp_kbd_exception; \
176178
FLASH_ROOT_POINTERS \
177179

178180
booludi_msc_process_trans(void);

‎atmel-samd/mphalport.c‎

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include"asf/sam0/drivers/port/port.h"
99
#include"asf/sam0/drivers/sercom/usart/usart.h"
1010
#include"lib/mp-readline/readline.h"
11+
#include"lib/utils/interrupt_char.h"
1112
#include"py/mphal.h"
1213
#include"py/mpstate.h"
1314
#include"py/smallint.h"
@@ -34,9 +35,6 @@ volatile uint8_t usb_rx_count;
3435

3536
volatileboolmp_cdc_enabled= false;
3637

37-
voidmp_keyboard_interrupt(void);
38-
intinterrupt_char;
39-
4038
externstructusart_moduleusart_instance;
4139

4240
staticvolatileboolmp_msc_enabled= false;
@@ -106,7 +104,7 @@ void usb_rx_notify(void)
106104
// character!
107105
c=udi_cdc_getc();
108106

109-
if (c==interrupt_char) {
107+
if (c==mp_interrupt_char) {
110108
// We consumed a character rather than adding it to the rx
111109
// buffer so undo the modifications we made to count and the
112110
// tail.
@@ -219,14 +217,6 @@ void mp_hal_stdout_tx_strn(const char *str, size_t len) {
219217
#endif
220218
}
221219

222-
externintinterrupt_char;
223-
voidmp_hal_set_interrupt_char(intc) {
224-
if (c!=-1) {
225-
mp_obj_exception_clear_traceback(MP_STATE_PORT(mp_kbd_exception));
226-
}
227-
interrupt_char=c;
228-
}
229-
230220
voidmp_hal_delay_ms(mp_uint_tdelay) {
231221
// If mass storage is enabled measure the time ourselves and run any mass
232222
// storage transactions in the meantime.
@@ -239,7 +229,7 @@ void mp_hal_delay_ms(mp_uint_t delay) {
239229
MICROPY_VM_HOOK_LOOP
240230
#endif
241231
// Check to see if we've been CTRL-Ced by autoreset or the user.
242-
if(MP_STATE_VM(mp_pending_exception)==MP_STATE_PORT(mp_kbd_exception)) {
232+
if(MP_STATE_VM(mp_pending_exception)==MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_kbd_exception))) {
243233
break;
244234
}
245235
duration= (common_hal_time_monotonic()-start_tick);

‎extmod/modframebuf.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ STATIC mp_obj_t framebuf_blit(size_t n_args, const mp_obj_t *args) {
353353
intcx1=x1;
354354
for (intcx0=x0;cx0<x0end;++cx0) {
355355
color=getpixel(source,cx1,y1);
356-
if (color!=key) {
356+
if (key==-1||color!=(uint32_t)key) {
357357
setpixel(self,cx0,y0,color);
358358
}
359359
++cx1;

‎py/asmarm.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ void asm_arm_bcc_label(asm_arm_t *as, int cond, uint label);
122122
voidasm_arm_b_label(asm_arm_t*as,uintlabel);
123123
voidasm_arm_bl_ind(asm_arm_t*as,void*fun_ptr,uintfun_id,uintreg_temp);
124124

125-
#ifGENERIC_ASM_API
125+
#ifdefGENERIC_ASM_API
126126

127127
// The following macros provide a (mostly) arch-independent API to
128128
// generate native code, and are used by the native emitter.

‎py/asmthumb.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ void asm_thumb_b_label(asm_thumb_t *as, uint label); // convenience: picks narro
237237
voidasm_thumb_bcc_label(asm_thumb_t*as,intcc,uintlabel);// convenience: picks narrow or wide branch
238238
voidasm_thumb_bl_ind(asm_thumb_t*as,void*fun_ptr,uintfun_id,uintreg_temp);// convenience
239239

240-
#ifGENERIC_ASM_API
240+
#ifdefGENERIC_ASM_API
241241

242242
// The following macros provide a (mostly) arch-independent API to
243243
// generate native code, and are used by the native emitter.

‎py/asmx64.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ void asm_x64_mov_r64_to_local(asm_x64_t* as, int src_r64, int dest_local_num);
114114
voidasm_x64_mov_local_addr_to_r64(asm_x64_t*as,intlocal_num,intdest_r64);
115115
voidasm_x64_call_ind(asm_x64_t*as,void*ptr,inttemp_r32);
116116

117-
#ifGENERIC_ASM_API
117+
#ifdefGENERIC_ASM_API
118118

119119
// The following macros provide a (mostly) arch-independent API to
120120
// generate native code, and are used by the native emitter.

‎py/asmx86.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ void asm_x86_mov_r32_to_local(asm_x86_t* as, int src_r32, int dest_local_num);
112112
voidasm_x86_mov_local_addr_to_r32(asm_x86_t*as,intlocal_num,intdest_r32);
113113
voidasm_x86_call_ind(asm_x86_t*as,void*ptr,mp_uint_tn_args,inttemp_r32);
114114

115-
#ifGENERIC_ASM_API
115+
#ifdefGENERIC_ASM_API
116116

117117
// The following macros provide a (mostly) arch-independent API to
118118
// generate native code, and are used by the native emitter.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp