From de37775a265b40e0bd0e7e93265c01a5650fa699 Mon Sep 17 00:00:00 2001 From: Damien George Date: Tue, 30 Sep 2014 23:43:38 +0100 Subject: [PATCH] stmhal: Enable patch_program in cc3k driver, with key. --- stmhal/Makefile | 5 ++--- stmhal/modcc3k.c | 11 ++++++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/stmhal/Makefile b/stmhal/Makefile index ba844d97cc..21e09666b9 100644 --- a/stmhal/Makefile +++ b/stmhal/Makefile @@ -218,9 +218,8 @@ SRC_MOD += $(addprefix $(CC3000_DIR)/src/,\ ccspi.c \ inet_ntop.c \ inet_pton.c \ - ) -# patch.c \ -# patch_prog.c \ + patch.c \ + patch_prog.c \ ) endif diff --git a/stmhal/modcc3k.c b/stmhal/modcc3k.c index b3e79a544b..eef0b4c320 100644 --- a/stmhal/modcc3k.c +++ b/stmhal/modcc3k.c @@ -288,11 +288,16 @@ STATIC mp_obj_t cc3k_patch_version(mp_obj_t self_in) { } STATIC MP_DEFINE_CONST_FUN_OBJ_1(cc3k_patch_version_obj, cc3k_patch_version); -STATIC mp_obj_t cc3k_patch_program(mp_obj_t self_in) { - //patch_prog_start(); +STATIC mp_obj_t cc3k_patch_program(mp_obj_t self_in, mp_obj_t key_in) { + const char *key = mp_obj_str_get_str(key_in); + if (key[0] == 'p' && key[1] == 'g' && key[2] == 'm' && key[3] == '\0') { + patch_prog_start(); + } else { + printf("please pass 'pgm' as argument in order to program\n"); + } return mp_const_none; } -STATIC MP_DEFINE_CONST_FUN_OBJ_1(cc3k_patch_program_obj, cc3k_patch_program); +STATIC MP_DEFINE_CONST_FUN_OBJ_2(cc3k_patch_program_obj, cc3k_patch_program); STATIC const mp_map_elem_t cc3k_locals_dict_table[] = { { MP_OBJ_NEW_QSTR(MP_QSTR_connect), (mp_obj_t)&cc3k_connect_obj },