Revision 4172c48d source/DW1000/v1/deca_instance_common_v1.c

View differences:

source/DW1000/v1/deca_instance_common_v1.c
432 432
// function to initialise instance structures
433 433
//
434 434
// Returns 0 on success and -1 on error
435
//int instance_init(void){   // TODO
436 435
int instance_init(DW1000Driver* drv){
437 436
  int instance = 0 ;
438 437
  int i;
......
513 512
//
514 513
// function to allow application configuration be passed into instance and affect underlying device operation
515 514
//
516
void instance_config(instanceConfig_t *config, sfConfig_t *sfConfig){
515
void instance_config(instanceConfig_t *config, sfConfig_t *sfConfig, DW1000Driver* drv){
517 516
  int instance = 0 ;
518 517
  uint32_t power = 0;
519 518
  uint8_t otprev ;
......
598 597

  
599 598
  if(config->preambleLen == DWT_PLEN_64)  {  //if preamble length is 64
600 599
    //reduce SPI to < 3MHz
601
    setHighSpeed_SPI(FALSE);  //TODO: workaround using flag to change speed
600
    setHighSpeed_SPI(FALSE, drv);
602 601
    dwt_loadopsettabfromotp(0);
603 602
    //increase SPI to max
604
    setHighSpeed_SPI(TRUE);  //TODO: workaround using flag to change speed
603
    setHighSpeed_SPI(TRUE, drv);
605 604
  }
606 605

  
607 606
  instancesettagsleepdelay(sfConfig->pollSleepDly); //set the Tag sleep time
......
1647 1646
void instance_close(void){
1648 1647
  //wake up device from low power mode
1649 1648
  //NOTE - in the ARM  code just drop chip select for 200us
1650
  port_SPIx_clear_chip_select();  //CS low
1649
  clear_SPI_chip_select();  //CS low
1651 1650
  Sleep(1);   //200 us to wake up then waits 5ms for DW1000 XTAL to stabilise
1652
  port_SPIx_set_chip_select();  //CS high
1651
  set_SPI_chip_select();  //CS high
1653 1652
  Sleep(5);
1654 1653
  dwt_entersleepaftertx(0); // clear the "enter deep sleep after tx" bit
1655 1654
  dwt_setinterrupt(0xFFFFFFFF, 0); //don't allow any interrupts

Also available in: Unified diff