Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RIOT
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cm-projects
RIOT
Commits
82796f9a
Commit
82796f9a
authored
9 years ago
by
Victor Arino
Browse files
Options
Downloads
Patches
Plain Diff
cpu/stm32f1: uncrustified spi driver
parent
f753ce78
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
cpu/stm32f1/periph/spi.c
+9
-9
9 additions, 9 deletions
cpu/stm32f1/periph/spi.c
with
9 additions
and
9 deletions
cpu/stm32f1/periph/spi.c
+
9
−
9
View file @
82796f9a
...
...
@@ -55,7 +55,7 @@ int spi_init_master(spi_t dev, spi_conf_t conf, spi_speed_t speed)
uint16_t
br_div
;
uint8_t
bus_div
;
switch
(
dev
)
{
switch
(
dev
)
{
#if SPI_0_EN
case
SPI_0
:
spi
=
SPI_0_DEV
;
...
...
@@ -87,7 +87,7 @@ int spi_init_master(spi_t dev, spi_conf_t conf, spi_speed_t speed)
spi_conf_pins
(
dev
);
/* configure SPI bus speed */
switch
(
speed
)
{
switch
(
speed
)
{
case
SPI_SPEED_10MHZ
:
br_div
=
0x01
+
bus_div
;
/* actual speed: 9MHz */
break
;
...
...
@@ -130,7 +130,7 @@ int spi_conf_pins(spi_t dev)
{
gpio_t
mosi
,
miso
,
clk
;
switch
(
dev
)
{
switch
(
dev
)
{
#if SPI_0_EN
case
SPI_0
:
clk
=
SPI_0_CLK_PIN
;
...
...
@@ -188,7 +188,7 @@ int spi_transfer_byte(spi_t dev, char out, char *in)
SPI_TypeDef
*
spi
;
int
transferred
=
0
;
switch
(
dev
)
{
switch
(
dev
)
{
#if SPI_0_EN
case
SPI_0
:
spi
=
SPI_0_DEV
;
...
...
@@ -210,11 +210,11 @@ int spi_transfer_byte(spi_t dev, char out, char *in)
return
-
1
;
}
while
(
!
(
spi
->
SR
&
SPI_SR_TXE
));
while
(
!
(
spi
->
SR
&
SPI_SR_TXE
))
;
spi
->
DR
=
out
;
transferred
++
;
while
(
!
(
spi
->
SR
&
SPI_SR_RXNE
));
while
(
!
(
spi
->
SR
&
SPI_SR_RXNE
))
;
if
(
in
!=
NULL
)
{
*
in
=
spi
->
DR
;
transferred
++
;
...
...
@@ -224,7 +224,7 @@ int spi_transfer_byte(spi_t dev, char out, char *in)
}
/* SPI busy */
while
((
spi
->
SR
&
0x80
));
while
((
spi
->
SR
&
0x80
))
;
#if ENABLE_DEBUG
if
(
in
!=
NULL
)
{
DEBUG
(
"
\n
out: %x in: %x transferred: %x
\n
"
,
out
,
*
in
,
transferred
);
...
...
@@ -246,7 +246,7 @@ void spi_transmission_begin(spi_t dev, char reset_val)
void
spi_poweron
(
spi_t
dev
)
{
switch
(
dev
)
{
switch
(
dev
)
{
#if SPI_0_EN
case
SPI_0
:
SPI_0_CLKEN
();
...
...
@@ -272,7 +272,7 @@ void spi_poweron(spi_t dev)
void
spi_poweroff
(
spi_t
dev
)
{
switch
(
dev
)
{
switch
(
dev
)
{
#if SPI_0_EN
case
SPI_0
:
SPI_0_DEV
->
CR1
&=
~
(
SPI_CR1_SPE
);
/* turn SPI peripheral off */
...
...
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