Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dw1000_driver_freertos
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
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
dw1000_driver_freertos
Commits
45f2c96f
Commit
45f2c96f
authored
9 years ago
by
Colin Wulf
Browse files
Options
Downloads
Patches
Plain Diff
dw1000: added transmitFrame and writeFrameIntoBuffer
parent
e1189da1
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
Inc/dw1000.h
+2
-0
2 additions, 0 deletions
Inc/dw1000.h
Src/dw1000.c
+24
-23
24 additions, 23 deletions
Src/dw1000.c
with
26 additions
and
23 deletions
Inc/dw1000.h
+
2
−
0
View file @
45f2c96f
...
...
@@ -144,6 +144,8 @@ int dw1000_init(uint16_t config, BaseType_t (*sendCallback)(),
BaseType_t
(
*
receiveCallback
)(
uint32_t
bufferLength
,
uint8_t
ts_valid
));
int
dw1000_configure
(
dwt_config_t
*
config
,
uint8_t
use_otpconfigvalues
);
int
dw1000_sendFrame
(
uint8_t
*
payload
,
uint16_t
len
);
int
dw1000_writeFrameIntoBuffer
(
uint16_t
txBufferOffset
,
uint8_t
*
payload
,
uint16_t
len
);
int
dw1000_transmitFrame
(
uint16_t
txBufferOffset
,
uint16_t
len
);
int
dw_1000_receiveFrameFromIsr
(
uint8_t
*
buffer
,
uint32_t
length
);
void
dw1000_extiCallback
(
void
);
void
vTaskGlobalTimeIncrement
(
void
*
pvParameters
);
...
...
This diff is collapsed.
Click to expand it.
Src/dw1000.c
+
24
−
23
View file @
45f2c96f
...
...
@@ -15,6 +15,8 @@
volatile
uint32_t
global_time
=
0
;
uint16_t
maximum_message_length
=
1024
;
//Fixme: put right message length
int
dw1000_init
(
uint16_t
config
,
BaseType_t
(
*
sendCallback
)(),
BaseType_t
(
*
receiveCallback
)(
uint32_t
bufferlength
,
uint8_t
ts_valid
))
{
...
...
@@ -349,44 +351,43 @@ int dw1000_configure(dwt_config_t *config, uint8_t use_otpconfigvalues) {
return
0
;
}
uint16_t
txBufferOffset
=
0
;
// sends a frame and blocks until finished
int
dw1000_sendFrame
(
uint8_t
*
payload
,
uint16_t
len
)
{
//Write payload to the buffer with no offset
int
ret
=
dw1000_writeFrameIntoBuffer
(
0
,
payload
,
len
);
if
(
ret
!=
DW1000_RET_OK
){
return
ret
;
}
//Invoke transmission
return
dw1000_transmitFrame
(
0
,
len
);
}
int
dw1000_writeFrameIntoBuffer
(
uint16_t
txBufferOffset
,
uint8_t
*
payload
,
uint16_t
len
){
if
((
len
+
2
)
>
maximum_message_length
){
// Message + CRC is longer than the allowed msg length (usually 127, but decawave
return
DW1000_RET_MSG_TO_LONG
;
}
if
((
txBufferOffset
+
len
+
2
)
>
1024
){
return
-
1
;
//FIXME: ERRORCODE
return
DW1000_RET_TX_BUFFER_OVERFLOW
;
}
//Write payload
//Write payload
into tx buffer
dw1000Hal_writeRegister
(
TX_BUFFER_ID
+
txBufferOffset
,
payload
,
len
);
return
DW1000_RET_OK
;
}
int
dw1000_transmitFrame
(
uint16_t
txBufferOffset
,
uint16_t
len
){
//Set length and offset
uint32_t
reg32
=
dw1000local
.
txFCTRL
|
len
+
2
|
(
txBufferOffset
<<
22
);
dw1000Hal_writeSubRegister
(
TX_FCTRL_ID
,
0
,
(
uint8_t
*
)
&
reg32
,
TX_FCTRL_LEN
-
1
);
txBufferOffset
+=
len
+
2
;
txBufferOffset
=
0
;
//FIXME: Löschen, wenn anständige Offsetbehandlung.
// /* WITHOUT THE NEXT PART: SECOND TIME NO SENDING POSSIBLE, BUT CAN'T BE FOUND IN ORIGINAL DRIVER */
// uint32_t sys_ctrl = 0;
// dw1000Hal_readRegister(SYS_CTRL_ID, (uint8_t *)&sys_ctrl, 4);
// //trace_printf("sys_ctrl: %x\n", sys_ctrl);
// sys_ctrl |= SYS_CTRL_TRXOFF;// Immediately cancel all RX and TX operations, bring radio to IDLE state
//// trace_printf("sys_ctrl: %x\n", sys_ctrl);
// dw1000Hal_writeRegister(SYS_CTRL_ID, (uint8_t *)&sys_ctrl, 4);
// sys_ctrl = 0;
dw1000Util_forceTrxOff
();
/* WITHOUT THE NEXT PART: SECOND TIME NO SENDING POSSIBLE, BUT CAN'T BE FOUND IN ORIGINAL DRIVER */
dw1000Util_forceTrxOff
();
uint8_t
temp
=
(
uint8_t
)
SYS_CTRL_TXSTRT
;
dw1000Hal_writeRegister
(
SYS_CTRL_ID
,
(
uint8_t
*
)
&
temp
,
1
);
return
0
;
return
DW1000_RET_OK
;
}
void
vTaskGlobalTimeIncrement
(
void
*
pvParameters
)
{
...
...
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