Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
NuttX RTOS
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
f4grx
NuttX RTOS
Commits
50e9a5fa
Commit
50e9a5fa
authored
8 years ago
by
Gregory Nutt
Browse files
Options
Downloads
Patches
Plain Diff
Add more options to spi_transfer
parent
5407a673
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
drivers/spi/spi_transfer.c
+19
-16
19 additions, 16 deletions
drivers/spi/spi_transfer.c
include/nuttx/spi/spi_transfer.h
+2
-0
2 additions, 0 deletions
include/nuttx/spi/spi_transfer.h
with
21 additions
and
16 deletions
drivers/spi/spi_transfer.c
+
19
−
16
View file @
50e9a5fa
...
...
@@ -39,6 +39,7 @@
#include
<nuttx/config.h>
#include
<unistd.h>
#include
<assert.h>
#include
<errno.h>
#include
<debug.h>
...
...
@@ -48,22 +49,6 @@
#ifdef CONFIG_SPI_EXCHANGE
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
/****************************************************************************
* Private Data
****************************************************************************/
/****************************************************************************
* Private Functions
****************************************************************************/
/****************************************************************************
* Public Functions
****************************************************************************/
...
...
@@ -142,9 +127,27 @@ int spi_transfer(FAR struct spi_dev_s *spi, FAR struct spi_sequence_s *seq)
}
#endif
/* [Re-]select the SPI device in preparation for the transfer */
SPI_SELECT
(
spi
,
seq
->
dev
,
true
);
/* Perform the transfer */
SPI_EXCHANGE
(
spi
,
trans
->
txbuffer
,
trans
->
rxbuffer
,
trans
->
nwords
);
/* Possibly de-select the SPI device after the transfer */
if
(
trans
->
deselect
)
{
SPI_SELECT
(
spi
,
seq
->
dev
,
false
);
}
/* Perform any requested inter-transfer delay */
if
(
trans
->
delay
>
0
)
{
usleep
(
trans
->
delay
);
}
}
SPI_SELECT
(
spi
,
seq
->
dev
,
false
);
...
...
This diff is collapsed.
Click to expand it.
include/nuttx/spi/spi_transfer.h
+
2
−
0
View file @
50e9a5fa
...
...
@@ -76,12 +76,14 @@ struct spi_trans_s
{
/* SPI attributes for unique to this transaction */
bool
deselect
;
/* De-select after transfer */
#ifdef CONFIG_SPI_CMDDATA
bool
cmd
;
/* true=command; false=data */
#endif
#ifdef CONFIG_SPI_HWFEATURES
spi_hwfeatures_t
hwfeat
;
/* Hard features to enable on this transfer */
#endif
uint32_t
delay
;
/* Microsecond delay after transfer */
/* These describe the single data transfer */
...
...
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