Skip to content
Snippets Groups Projects
Commit 645a9f12 authored by Colin Wulf's avatar Colin Wulf
Browse files

dw1000: removed some todos, otpreads and debug printfs from the dw1000.c

parent a2041ec6
No related branches found
No related tags found
No related merge requests found
......@@ -5,7 +5,6 @@
#include "deca_regs.h"
#include "Trace.h"
//DECA:OTP addresses definitions
#define LDOTUNE_ADDRESS (0x04)
#define PARTID_ADDRESS (0x06)
#define LOTID_ADDRESS (0x07)
......@@ -35,16 +34,13 @@ int dw1000_init(uint16_t config, BaseType_t (*sendCallback)(),
// Set allowed interrupts
// TODO: Wieso werden ebenfalls andere Interrupts gesetzt? Vielleicht nur gesetzt, aber nicht getriggert?
// TODO: MLDEDONE
uint32_t sys_mask = 0;
dw1000Hal_readRegister(SYS_MASK_ID, (uint8_t *) &sys_mask, SYS_MASK_LEN);
trace_printf("SYS_MASK: %x\n", sys_mask);
sys_mask |= ( SYS_MASK_MTXFRS | SYS_MASK_MRXDFR | SYS_MASK_MRXFCG
// | SYS_MASK_MLDEDONE
| SYS_MASK_MRXSFDD
| SYS_MASK_MLDEDONE
);
// sys_mask |= SYS_MASK_MRXPRD;
sys_mask |=SYS_MASK_MRXSFDTO;
trace_printf("SYS_MASK: %x\n", sys_mask);
dw1000Hal_writeRegister(SYS_MASK_ID, (uint8_t *) &sys_mask, SYS_MASK_LEN);
......@@ -71,7 +67,6 @@ int dw1000_init(uint16_t config, BaseType_t (*sendCallback)(),
//DECA: set system clock to XTI - this is necessary to make sure the values read by _dwt_otpread are reliable
dw1000Util_enableclocks(FORCE_SYS_XTI);
// TODO: LDO Notwendig? Irgendwas mit Spannung?
if(config & DWT_LOADLDOTUNE)
{
dw1000local.ldoTune = dw1000Util_otpread(LDOTUNE_ADDRESS);
......@@ -91,31 +86,7 @@ int dw1000_init(uint16_t config, BaseType_t (*sendCallback)(),
dw1000local.partID = _dwt_otpread(PARTID_ADDRESS);
dw1000local.lotID = _dwt_otpread(LOTID_ADDRESS);
*/
// TODO
if (config & DWT_LOADANTDLY) {
dw1000local.antennaDly = dw1000Util_otpread(ANTDLY_ADDRESS);
} else {
dw1000local.antennaDly = 0;
}
if (config & DWT_LOADXTALTRIM) {
dw1000local.xtrim = dw1000Util_otpread(XTRIM_ADDRESS) & 0x1F;
if (!dw1000local.xtrim) {
dw1000local.xtrim = pll2calcfg & 0x1F; //DECA: set to mid-range if no calibration value inside
}
} else {
dw1000local.xtrim = pll2calcfg & 0x1F; // DECA:set to mid-range default as described in UM 8.1.1 Calibration Method
}
// // No custom config stored inside ROM -> no reading necessary
// if (config & DWT_LOADTXCONFIG) {
// for (uint8_t i = 0; i < 12; i++) {
// dw1000local.txPowCfg[i] = dw1000Util_otpread(TXCFG_ADDRESS + i);
// }
// } else {
// for (uint8_t i = 0; i < 12; i++) {
// dw1000local.txPowCfg[i] = 0;
// }
// }
// load leading edge detect code
if (config & DWT_LOADUCODE) {
......@@ -417,8 +388,7 @@ void dw1000_extiCallback(void) {
int dw_1000_receiveFrameFromIsr(uint8_t * buffer, uint32_t length) {
dw1000Hal_readRegisterFromIsr(RX_BUFFER_ID, buffer, length); //FromIsr important!
trace_printf("First byte: %d\n", buffer[0]);
//trace_printf("Last byte: %d\n", buffer[length - 3]);
trace_printf("%d\n", buffer[0]);
return 0;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment