aboutsummaryrefslogtreecommitdiff
path: root/stm/pybwlan.c
diff options
context:
space:
mode:
authorDamien George2014-01-03 00:10:22 +0000
committerDamien George2014-01-03 00:10:22 +0000
commitaae7847508e2a9555ad3276c5cd4f42b2e66686c (patch)
tree9a33d436e9eacffdd518c96617651f9f3aef7d8c /stm/pybwlan.c
parent2870862601c7f4957d2710f8e7247de002cf67c4 (diff)
Change old use of module creation to new proper use.
Diffstat (limited to 'stm/pybwlan.c')
-rw-r--r--stm/pybwlan.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/stm/pybwlan.c b/stm/pybwlan.c
index 73aa8273f..6341d0676 100644
--- a/stm/pybwlan.c
+++ b/stm/pybwlan.c
@@ -20,6 +20,7 @@
#include "parse.h"
#include "compile.h"
#include "obj.h"
+#include "map.h"
#include "runtime.h"
#include "cc3k/ccspi.h"
@@ -74,7 +75,7 @@ mp_obj_t pyb_wlan_get_ip(void) {
return mp_const_none;
}
- mp_obj_t data = mp_module_new(); // TODO should really be a class
+ mp_obj_t data = mp_obj_new_class(mp_map_new(MP_MAP_QSTR, 0)); // TODO should this be an instance of a class?
decode_addr_and_store(data, qstr_from_str_static("ip"), &ipconfig.aucIP[0], 4);
decode_addr_and_store(data, qstr_from_str_static("subnet"), &ipconfig.aucSubnetMask[0], 4);
decode_addr_and_store(data, qstr_from_str_static("gateway"), &ipconfig.aucDefaultGateway[0], 4);
@@ -345,7 +346,7 @@ void pyb_wlan_init(void) {
SpiInit();
wlan_init(CC3000_UsynchCallback, sendWLFWPatch, sendDriverPatch, sendBootLoaderPatch, ReadWlanInterruptPin, WlanInterruptEnable, WlanInterruptDisable, WriteWlanPin);
- mp_obj_t m = mp_module_new();
+ mp_obj_t m = mp_obj_new_module(qstr_from_str_static("wlan"));
rt_store_attr(m, qstr_from_str_static("connect"), rt_make_function_var(0, pyb_wlan_connect));
rt_store_attr(m, qstr_from_str_static("disconnect"), rt_make_function_0(pyb_wlan_disconnect));
rt_store_attr(m, qstr_from_str_static("ip"), rt_make_function_0(pyb_wlan_get_ip));