Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
micropython
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
card10
micropython
Commits
aae78475
Commit
aae78475
authored
11 years ago
by
Damien George
Browse files
Options
Downloads
Patches
Plain Diff
Change old use of module creation to new proper use.
parent
28708626
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
py/objclass.c
+0
-6
0 additions, 6 deletions
py/objclass.c
stm/Makefile
+11
-0
11 additions, 0 deletions
stm/Makefile
stm/audio.c
+1
-1
1 addition, 1 deletion
stm/audio.c
stm/lcd.c
+1
-1
1 addition, 1 deletion
stm/lcd.c
stm/pybwlan.c
+3
-2
3 additions, 2 deletions
stm/pybwlan.c
stm/timer.c
+1
-1
1 addition, 1 deletion
stm/timer.c
with
17 additions
and
11 deletions
py/objclass.c
+
0
−
6
View file @
aae78475
...
@@ -77,9 +77,3 @@ mp_obj_t mp_obj_new_class(mp_map_t *class_locals) {
...
@@ -77,9 +77,3 @@ mp_obj_t mp_obj_new_class(mp_map_t *class_locals) {
o
->
locals
=
class_locals
;
o
->
locals
=
class_locals
;
return
o
;
return
o
;
}
}
// temporary way of making C modules
// hack: use class to mimic a module
mp_obj_t
mp_module_new
(
void
)
{
return
mp_obj_new_class
(
mp_map_new
(
MP_MAP_QSTR
,
0
));
}
This diff is collapsed.
Click to expand it.
stm/Makefile
+
11
−
0
View file @
aae78475
STMSRC
=
lib
STMSRC
=
lib
#STMOTGSRC=lib-otg
FATFSSRC
=
fatfs
FATFSSRC
=
fatfs
CC3KSRC
=
cc3k
CC3KSRC
=
cc3k
PYSRC
=
../py
PYSRC
=
../py
...
@@ -10,6 +11,7 @@ CC = arm-none-eabi-gcc
...
@@ -10,6 +11,7 @@ CC = arm-none-eabi-gcc
LD
=
arm-none-eabi-ld
LD
=
arm-none-eabi-ld
CFLAGS_CORTEX_M4
=
-mthumb
-mtune
=
cortex-m4
-mabi
=
aapcs-linux
-mcpu
=
cortex-m4
-mfpu
=
fpv4-sp-d16
-mfloat-abi
=
hard
-fsingle-precision-constant
-Wdouble-promotion
-DSTM32F40XX
-DHSE_VALUE
=
8000000
CFLAGS_CORTEX_M4
=
-mthumb
-mtune
=
cortex-m4
-mabi
=
aapcs-linux
-mcpu
=
cortex-m4
-mfpu
=
fpv4-sp-d16
-mfloat-abi
=
hard
-fsingle-precision-constant
-Wdouble-promotion
-DSTM32F40XX
-DHSE_VALUE
=
8000000
CFLAGS
=
-I
.
-I
$(
PYSRC
)
-I
$(
FATFSSRC
)
-I
$(
STMSRC
)
-Wall
-ansi
-std
=
gnu99
-Os
-DNDEBUG
$(
CFLAGS_CORTEX_M4
)
CFLAGS
=
-I
.
-I
$(
PYSRC
)
-I
$(
FATFSSRC
)
-I
$(
STMSRC
)
-Wall
-ansi
-std
=
gnu99
-Os
-DNDEBUG
$(
CFLAGS_CORTEX_M4
)
#CFLAGS += -I$(STMOTGSRC) -DUSE_HOST_MODE -DUSE_OTG_MODE
LDFLAGS
=
--nostdlib
-T
stm32f405.ld
LDFLAGS
=
--nostdlib
-T
stm32f405.ld
SRC_C
=
\
SRC_C
=
\
...
@@ -122,6 +124,11 @@ SRC_STM = \
...
@@ -122,6 +124,11 @@ SRC_STM = \
stm324x7i_eval.c
\
stm324x7i_eval.c
\
stm324x7i_eval_sdio_sd.c
\
stm324x7i_eval_sdio_sd.c
\
#SRC_STM_OTG = \
# usb_hcd.c \
# usb_hcd_int.c \
# usb_otg.c \
SRC_CC3K
=
\
SRC_CC3K
=
\
cc3000_common.c
\
cc3000_common.c
\
evnt_handler.c
\
evnt_handler.c
\
...
@@ -135,6 +142,7 @@ SRC_CC3K = \
...
@@ -135,6 +142,7 @@ SRC_CC3K = \
pybcc3k.c
\
pybcc3k.c
\
OBJ
=
$(
addprefix
$(
BUILD
)
/,
$(
SRC_C:.c
=
.o
)
$(
SRC_S:.s
=
.o
)
$(
PY_O
)
$(
SRC_FATFS:.c
=
.o
)
$(
SRC_STM:.c
=
.o
)
$(
SRC_CC3K:.c
=
.o
))
OBJ
=
$(
addprefix
$(
BUILD
)
/,
$(
SRC_C:.c
=
.o
)
$(
SRC_S:.s
=
.o
)
$(
PY_O
)
$(
SRC_FATFS:.c
=
.o
)
$(
SRC_STM:.c
=
.o
)
$(
SRC_CC3K:.c
=
.o
))
#OBJ += $(addprefix $(BUILD)/, $(SRC_STM_OTG:.c=.o))
all
:
$(BUILD) $(BUILD)/flash.dfu
all
:
$(BUILD) $(BUILD)/flash.dfu
...
@@ -166,6 +174,9 @@ $(BUILD)/%.o: $(FATFSSRC)/%.c
...
@@ -166,6 +174,9 @@ $(BUILD)/%.o: $(FATFSSRC)/%.c
$(BUILD)/%.o
:
$(STMSRC)/%.c
$(BUILD)/%.o
:
$(STMSRC)/%.c
$(
CC
)
$(
CFLAGS
)
-c
-o
$@
$<
$(
CC
)
$(
CFLAGS
)
-c
-o
$@
$<
#$(BUILD)/%.o: $(STMOTGSRC)/%.c
# $(CC) $(CFLAGS) -c -o $@ $<
$(BUILD)/%.o
:
$(CC3KSRC)/%.c
$(BUILD)/%.o
:
$(CC3KSRC)/%.c
$(
CC
)
$(
CFLAGS
)
-c
-o
$@
$<
$(
CC
)
$(
CFLAGS
)
-c
-o
$@
$<
...
...
This diff is collapsed.
Click to expand it.
stm/audio.c
+
1
−
1
View file @
aae78475
...
@@ -91,7 +91,7 @@ void audio_init(void) {
...
@@ -91,7 +91,7 @@ void audio_init(void) {
// enable interrupt
// enable interrupt
// Python interface
// Python interface
mp_obj_t
m
=
mp_
module_new
(
);
mp_obj_t
m
=
mp_
obj_new_module
(
qstr_from_str_static
(
"audio"
)
);
rt_store_attr
(
m
,
qstr_from_str_static
(
"dac"
),
rt_make_function_1
(
pyb_audio_dac
));
rt_store_attr
(
m
,
qstr_from_str_static
(
"dac"
),
rt_make_function_1
(
pyb_audio_dac
));
rt_store_attr
(
m
,
qstr_from_str_static
(
"is_full"
),
rt_make_function_0
(
pyb_audio_is_full
));
rt_store_attr
(
m
,
qstr_from_str_static
(
"is_full"
),
rt_make_function_0
(
pyb_audio_is_full
));
rt_store_attr
(
m
,
qstr_from_str_static
(
"fill"
),
rt_make_function_1
(
pyb_audio_fill
));
rt_store_attr
(
m
,
qstr_from_str_static
(
"fill"
),
rt_make_function_1
(
pyb_audio_fill
));
...
...
This diff is collapsed.
Click to expand it.
stm/lcd.c
+
1
−
1
View file @
aae78475
...
@@ -220,7 +220,7 @@ void lcd_init(void) {
...
@@ -220,7 +220,7 @@ void lcd_init(void) {
lcd_next_line
=
0
;
lcd_next_line
=
0
;
// Python interface
// Python interface
mp_obj_t
m
=
mp_
module_new
(
);
mp_obj_t
m
=
mp_
obj_new_module
(
qstr_from_str_static
(
"lcd"
)
);
rt_store_attr
(
m
,
qstr_from_str_static
(
"lcd8"
),
rt_make_function_2
(
lcd_draw_pixel_8
));
rt_store_attr
(
m
,
qstr_from_str_static
(
"lcd8"
),
rt_make_function_2
(
lcd_draw_pixel_8
));
rt_store_attr
(
m
,
qstr_from_str_static
(
"clear"
),
rt_make_function_0
(
lcd_pix_clear
));
rt_store_attr
(
m
,
qstr_from_str_static
(
"clear"
),
rt_make_function_0
(
lcd_pix_clear
));
rt_store_attr
(
m
,
qstr_from_str_static
(
"get"
),
rt_make_function_2
(
lcd_pix_get
));
rt_store_attr
(
m
,
qstr_from_str_static
(
"get"
),
rt_make_function_2
(
lcd_pix_get
));
...
...
This diff is collapsed.
Click to expand it.
stm/pybwlan.c
+
3
−
2
View file @
aae78475
...
@@ -20,6 +20,7 @@
...
@@ -20,6 +20,7 @@
#include
"parse.h"
#include
"parse.h"
#include
"compile.h"
#include
"compile.h"
#include
"obj.h"
#include
"obj.h"
#include
"map.h"
#include
"runtime.h"
#include
"runtime.h"
#include
"cc3k/ccspi.h"
#include
"cc3k/ccspi.h"
...
@@ -74,7 +75,7 @@ mp_obj_t pyb_wlan_get_ip(void) {
...
@@ -74,7 +75,7 @@ mp_obj_t pyb_wlan_get_ip(void) {
return
mp_const_none
;
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
(
"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
(
"subnet"
),
&
ipconfig
.
aucSubnetMask
[
0
],
4
);
decode_addr_and_store
(
data
,
qstr_from_str_static
(
"gateway"
),
&
ipconfig
.
aucDefaultGateway
[
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) {
...
@@ -345,7 +346,7 @@ void pyb_wlan_init(void) {
SpiInit
();
SpiInit
();
wlan_init
(
CC3000_UsynchCallback
,
sendWLFWPatch
,
sendDriverPatch
,
sendBootLoaderPatch
,
ReadWlanInterruptPin
,
WlanInterruptEnable
,
WlanInterruptDisable
,
WriteWlanPin
);
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
(
"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
(
"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
));
rt_store_attr
(
m
,
qstr_from_str_static
(
"ip"
),
rt_make_function_0
(
pyb_wlan_get_ip
));
...
...
This diff is collapsed.
Click to expand it.
stm/timer.c
+
1
−
1
View file @
aae78475
...
@@ -72,7 +72,7 @@ void timer_init(void) {
...
@@ -72,7 +72,7 @@ void timer_init(void) {
TIM_Cmd
(
TIM6
,
ENABLE
);
TIM_Cmd
(
TIM6
,
ENABLE
);
// Python interface
// Python interface
mp_obj_t
m
=
mp_
module_new
(
);
mp_obj_t
m
=
mp_
obj_new_module
(
qstr_from_str_static
(
"timer"
)
);
rt_store_attr
(
m
,
qstr_from_str_static
(
"callback"
),
rt_make_function_1
(
timer_py_set_callback
));
rt_store_attr
(
m
,
qstr_from_str_static
(
"callback"
),
rt_make_function_1
(
timer_py_set_callback
));
rt_store_attr
(
m
,
qstr_from_str_static
(
"period"
),
rt_make_function_1
(
timer_py_set_period
));
rt_store_attr
(
m
,
qstr_from_str_static
(
"period"
),
rt_make_function_1
(
timer_py_set_period
));
rt_store_attr
(
m
,
qstr_from_str_static
(
"prescaler"
),
rt_make_function_1
(
timer_py_set_prescaler
));
rt_store_attr
(
m
,
qstr_from_str_static
(
"prescaler"
),
rt_make_function_1
(
timer_py_set_prescaler
));
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment