Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
dw1000-driver
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
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
D7039E-E7025E
dw1000-driver
Commits
812c3558
Commit
812c3558
authored
Nov 16, 2016
by
Sebastian Larsson
Committed by
Sebastian Larsson
Nov 16, 2016
Browse files
Options
Downloads
Patches
Plain Diff
Replace printf with DW_DEBUG
parent
bdd5c925
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/dw1000-base.c
+34
-34
34 additions, 34 deletions
src/dw1000-base.c
src/dw1000-base.h
+6
-0
6 additions, 0 deletions
src/dw1000-base.h
with
40 additions
and
34 deletions
src/dw1000-base.c
+
34
−
34
View file @
812c3558
...
@@ -28,7 +28,7 @@
...
@@ -28,7 +28,7 @@
/*================================ Includes =================================*/
/*================================ Includes =================================*/
#include
"string.h"
// memcpy...
#include
"string.h"
// memcpy...
#include
"stdio.h"
//
#include "stdio.h"
#include
"udelay.h"
#include
"udelay.h"
#include
"math.h"
#include
"math.h"
...
@@ -114,7 +114,7 @@ void dw_init()
...
@@ -114,7 +114,7 @@ void dw_init()
// // Disable LDE
// // Disable LDE
// // TODO: Read old value and flip lderun bit
// // TODO: Read old value and flip lderun bit
// //value = dw_read_subreg_64(0x36, 0x04, 4);
// //value = dw_read_subreg_64(0x36, 0x04, 4);
// //
printf
("Value: %llx \n", value);
// //
DW_DEBUG
("Value: %llx \n", value);
// const uint32_t lderune = 0x81000738;
// const uint32_t lderune = 0x81000738;
// dw_write_subreg(0x36, 0x04, 4, (uint8_t *)&lderune);
// dw_write_subreg(0x36, 0x04, 4, (uint8_t *)&lderune);
...
@@ -130,7 +130,7 @@ void dw_init()
...
@@ -130,7 +130,7 @@ void dw_init()
dw_conf
(
&
dw1000
.
conf
);
dw_conf
(
&
dw1000
.
conf
);
// Print information about the board
// Print information about the board
printf
(
"Initialising device: %llu
\n
"
,
dw_get_device_id
()
);
DW_DEBUG
(
"Initialising device: %llu
\n
"
,
dw_get_device_id
()
);
dw1000
.
state
=
DW_STATE_IDLE
;
dw1000
.
state
=
DW_STATE_IDLE
;
}
}
...
@@ -472,7 +472,7 @@ void dw_conf_tx( dw1000_tx_conf_t * tx_conf )
...
@@ -472,7 +472,7 @@ void dw_conf_tx( dw1000_tx_conf_t * tx_conf )
/**
/**
* \brief Reads the current configuration from device and prints it using
* \brief Reads the current configuration from device and prints it using
*
printf
. The current configuration is all registers that can be modified by
*
DW_DEBUG
. The current configuration is all registers that can be modified by
* \ref dw_conf, \ref dw_conf_rx and \ref dw_conf_tx.
* \ref dw_conf, \ref dw_conf_rx and \ref dw_conf_tx.
*/
*/
void
void
...
@@ -515,31 +515,31 @@ dw_conf_print()
...
@@ -515,31 +515,31 @@ dw_conf_print()
float
temperature
=
dw_get_temperature
(
DW_ADC_SRC_LATEST
);
float
temperature
=
dw_get_temperature
(
DW_ADC_SRC_LATEST
);
float
voltage
=
dw_get_voltage
(
DW_ADC_SRC_LATEST
);
float
voltage
=
dw_get_voltage
(
DW_ADC_SRC_LATEST
);
printf
(
"============================
\n
"
);
DW_DEBUG
(
"============================
\n
"
);
printf
(
"DW1000 Current Configuration
\n
"
);
DW_DEBUG
(
"DW1000 Current Configuration
\n
"
);
printf
(
"============================
\n
"
);
DW_DEBUG
(
"============================
\n
"
);
printf
(
"Device id : %llx
\n
"
,
dw_get_device_id
());
DW_DEBUG
(
"Device id : %llx
\n
"
,
dw_get_device_id
());
printf
(
"sys_status : %llx
\n
"
,
dw_read_reg_64
(
DW_REG_SYS_STATUS
,
DW_LEN_SYS_STATUS
));
DW_DEBUG
(
"sys_status : %llx
\n
"
,
dw_read_reg_64
(
DW_REG_SYS_STATUS
,
DW_LEN_SYS_STATUS
));
printf
(
"============================
\n
"
);
DW_DEBUG
(
"============================
\n
"
);
printf
(
"sys_cfg : %x
\n
"
,
sys_cfg_val
);
DW_DEBUG
(
"sys_cfg : %x
\n
"
,
sys_cfg_val
);
printf
(
"tx_fctrl : %x
\n
"
,
tx_fctrl_val
);
DW_DEBUG
(
"tx_fctrl : %x
\n
"
,
tx_fctrl_val
);
printf
(
"chan_ctrl : %x
\n
"
,
chan_ctrl_val
);
DW_DEBUG
(
"chan_ctrl : %x
\n
"
,
chan_ctrl_val
);
printf
(
"agc_tune1 : %x
\n
"
,
agc_tune1_val
);
DW_DEBUG
(
"agc_tune1 : %x
\n
"
,
agc_tune1_val
);
printf
(
"agc_tune2 : %x
\n
"
,
agc_tune2_val
);
DW_DEBUG
(
"agc_tune2 : %x
\n
"
,
agc_tune2_val
);
printf
(
"agc_tune3 : %x
\n
"
,
agc_tune3_val
);
DW_DEBUG
(
"agc_tune3 : %x
\n
"
,
agc_tune3_val
);
printf
(
"drx_tune0b : %x
\n
"
,
drx_tune0b_val
);
DW_DEBUG
(
"drx_tune0b : %x
\n
"
,
drx_tune0b_val
);
printf
(
"drx_tune1a : %x
\n
"
,
drx_tune1a_val
);
DW_DEBUG
(
"drx_tune1a : %x
\n
"
,
drx_tune1a_val
);
printf
(
"drx_tune1b : %x
\n
"
,
drx_tune1b_val
);
DW_DEBUG
(
"drx_tune1b : %x
\n
"
,
drx_tune1b_val
);
printf
(
"drx_tune2 : %x
\n
"
,
drx_tune2_val
);
DW_DEBUG
(
"drx_tune2 : %x
\n
"
,
drx_tune2_val
);
printf
(
"drx_tune4h : %x
\n
"
,
drx_tune4h_val
);
DW_DEBUG
(
"drx_tune4h : %x
\n
"
,
drx_tune4h_val
);
printf
(
"rf_rxctrl : %x
\n
"
,
rf_rxctrl_val
);
DW_DEBUG
(
"rf_rxctrl : %x
\n
"
,
rf_rxctrl_val
);
printf
(
"rf_txctrl : %x
\n
"
,
rf_txctrl_val
);
DW_DEBUG
(
"rf_txctrl : %x
\n
"
,
rf_txctrl_val
);
printf
(
"tc_pgdelay : %x
\n
"
,
tc_pgdelay_val
);
DW_DEBUG
(
"tc_pgdelay : %x
\n
"
,
tc_pgdelay_val
);
printf
(
"fs_pllcfg : %x
\n
"
,
fs_pllcfg_val
);
DW_DEBUG
(
"fs_pllcfg : %x
\n
"
,
fs_pllcfg_val
);
printf
(
"fs_plltune : %x
\n
"
,
fs_plltune_val
);
DW_DEBUG
(
"fs_plltune : %x
\n
"
,
fs_plltune_val
);
printf
(
"============================
\n
"
);
DW_DEBUG
(
"============================
\n
"
);
printf
(
"temperature : %f
\n
"
,
temperature
);
DW_DEBUG
(
"temperature : %f
\n
"
,
temperature
);
printf
(
"voltage : %f
\n
"
,
voltage
);
DW_DEBUG
(
"voltage : %f
\n
"
,
voltage
);
}
}
/** @}*/
/** @}*/
...
@@ -555,7 +555,7 @@ dw_test(void)
...
@@ -555,7 +555,7 @@ dw_test(void)
if
(
canTalk
)
if
(
canTalk
)
{
{
printf
(
"You can now talk with the device (spi)!
\n
"
);
DW_DEBUG
(
"You can now talk with the device (spi)!
\n
"
);
}
}
}
}
...
@@ -863,7 +863,7 @@ dw_receive( dw1000_tranceive_t receive_type )
...
@@ -863,7 +863,7 @@ dw_receive( dw1000_tranceive_t receive_type )
if
(
dw1000
.
state
==
DW_STATE_RECEIVING
if
(
dw1000
.
state
==
DW_STATE_RECEIVING
||
dw1000
.
state
==
DW_STATE_TRANSMITTING
)
||
dw1000
.
state
==
DW_STATE_TRANSMITTING
)
{
{
printf
(
"dw1000 error: already using antenna.
\n
"
);
DW_DEBUG
(
"dw1000 error: already using antenna.
\n
"
);
return
;
return
;
}
}
...
@@ -919,7 +919,7 @@ void dw_transmit( uint8_t * p_data, uint32_t data_len, dw1000_tranceive_t transm
...
@@ -919,7 +919,7 @@ void dw_transmit( uint8_t * p_data, uint32_t data_len, dw1000_tranceive_t transm
if
(
dw1000
.
state
==
DW_STATE_RECEIVING
if
(
dw1000
.
state
==
DW_STATE_RECEIVING
||
dw1000
.
state
==
DW_STATE_TRANSMITTING
)
||
dw1000
.
state
==
DW_STATE_TRANSMITTING
)
{
{
printf
(
"dw1000 error: already using antenna.
\n
"
);
DW_DEBUG
(
"dw1000 error: already using antenna.
\n
"
);
return
;
return
;
}
}
...
@@ -977,7 +977,7 @@ dw_transmit_multiple_data( uint8_t ** pp_data,
...
@@ -977,7 +977,7 @@ dw_transmit_multiple_data( uint8_t ** pp_data,
if
(
dw1000
.
state
==
DW_STATE_RECEIVING
if
(
dw1000
.
state
==
DW_STATE_RECEIVING
||
dw1000
.
state
==
DW_STATE_TRANSMITTING
)
||
dw1000
.
state
==
DW_STATE_TRANSMITTING
)
{
{
printf
(
"dw1000 error: already using antenna.
\n
"
);
DW_DEBUG
(
"dw1000 error: already using antenna.
\n
"
);
return
;
return
;
}
}
...
@@ -1403,7 +1403,7 @@ dw_disable_rx_timeout()
...
@@ -1403,7 +1403,7 @@ dw_disable_rx_timeout()
cfgReg
=
dw_read_reg_32
(
DW_REG_SYS_CFG
,
DW_LEN_SYS_CFG
);
cfgReg
=
dw_read_reg_32
(
DW_REG_SYS_CFG
,
DW_LEN_SYS_CFG
);
cfgReg
&=
~
DW_RXWTOE_MASK
;
cfgReg
&=
~
DW_RXWTOE_MASK
;
dw_write_reg
(
DW_REG_SYS_CFG
,
DW_LEN_SYS_CFG
,
(
uint8_t
*
)
&
cfgReg
);
dw_write_reg
(
DW_REG_SYS_CFG
,
DW_LEN_SYS_CFG
,
(
uint8_t
*
)
&
cfgReg
);
printf
(
"CFG: %x
\n
"
,
cfgReg
);
DW_DEBUG
(
"CFG: %x
\n
"
,
cfgReg
);
}
}
/**
/**
...
...
This diff is collapsed.
Click to expand it.
src/dw1000-base.h
+
6
−
0
View file @
812c3558
...
@@ -388,6 +388,12 @@
...
@@ -388,6 +388,12 @@
#define DW_ERROR(...)
#define DW_ERROR(...)
#endif
#endif
#ifdef DEBUG
#define DW_DEBUG(...) printf(__VA_ARGS__);
#else
#define DW_DEBUG(...)
#endif
/**
/**
* \brief Used to choose from which source ADC should sample.
* \brief Used to choose from which source ADC should sample.
*/
*/
...
...
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