Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
ch32v003fun
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
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Andreas Horn
ch32v003fun
Commits
bc77939d
Unverified
Commit
bc77939d
authored
1 year ago
by
prosper00
Committed by
GitHub
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Update wiring.c
parent
6b94eca6
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/GPIO_analogRead/wiring.c
+3
-15
3 additions, 15 deletions
examples/GPIO_analogRead/wiring.c
with
3 additions
and
15 deletions
examples/GPIO_analogRead/wiring.c
+
3
−
15
View file @
bc77939d
...
...
@@ -6,12 +6,9 @@
enum
GPIOports
getPort
(
enum
GPIOpins
pin
)
{
if
(
pin
<=
pin_A
7
)
{
if
(
pin
<=
pin_A
2
)
{
return
port_A
;
}
else
if
(
pin
<=
pin_B7
)
{
return
port_B
;
}
else
if
(
pin
<=
pin_C7
)
{
return
port_C
;
}
...
...
@@ -29,8 +26,6 @@ void portEnable(enum GPIOports port) {
case
port_A
:
RCC
->
APB2PCENR
|=
RCC_APB2Periph_GPIOA
;
break
;
case
port_B
:
break
;
case
port_C
:
RCC
->
APB2PCENR
|=
RCC_APB2Periph_GPIOC
;
break
;
...
...
@@ -43,6 +38,7 @@ void portEnable(enum GPIOports port) {
}
void
pinMode
(
enum
GPIOpins
pin
,
enum
GPIOpinMode
mode
)
{
GPIO_TypeDef
*
GPIOx
;
uint16_t
PinOffset
;
...
...
@@ -54,7 +50,7 @@ void pinMode(enum GPIOpins pin, enum GPIOpinMode mode) {
uint8_t
target_pin_state
=
pinState_nochange
;
// by default, pin shall retain its state
uint8_t
modeMask
=
0
;
// configuration mask
// configuration mask
uint8_t
modeMask
=
0
;
// configuration mask
switch
(
mode
)
{
case
pinMode_I_floating
:
...
...
@@ -105,10 +101,6 @@ void digitalWrite(enum GPIOpins pin, uint8_t value) {
GPIOx
=
GPIOA
;
PinOffset
=
pin
;
}
else
if
(
pin
<=
pin_B7
)
{
/* GPIOB doesn't exist (yet?)
GPIOx = GPIOB;
PinOffset = (pin - 8); */
}
else
if
(
pin
<=
pin_C7
)
{
GPIOx
=
GPIOC
;
PinOffset
=
(
pin
-
16
);
...
...
@@ -139,10 +131,6 @@ uint8_t digitalRead(uint8_t pin) {
GPIOx
=
GPIOA
;
PinOffset
=
pin
;
}
else
if
(
pin
<=
pin_B7
)
{
/* GPIOB doesn't exist (yet?)
GPIOx = GPIOB;
PinOffset = (pin - 8); */
}
else
if
(
pin
<=
pin_C7
)
{
GPIOx
=
GPIOC
;
PinOffset
=
(
pin
-
16
);
...
...
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