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
fa00154f
Commit
fa00154f
authored
9 years ago
by
Kaspar Schleiser
Browse files
Options
Downloads
Patches
Plain Diff
cpu: stm32f3: use periph_common SPI functions
parent
6c185655
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
cpu/stm32f3/Makefile.include
+3
-0
3 additions, 0 deletions
cpu/stm32f3/Makefile.include
cpu/stm32f3/include/periph_cpu.h
+9
-0
9 additions, 0 deletions
cpu/stm32f3/include/periph_cpu.h
cpu/stm32f3/periph/spi.c
+0
-56
0 additions, 56 deletions
cpu/stm32f3/periph/spi.c
with
12 additions
and
56 deletions
cpu/stm32f3/Makefile.include
+
3
−
0
View file @
fa00154f
...
...
@@ -3,4 +3,7 @@ export CPU_ARCH = cortex-m4f
# use hwtimer compatibility module
USEMODULE
+=
hwtimer_compat
# includ common periph module
USEMODULE
+=
periph_common
include
$(RIOTCPU)/Makefile.include.cortexm_common
This diff is collapsed.
Click to expand it.
cpu/stm32f3/include/periph_cpu.h
+
9
−
0
View file @
fa00154f
...
...
@@ -79,6 +79,15 @@ typedef enum {
GPIO_AF15
/**< use alternate function 14 */
}
gpio_af_t
;
/**
* @brief declare needed generic SPI functions
* @{
*/
#define PERIPH_SPI_NEEDS_TRANSFER_BYTES
#define PERIPH_SPI_NEEDS_TRANSFER_REG
#define PERIPH_SPI_NEEDS_TRANSFER_REGS
/** @} */
#ifdef __cplusplus
}
#endif
...
...
This diff is collapsed.
Click to expand it.
cpu/stm32f3/periph/spi.c
+
0
−
56
View file @
fa00154f
...
...
@@ -334,62 +334,6 @@ int spi_transfer_byte(spi_t dev, char out, char *in)
return
1
;
}
int
spi_transfer_bytes
(
spi_t
dev
,
char
*
out
,
char
*
in
,
unsigned
int
length
)
{
int
i
,
trans_ret
,
trans_bytes
=
0
;
char
in_temp
;
for
(
i
=
0
;
i
<
length
;
i
++
)
{
if
(
out
!=
NULL
)
{
trans_ret
=
spi_transfer_byte
(
dev
,
out
[
i
],
&
in_temp
);
}
else
{
trans_ret
=
spi_transfer_byte
(
dev
,
0
,
&
in_temp
);
}
if
(
trans_ret
<
0
)
{
return
-
1
;
}
if
(
in
!=
NULL
)
{
in
[
i
]
=
in_temp
;
}
trans_bytes
++
;
}
return
trans_bytes
++
;
}
int
spi_transfer_reg
(
spi_t
dev
,
uint8_t
reg
,
char
out
,
char
*
in
)
{
int
trans_ret
;
trans_ret
=
spi_transfer_byte
(
dev
,
reg
,
in
);
if
(
trans_ret
<
0
)
{
return
-
1
;
}
trans_ret
=
spi_transfer_byte
(
dev
,
out
,
in
);
if
(
trans_ret
<
0
)
{
return
-
1
;
}
return
1
;
}
int
spi_transfer_regs
(
spi_t
dev
,
uint8_t
reg
,
char
*
out
,
char
*
in
,
unsigned
int
length
)
{
int
trans_ret
;
trans_ret
=
spi_transfer_byte
(
dev
,
reg
,
in
);
if
(
trans_ret
<
0
)
{
return
-
1
;
}
trans_ret
=
spi_transfer_bytes
(
dev
,
out
,
in
,
length
);
if
(
trans_ret
<
0
)
{
return
-
1
;
}
return
trans_ret
;
}
void
spi_transmission_begin
(
spi_t
dev
,
char
reset_val
)
{
if
(
dev
<
SPI_NUMOF
)
{
...
...
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