Revision 4172c48d source/DW1000/v1/alld_dw1000_v1.c
source/DW1000/v1/alld_dw1000_v1.c | ||
---|---|---|
29 | 29 |
*/ |
30 | 30 |
|
31 | 31 |
#include <alld_DW1000.h> |
32 |
|
|
33 | 32 |
#if (defined(AMIROLLD_CFG_DW1000) && (AMIROLLD_CFG_DW1000 == 1)) || defined(__DOXYGEN__) |
34 | 33 |
|
35 | 34 |
#include <v1/alld_dw1000_regs_v1.h> |
36 |
|
|
37 | 35 |
#include <aos_thread.h> |
38 | 36 |
#include <assert.h> |
39 | 37 |
#include <string.h> |
... | ... | |
1014 | 1012 |
#define XTRIM_ADDRESS (0x1E) |
1015 | 1013 |
|
1016 | 1014 |
int dwt_initialise(const uint16_t config, DW1000Driver* drv) |
1017 |
//int dwt_initialise(const uint16_t config) // TODO: |
|
1018 | 1015 |
{ |
1019 | 1016 |
uint16_t otp_addr = 0; |
1020 | 1017 |
uint32_t ldo_tune = 0; |
... | ... | |
4441 | 4438 |
memcpy(buffer, headerBuffer, headerLength); //copy data to buffer |
4442 | 4439 |
memcpy(&buffer[headerLength], bodyBuffer, bodyLength); //copy data to buffer |
4443 | 4440 |
|
4444 |
apalSPITransmit(&MODULE_HAL_SPI_UWB,
|
|
4441 |
apalSPITransmit(pdw1000local->driver->spid,
|
|
4445 | 4442 |
buffer, |
4446 | 4443 |
bodyLength + headerLength); // send header and data |
4447 | 4444 |
|
... | ... | |
4464 | 4461 |
uint8_t *readBuffer) |
4465 | 4462 |
{ |
4466 | 4463 |
|
4467 |
apalSPITransmitAndReceive(&MODULE_HAL_SPI_UWB, // TODO: "pdw1000local->driver->spid" fails two spi configs
|
|
4464 |
apalSPITransmitAndReceive(pdw1000local->driver->spid,
|
|
4468 | 4465 |
headerBuffer, |
4469 | 4466 |
readBuffer, |
4470 | 4467 |
headerLength, |
... | ... | |
4533 | 4530 |
* |
4534 | 4531 |
*/ |
4535 | 4532 |
|
4533 |
/*! @brief sleep or idle the thread in millisecond */ |
|
4536 | 4534 |
void deca_sleep(unsigned int time_ms) |
4537 | 4535 |
{ |
4538 | 4536 |
aosThdMSleep(time_ms); |
4539 | 4537 |
} |
4540 | 4538 |
|
4539 |
/*! @brief sleep or idle the thread in millisecond */ |
|
4541 | 4540 |
void Sleep(unsigned int time_ms) |
4542 | 4541 |
{ |
4543 | 4542 |
aosThdMSleep(time_ms); |
... | ... | |
4548 | 4547 |
return; |
4549 | 4548 |
} |
4550 | 4549 |
|
4550 |
/*! @brief Get the current system tick time */ |
|
4551 | 4551 |
uint32_t portGetTickCnt(){ |
4552 | 4552 |
return chVTGetSystemTimeX(); |
4553 | 4553 |
} |
... | ... | |
4557 | 4557 |
//} |
4558 | 4558 |
|
4559 | 4559 |
|
4560 |
/*! @brief Disable the interrupt handler */ |
|
4560 | 4561 |
void port_DisableEXT_IRQ(void){ |
4561 | 4562 |
nvicDisableVector(DW1000_EXTI_IRQn); |
4562 | 4563 |
|
4563 | 4564 |
} |
4564 | 4565 |
|
4566 |
/*! @brief Enable the interrupt handler */ |
|
4565 | 4567 |
void port_EnableEXT_IRQ(void){ |
4566 | 4568 |
nvicEnableVector(DW1000_EXTI_IRQn, STM32_IRQ_EXTI10_15_PRIORITY); |
4567 | 4569 |
} |
4568 | 4570 |
|
4569 |
|
|
4571 |
/*! @brief Get the current status of the interrupt handler */ |
|
4570 | 4572 |
decaIrqStatus_t port_GetEXT_IRQStatus(void){ |
4571 | 4573 |
decaIrqStatus_t bitstatus = RESET; |
4572 | 4574 |
|
4573 | 4575 |
if(NVIC_GetActive(DW1000_EXTI_IRQn)|| NVIC_GetPendingIRQ(DW1000_EXTI_IRQn)){ |
4574 |
// if(NVIC_GetPendingIRQ(EXTI15_10_IRQn)){ //if the interrupt is pending (background ) |
|
4575 | 4576 |
bitstatus = SET; //Interrupt is active or panding |
4576 | 4577 |
} |
4577 | 4578 |
else { |
Also available in: Unified diff