| | |
| | | /* Write to SPIx CR1 */ |
| | | SPIx->CR1 = tmpreg; |
| | | } |
| | | |
| | | void Uwb_CS_di() |
| | | { |
| | | if(!HAL_GPIO_ReadPin( RADIO_NSS_GPIO_Port, RADIO_NSS_Pin)) |
| | | { |
| | | HAL_GPIO_WritePin( RADIO_NSS_GPIO_Port, RADIO_NSS_Pin,GPIO_PIN_SET); |
| | | printf("LORA_cs_error\r\n"); |
| | | } |
| | | } |
| | | /*! ------------------------------------------------------------------------------------------------------------------ |
| | | * Function: writetospi() |
| | | * |
| | |
| | | decaIrqStatus_t stat ; |
| | | |
| | | // stat = decamutexon() ; |
| | | |
| | | Uwb_CS_di(); |
| | | SPIx_CS_GPIO->BRR = SPIx_CS; |
| | | // delay_ms(1); |
| | | // tt=HAL_SPI_Transmit(&hspi1,headerBuffer,headerLength,10); |
| | |
| | | |
| | | /* Wait for SPIx Tx buffer empty */ |
| | | //while (port_SPIx_busy_sending()); |
| | | |
| | | Uwb_CS_di(); |
| | | SPIx_CS_GPIO->BRR = SPIx_CS; |
| | | // HAL_SPI_Transmit(&hspi1,headerBuffer,headerLength,10); |
| | | // HAL_SPI_Receive(&hspi1,readBuffer,readlength,10); |