Revision a3ac2400 test/periphery-lld/DW1000_v1/aos_test_DW1000.c
test/periphery-lld/DW1000_v1/aos_test_DW1000.c | ||
---|---|---|
68 | 68 |
/* LOCAL FUNCTIONS */ |
69 | 69 |
/******************************************************************************/ |
70 | 70 |
|
71 |
/*! @brief Manually reset the DW1000 module */ |
|
72 |
void reset_DW1000(void){ |
|
73 |
|
|
74 |
// Set the pin as output |
|
75 |
palSetLineMode(moduleGpioDw1000Reset.gpio->line, APAL_GPIO_DIRECTION_OUTPUT); |
|
76 |
|
|
77 |
//drive the RSTn pin low |
|
78 |
apalGpioWrite(moduleGpioDw1000Reset.gpio, APAL_GPIO_LOW); |
|
79 |
|
|
80 |
//put the pin back to tri-state ... as input |
|
81 |
// palSetLineMode(moduleGpioDw1000Reset.gpio->line, APAL_GPIO_DIRECTION_INPUT); // TODO: |
|
82 |
|
|
83 |
aosThdMSleep(2); |
|
84 |
} |
|
85 |
|
|
86 | 71 |
/*! @brief Configure instance tag/anchor/etc... addresses */ |
87 | 72 |
void addressconfigure(uint8_t s1switch, uint8_t mode){ |
88 | 73 |
uint16_t instAddress ; |
... | ... | |
207 | 192 |
/* EXPORTED FUNCTIONS */ |
208 | 193 |
/******************************************************************************/ |
209 | 194 |
|
210 |
|
|
211 | 195 |
aos_testresult_t aosTestDw1000Func(BaseSequentialStream* stream, const aos_test_t* test) { |
212 | 196 |
|
213 | 197 |
aosDbgCheck(test->data != NULL && |
214 | 198 |
((aos_test_dw1000data_t*)test->data)->driver != NULL && |
215 | 199 |
((aos_test_dw1000data_t*)test->data)->evtsource != NULL); |
216 | 200 |
|
201 |
aos_testresult_t result = {0, 0}; |
|
202 |
|
|
203 |
|
|
204 |
#if (BOARD_MIC9404x_CONNECTED == true) |
|
205 |
// Enable 3.3V and 1.8V supply voltages for powering up the DW1000 module in AMiRo Light Ring |
|
206 |
if ((test->data != NULL) && (((aos_test_dw1000data_t*)(test->data))->mic9404xd != NULL)){ |
|
207 |
// && (((aos_test_dw1000data_t*)(test->data))->driver == NULL)){ |
|
208 |
mic9404x_lld_state_t state; |
|
209 |
uint32_t status = APAL_STATUS_OK; |
|
210 |
|
|
211 |
chprintf(stream, "reading current status of the Power..\n"); |
|
212 |
status = mic9404x_lld_get(((aos_test_dw1000data_t*)(test->data))->mic9404xd, &state); |
|
213 |
if (status == APAL_STATUS_OK) { |
|
214 |
aosTestPassedMsg(stream, &result, "power %s\n", (state == MIC9404x_LLD_STATE_ON) ? "enabled" : "disabled"); |
|
215 |
} else { |
|
216 |
aosTestFailed(stream, &result); |
|
217 |
} |
|
218 |
if (state == MIC9404x_LLD_STATE_OFF) { |
|
219 |
chprintf(stream, "enabling the power ...\n"); |
|
220 |
status = mic9404x_lld_set(((aos_test_dw1000data_t*)(test->data))->mic9404xd, MIC9404x_LLD_STATE_ON); |
|
221 |
status |= mic9404x_lld_get(((aos_test_dw1000data_t*)(test->data))->mic9404xd, &state); |
|
222 |
if (state == MIC9404x_LLD_STATE_ON) { |
|
223 |
aosThdSSleep(2); |
|
224 |
status |= mic9404x_lld_get(((aos_test_dw1000data_t*)(test->data))->mic9404xd, &state); |
|
225 |
} |
|
226 |
if ((status == APAL_STATUS_OK) && (state == MIC9404x_LLD_STATE_ON)) { |
|
227 |
aosTestPassed(stream, &result); |
|
228 |
} else { |
|
229 |
aosTestFailed(stream, &result); |
|
230 |
} |
|
231 |
} |
|
232 |
aosThdSleep(1); |
|
233 |
return result; |
|
234 |
} |
|
235 |
#endif /* BOARD_MIC9404x_CONNECTED == true */ |
|
217 | 236 |
|
218 |
aos_testresult_t result = {0, 0}; |
|
219 | 237 |
|
220 | 238 |
chprintf(stream, "init DW1000...\n"); |
221 | 239 |
dwt_initialise(DWT_LOADUCODE, ((aos_test_dw1000data_t*)test->data)->driver); |
222 | 240 |
aosThdMSleep(5); |
223 | 241 |
|
224 |
|
|
225 | 242 |
/*! Test snippets for DW1000. |
226 | 243 |
* @Note: Event IRQ for DW1000 should be tested separately |
227 | 244 |
*/ |
Also available in: Unified diff