Revision 8d4d058e test/periphery-lld/DW1000_v1/aos_test_DW1000.c
| test/periphery-lld/DW1000_v1/aos_test_DW1000.c | ||
|---|---|---|
| 34 | 34 |
/* LOCAL DEFINITIONS */ |
| 35 | 35 |
/******************************************************************************/ |
| 36 | 36 |
|
| 37 |
//#define TEST_SNIPPETS_DW1000 // switch between test and demo apps
|
|
| 37 |
#define TEST_SNIPPETS_DW1000 // switch between test and demo apps |
|
| 38 | 38 |
|
| 39 | 39 |
#define SWS1_SHF_MODE 0x02 //short frame mode (6.81M) |
| 40 | 40 |
#define SWS1_CH5_MODE 0x04 //channel 5 mode |
| ... | ... | |
| 68 | 68 |
/* LOCAL FUNCTIONS */ |
| 69 | 69 |
/******************************************************************************/ |
| 70 | 70 |
|
| 71 |
/*! @brief Change the SPI speed configuration on the fly */ |
|
| 72 |
void setHighSpeed_SPI(bool speedValue, DW1000Driver* drv){
|
|
| 73 |
|
|
| 74 |
spiStop(drv->spid); |
|
| 75 |
|
|
| 76 |
if (speedValue == FALSE){
|
|
| 77 |
spiStart(drv->spid, &moduleHalSpiUwbLsConfig); // low speed spi configuration |
|
| 78 |
} |
|
| 79 |
else{
|
|
| 80 |
spiStart(drv->spid, &moduleHalSpiUwbHsConfig); // high speed spi configuration |
|
| 81 |
} |
|
| 82 |
} |
|
| 83 |
|
|
| 84 |
/*! @brief entry point to the IRQn event in DW1000 module |
|
| 85 |
* |
|
| 86 |
* */ |
|
| 87 |
void process_deca_irq(void){
|
|
| 88 |
do{
|
|
| 89 |
dwt_isr(); |
|
| 90 |
//while IRS line active (ARM can only do edge sensitive interrupts) |
|
| 91 |
}while(port_CheckEXT_IRQ() == 1); |
|
| 92 |
} |
|
| 93 |
|
|
| 94 |
/*! @brief Check the current value of GPIO pin and return the value */ |
|
| 95 |
apalGpioState_t port_CheckEXT_IRQ(void) {
|
|
| 96 |
apalGpioState_t val; |
|
| 97 |
apalGpioRead(moduleGpioDw1000Irqn.gpio, &val); |
|
| 98 |
return val; |
|
| 99 |
} |
|
| 100 |
|
|
| 101 |
/*! @brief Manually set the chip select pin of the SPI */ |
|
| 102 |
void set_SPI_chip_select(void){
|
|
| 103 |
apalGpioWrite(moduleGpioSpiChipSelect.gpio, APAL_GPIO_HIGH); |
|
| 104 |
} |
|
| 105 |
|
|
| 106 |
/*! @brief Manually reset the chip select pin of the SPI */ |
|
| 107 |
void clear_SPI_chip_select(void){
|
|
| 108 |
apalGpioWrite(moduleGpioSpiChipSelect.gpio, APAL_GPIO_LOW); |
|
| 109 |
} |
|
| 110 |
|
|
| 111 | 71 |
/*! @brief Manually reset the DW1000 module */ |
| 112 | 72 |
void reset_DW1000(void){
|
| 113 | 73 |
|
| ... | ... | |
| 248 | 208 |
/******************************************************************************/ |
| 249 | 209 |
|
| 250 | 210 |
|
| 251 |
aos_testresult_t aosTestDw1000Func(BaseSequentialStream* stream, aos_test_t* test) {
|
|
| 211 |
aos_testresult_t aosTestDw1000Func(BaseSequentialStream* stream, const aos_test_t* test) {
|
|
| 212 |
|
|
| 213 |
aosDbgCheck(test->data != NULL && |
|
| 214 |
((aos_test_dw1000data_t*)test->data)->driver != NULL && |
|
| 215 |
((aos_test_dw1000data_t*)test->data)->evtsource != NULL); |
|
| 252 | 216 |
|
| 253 |
aosDbgCheck(test->data != NULL && ((aos_test_dw1000data_t*)test->data)->driver != NULL); |
|
| 254 | 217 |
|
| 255 | 218 |
aos_testresult_t result = {0, 0};
|
| 256 | 219 |
|
| ... | ... | |
| 393 | 356 |
/*! Run the localization system demo app as a thread */ |
| 394 | 357 |
while(1){
|
| 395 | 358 |
instance_run(); |
| 396 |
// aosThdUSleep(10); |
|
| 359 |
// aosThdUSleep(100);
|
|
| 397 | 360 |
} |
| 398 | 361 |
|
| 399 | 362 |
#endif /* defined(TEST_SNIPPETS_DW1000) */ |
Also available in: Unified diff