Revision a3ac2400

View differences:

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
 */
test/periphery-lld/DW1000_v1/aos_test_DW1000.h
44 44
/**
45 45
 * @brief   Custom data structure for the test.
46 46
 */
47
#if (BOARD_MIC9404x_CONNECTED == true)
47 48
typedef struct {
48 49
  /**
49 50
   * @brief   Pointer to the driver to use.
......
60 61
   */
61 62
  eventflags_t evtflags;
62 63

  
64
  /**
65
   * @brief MIC9404x driver to use.
66
  */
67
  MIC9404xDriver  *mic9404xd;
68

  
63 69
} aos_test_dw1000data_t;
64 70

  
71
#else
72
typedef struct {
73
  /**
74
   * @brief   Pointer to the driver to use.
75
   */
76
  DW1000Driver* driver;
77

  
78
  /**
79
   * @brief   Event source to listen to.
80
   */
81
  event_source_t* evtsource;
82

  
83
  /**
84
   * @brief   Event flags to watch.
85
   */
86
  eventflags_t evtflags;
87

  
88
} aos_test_dw1000data_t;
89

  
90
#endif /* BOARD_MIC9404x_CONNECTED == true  */
91

  
65 92
/******************************************************************************/
66 93
/* MACROS                                                                     */
67 94
/******************************************************************************/
......
85 112
  int32_t inittestapplication(uint8_t s1switch, DW1000Driver* drv);
86 113
  int decarangingmode(uint8_t s1switch);
87 114
  void addressconfigure(uint8_t s1switch, uint8_t mode);
88
  void reset_DW1000(void);
89 115

  
90 116
#if defined(__cplusplus)
91 117
}

Also available in: Unified diff