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
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
a9a732af
Commit
a9a732af
authored
9 years ago
by
Damien George
Browse files
Options
Downloads
Patches
Plain Diff
esp8266: Remove pin_id field from C pin object.
This field is the same as phys_port and not needed.
parent
44ab5c3e
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
esp8266/modpyb.h
+1
-2
1 addition, 2 deletions
esp8266/modpyb.h
esp8266/modpybpin.c
+15
-15
15 additions, 15 deletions
esp8266/modpybpin.c
esp8266/modpybpwm.c
+1
-1
1 addition, 1 deletion
esp8266/modpybpwm.c
with
17 additions
and
18 deletions
esp8266/modpyb.h
+
1
−
2
View file @
a9a732af
...
...
@@ -13,10 +13,9 @@ extern const mp_obj_type_t pyb_spi_type;
typedef
struct
_pyb_pin_obj_t
{
mp_obj_base_t
base
;
uint16_t
pin_id
;
uint16_t
phys_port
;
uint32_t
periph
;
uint16_t
func
;
uint32_t
periph
;
}
pyb_pin_obj_t
;
uint
mp_obj_get_pin
(
mp_obj_t
pin_in
);
...
...
This diff is collapsed.
Click to expand it.
esp8266/modpybpin.c
+
15
−
15
View file @
a9a732af
...
...
@@ -45,21 +45,21 @@
//#define GPIO_PULL_DOWN (2)
STATIC
const
pyb_pin_obj_t
pyb_pin_obj
[]
=
{
{{
&
pyb_pin_type
},
0
,
0
,
PERIPHS_IO_MUX_GPIO0_U
,
FUNC_GPIO0
},
{{
&
pyb_pin_type
},
1
,
1
,
PERIPHS_IO_MUX_U0TXD_U
,
FUNC_GPIO1
},
{{
&
pyb_pin_type
},
2
,
2
,
PERIPHS_IO_MUX_GPIO2_U
,
FUNC_GPIO2
},
{{
&
pyb_pin_type
},
3
,
3
,
PERIPHS_IO_MUX_U0RXD_U
,
FUNC_GPIO3
},
{{
&
pyb_pin_type
},
4
,
4
,
PERIPHS_IO_MUX_GPIO4_U
,
FUNC_GPIO4
},
{{
&
pyb_pin_type
},
5
,
5
,
PERIPHS_IO_MUX_GPIO5_U
,
FUNC_GPIO5
},
{{
&
pyb_pin_type
},
9
,
9
,
PERIPHS_IO_MUX_SD_DATA2_U
,
FUNC_GPIO9
},
{{
&
pyb_pin_type
},
10
,
10
,
PERIPHS_IO_MUX_SD_DATA3_U
,
FUNC_GPIO10
},
{{
&
pyb_pin_type
},
12
,
12
,
PERIPHS_IO_MUX_MTDI_U
,
FUNC_GPIO12
},
{{
&
pyb_pin_type
},
13
,
13
,
PERIPHS_IO_MUX_MTCK_U
,
FUNC_GPIO13
},
{{
&
pyb_pin_type
},
14
,
14
,
PERIPHS_IO_MUX_MTMS_U
,
FUNC_GPIO14
},
{{
&
pyb_pin_type
},
15
,
15
,
PERIPHS_IO_MUX_MTDO_U
,
FUNC_GPIO15
},
{{
&
pyb_pin_type
},
0
,
FUNC_GPIO
0
,
PERIPHS_IO_MUX_GPIO0_U
},
{{
&
pyb_pin_type
},
1
,
FUNC_GPIO
1
,
PERIPHS_IO_MUX_U0TXD_U
},
{{
&
pyb_pin_type
},
2
,
FUNC_GPIO
2
,
PERIPHS_IO_MUX_GPIO2_U
},
{{
&
pyb_pin_type
},
3
,
FUNC_GPIO
3
,
PERIPHS_IO_MUX_U0RXD_U
},
{{
&
pyb_pin_type
},
4
,
FUNC_GPIO
4
,
PERIPHS_IO_MUX_GPIO4_U
},
{{
&
pyb_pin_type
},
5
,
FUNC_GPIO
5
,
PERIPHS_IO_MUX_GPIO5_U
},
{{
&
pyb_pin_type
},
9
,
FUNC_GPIO
9
,
PERIPHS_IO_MUX_SD_DATA2_U
},
{{
&
pyb_pin_type
},
10
,
FUNC_GPIO
10
,
PERIPHS_IO_MUX_SD_DATA3_U
},
{{
&
pyb_pin_type
},
12
,
FUNC_GPIO
12
,
PERIPHS_IO_MUX_MTDI_U
},
{{
&
pyb_pin_type
},
13
,
FUNC_GPIO
13
,
PERIPHS_IO_MUX_MTCK_U
},
{{
&
pyb_pin_type
},
14
,
FUNC_GPIO
14
,
PERIPHS_IO_MUX_MTMS_U
},
{{
&
pyb_pin_type
},
15
,
FUNC_GPIO
15
,
PERIPHS_IO_MUX_MTDO_U
},
// GPIO16 is special, belongs to different register set, and
// otherwise handled specially.
{{
&
pyb_pin_type
},
16
,
16
,
-
1
,
-
1
},
{{
&
pyb_pin_type
},
16
,
-
1
,
-
1
},
};
STATIC
uint8_t
pin_mode
[
16
+
1
];
...
...
@@ -130,7 +130,7 @@ STATIC void pyb_pin_print(const mp_print_t *print, mp_obj_t self_in, mp_print_ki
pyb_pin_obj_t
*
self
=
self_in
;
// pin name
mp_printf
(
print
,
"Pin(%u)"
,
self
->
p
in_id
);
mp_printf
(
print
,
"Pin(%u)"
,
self
->
p
hys_port
);
}
// pin.init(mode, pull=Pin.PULL_NONE, af=-1)
...
...
@@ -202,7 +202,7 @@ STATIC mp_obj_t pyb_pin_make_new(const mp_obj_type_t *type, mp_uint_t n_args, mp
int
wanted_pin
=
mp_obj_get_int
(
args
[
0
]);
pyb_pin_obj_t
*
pin
=
NULL
;
for
(
int
i
=
0
;
i
<
MP_ARRAY_SIZE
(
pyb_pin_obj
);
i
++
)
{
if
(
pyb_pin_obj
[
i
].
p
in_id
==
wanted_pin
)
{
if
(
pyb_pin_obj
[
i
].
p
hys_port
==
wanted_pin
)
{
pin
=
(
pyb_pin_obj_t
*
)
&
pyb_pin_obj
[
i
];
break
;
}
...
...
This diff is collapsed.
Click to expand it.
esp8266/modpybpwm.c
+
1
−
1
View file @
a9a732af
...
...
@@ -47,7 +47,7 @@ STATIC bool pwm_inited = false;
STATIC
void
pyb_pwm_print
(
const
mp_print_t
*
print
,
mp_obj_t
self_in
,
mp_print_kind_t
kind
)
{
pyb_pwm_obj_t
*
self
=
MP_OBJ_TO_PTR
(
self_in
);
mp_printf
(
print
,
"PWM(%u"
,
self
->
pin
->
p
in_id
);
mp_printf
(
print
,
"PWM(%u"
,
self
->
pin
->
p
hys_port
);
if
(
self
->
active
)
{
mp_printf
(
print
,
", freq=%u, duty=%u"
,
pwm_get_freq
(
self
->
channel
),
pwm_get_duty
(
self
->
channel
));
...
...
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