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
a31b7c10
Commit
a31b7c10
authored
1 year ago
by
recallmenot
Browse files
Options
Downloads
Patches
Plain Diff
SPI lib: fixed bugs discovered by JKT
parent
c788f9ae
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
extralibs/ch32v003_SPI.h
+7
-7
7 additions, 7 deletions
extralibs/ch32v003_SPI.h
with
7 additions
and
7 deletions
extralibs/ch32v003_SPI.h
+
7
−
7
View file @
a31b7c10
...
...
@@ -75,7 +75,7 @@ static inline void SPI_write_16(uint16_t data);
// send a command and get a response from the SPI device
// you'll use this for most devices
static
inline
uint8_t
SPI_transfer_8
(
uint8_t
data
);
static
inline
uint
8
_t
SPI_transfer_16
(
uint16_t
data
);
static
inline
uint
16
_t
SPI_transfer_16
(
uint16_t
data
);
// SPI peripheral power enable / disable (default off, init() automatically enables)
// send SPI peripheral to sleep
...
...
@@ -238,15 +238,15 @@ static inline void SPI_init() {
}
static
inline
void
SPI_begin_8
()
{
SPI1
->
CTLR1
|
=
SPI_
DataSize_8b
;
// DFF 16bit data-length enable, writable only when SPE is 0
SPI1
->
CTLR1
|=
CTLR1_SPE
_Set
;
SPI1
->
CTLR1
&
=
~
(
SPI_
CTLR1_DFF
);
// DFF 16bit data-length enable, writable only when SPE is 0
SPI1
->
CTLR1
|=
SPI_
CTLR1_SPE
;
}
static
inline
void
SPI_begin_16
()
{
SPI1
->
CTLR1
|=
SPI_
DataSize_16b
;
// DFF 16bit data-length enable, writable only when SPE is 0
SPI1
->
CTLR1
|=
CTLR1_SPE
_Set
;
SPI1
->
CTLR1
|=
SPI_
CTLR1_DFF
;
// DFF 16bit data-length enable, writable only when SPE is 0
SPI1
->
CTLR1
|=
SPI_
CTLR1_SPE
;
}
static
inline
void
SPI_end
()
{
SPI1
->
CTLR1
&=
CTLR1_SPE
_Reset
;
SPI1
->
CTLR1
&=
~
(
SPI_
CTLR1_SPE
)
;
}
#if defined(CH32V003_SPI_NSS_SOFTWARE_PC3)
...
...
@@ -290,7 +290,7 @@ static inline uint8_t SPI_transfer_8(uint8_t data) {
#endif
return
SPI_read_8
();
}
static
inline
uint
8
_t
SPI_transfer_16
(
uint16_t
data
)
{
static
inline
uint
16
_t
SPI_transfer_16
(
uint16_t
data
)
{
#if defined(CH32V003_SPI_NSS_SOFTWARE_PC3) || defined(CH32V003_SPI_NSS_SOFTWARE_PC4)
SPI_NSS_software_high
();
#endif
...
...
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