| | |
| | |
|
| | | #include "Globaldef.h"
|
| | | #include "Functions.h"
|
| | | #if (BOARD_TYPE == 14)
|
| | | #include "fp0.h"
|
| | | #endif
|
| | |
|
| | | /*
|
| | | if ((nCurTick &0xff) ==0)
|
| | |
| | |
|
| | | /* SPI1 interrupt Init */
|
| | | NVIC_SetPriority(SPI1_IRQn, 0);
|
| | | NVIC_EnableIRQ(SPI1_IRQn);
|
| | | // NVIC_EnableIRQ(SPI1_IRQn);
|
| | | /* USER CODE BEGIN SPI1_Init 1 */
|
| | |
|
| | | #if (BOARD_TYPE == 14)
|
| | | #if (BOARD_TYPE == 13)
|
| | |
|
| | | /* USER CODE END SPI1_Init 1 */
|
| | |
|
| | | /* SPI1 parameter configuration*/
|
| | | SPI_InitStruct.TransferDirection = LL_SPI_FULL_DUPLEX;
|
| | | SPI_InitStruct.Mode = LL_SPI_MODE_SLAVE;
|
| | | SPI_InitStruct.DataWidth = LL_SPI_DATAWIDTH_8BIT;
|
| | | SPI_InitStruct.ClockPolarity = LL_SPI_POLARITY_LOW; //LL_SPI_POLARITY_LOW;
|
| | | SPI_InitStruct.ClockPhase = LL_SPI_PHASE_2EDGE ; //LL_SPI_PHASE_1EDGE;
|
| | | SPI_InitStruct.NSS = LL_SPI_NSS_SOFT;
|
| | | SPI_InitStruct.BaudRate = LL_SPI_BAUDRATEPRESCALER_DIV4;
|
| | | SPI_InitStruct.BitOrder = LL_SPI_LSB_FIRST;
|
| | | SPI_InitStruct.CRCCalculation = LL_SPI_CRCCALCULATION_DISABLE;
|
| | | SPI_InitStruct.CRCPoly = 7;
|
| | | LL_SPI_Init(SPI1, &SPI_InitStruct);
|
| | |
|
| | | LL_SPI_SetStandard(SPI1, LL_SPI_PROTOCOL_MOTOROLA);
|
| | | LL_SPI_DisableNSSPulseMgt(SPI1);
|
| | | LL_SPI_SetRxFIFOThreshold(SPI1,LL_SPI_RX_FIFO_TH_QUARTER);
|
| | | // LL_SPI_EnableNSSPulseMgt(SPI1); |
| | |
|
| | | /* USER CODE BEGIN SPI1_Init 2 */
|
| | |
|
| | | #elif (BOARD_TYPE == 13)
|
| | |
|
| | | NVIC_EnableIRQ(SPI1_IRQn);
|
| | | SPI_InitStruct.TransferDirection = LL_SPI_FULL_DUPLEX;
|
| | | SPI_InitStruct.Mode = LL_SPI_MODE_MASTER;
|
| | | SPI_InitStruct.DataWidth = LL_SPI_DATAWIDTH_8BIT;
|
| | |
| | | LL_SPI_SetRxFIFOThreshold(SPI1,LL_SPI_RX_FIFO_TH_QUARTER);
|
| | | // LL_SPI_EnableNSSPulseMgt(SPI1);
|
| | |
|
| | | #elif (BOARD_TYPE == 14)
|
| | |
|
| | | NVIC_EnableIRQ(SPI1_IRQn);
|
| | | SPI_InitStruct.TransferDirection = LL_SPI_FULL_DUPLEX;
|
| | | SPI_InitStruct.Mode = LL_SPI_MODE_SLAVE;
|
| | | SPI_InitStruct.DataWidth = LL_SPI_DATAWIDTH_8BIT;
|
| | | SPI_InitStruct.ClockPolarity = LL_SPI_POLARITY_LOW; //LL_SPI_POLARITY_LOW;
|
| | | SPI_InitStruct.ClockPhase = LL_SPI_PHASE_2EDGE ; //LL_SPI_PHASE_1EDGE;
|
| | | SPI_InitStruct.NSS = LL_SPI_NSS_SOFT;
|
| | | SPI_InitStruct.BaudRate = LL_SPI_BAUDRATEPRESCALER_DIV4;
|
| | | SPI_InitStruct.BitOrder = LL_SPI_LSB_FIRST;
|
| | | SPI_InitStruct.CRCCalculation = LL_SPI_CRCCALCULATION_DISABLE;
|
| | | SPI_InitStruct.CRCPoly = 7;
|
| | | LL_SPI_Init(SPI1, &SPI_InitStruct);
|
| | |
|
| | | LL_SPI_SetStandard(SPI1, LL_SPI_PROTOCOL_MOTOROLA);
|
| | | LL_SPI_DisableNSSPulseMgt(SPI1);
|
| | | LL_SPI_SetRxFIFOThreshold(SPI1,LL_SPI_RX_FIFO_TH_QUARTER);
|
| | | // LL_SPI_EnableNSSPulseMgt(SPI1); |
| | |
|
| | | #else
|
| | |
|
| | | /* USER CODE END SPI1_Init 1 */
|
| | |
|
| | | /* SPI1 parameter configuration*/
|
| | | SPI_InitStruct.TransferDirection = LL_SPI_FULL_DUPLEX;
|
| | | SPI_InitStruct.Mode = LL_SPI_MODE_MASTER;
|
| | | SPI_InitStruct.DataWidth = LL_SPI_DATAWIDTH_8BIT;
|
| | |
| | | LL_SPI_Init(SPI1, &SPI_InitStruct);
|
| | |
|
| | | LL_SPI_SetStandard(SPI1, LL_SPI_PROTOCOL_MOTOROLA);
|
| | | |
| | |
|
| | | LL_SPI_SetRxFIFOThreshold(SPI1,LL_SPI_RX_FIFO_TH_QUARTER);
|
| | | LL_SPI_EnableNSSPulseMgt(SPI1);
|
| | | // LL_SPI_EnableNSSPulseMgt(SPI1);
|
| | |
|
| | | /* USER CODE BEGIN SPI1_Init 2 */
|
| | |
|
| | | #endif
|
| | |
|
| | |
| | | LL_GPIO_PIN_12|LL_GPIO_PIN_13|LL_GPIO_PIN_15;
|
| | |
|
| | | }
|
| | | else if (GetBoardType()==9 || GetBoardType()==10 )
|
| | | else if (GetBoardType()==9 || GetBoardType()==10 || GetBoardType()==15 || BOARD_TYPE == 16 )
|
| | | {
|
| | | GPIO_InitStruct.Pin = LL_GPIO_PIN_3|LL_GPIO_PIN_5|LL_GPIO_PIN_6|LL_GPIO_PIN_7|
|
| | | LL_GPIO_PIN_11|LL_GPIO_PIN_1|LL_GPIO_PIN_2|LL_GPIO_PIN_10|
|
| | |
| | | // PWR_BackupAccessCmd( ENABLE );/* ????RTC??????*/
|
| | | // RCC_LSEConfig( RCC_LSE_OFF ); /* ????????,PC14+PC15??????IO*/
|
| | | // BKP_TamperPinCmd(DISABLE); /* ????????,PC13??????IO*/
|
| | | |
| | | #if (BORAD_TYPE ==12)
|
| | |
|
| | | #if (BORAD_TYPE == 13)
|
| | |
|
| | | GPIO_InitStruct.Pin = LL_GPIO_PIN_15 ;
|
| | | GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT;
|
| | | GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH;
|
| | | GPIO_InitStruct.Pull = LL_GPIO_OUTPUT_PUSHPULL;
|
| | | LL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
| | |
|
| | | #elif (BOARD_TYPE == 14)
|
| | |
|
| | | GPIO_InitStruct.Pin = LL_GPIO_PIN_4|LL_GPIO_PIN_5|LL_GPIO_PIN_6|LL_GPIO_PIN_7;
|
| | | GPIO_InitStruct.Mode = LL_GPIO_MODE_INPUT;
|
| | |
| | | GPIO_InitStruct.Pull = LL_GPIO_PULL_UP;
|
| | | LL_GPIO_Init(OE_PORT, &GPIO_InitStruct);
|
| | |
|
| | | #elif (BOARD_TYPE == 13)
|
| | | #elif (BOARD_TYPE == 15 || BOARD_TYPE == 16)
|
| | |
|
| | | GPIO_InitStruct.Pin = LL_GPIO_PIN_15 ;
|
| | | GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT;
|
| | | // Radio Pins
|
| | | // busy pin
|
| | | GPIO_InitStruct.Pin = LL_GPIO_PIN_7; |
| | | GPIO_InitStruct.Mode = LL_GPIO_MODE_INPUT;
|
| | | GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH;
|
| | | GPIO_InitStruct.Pull = LL_GPIO_OUTPUT_PUSHPULL;
|
| | | GPIO_InitStruct.Pull = LL_GPIO_PULL_UP;
|
| | | LL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
| | | |
| | | // Dio 1 pin
|
| | | GPIO_InitStruct.Pin = LL_GPIO_PIN_12; |
| | | GPIO_InitStruct.Mode = LL_GPIO_MODE_INPUT;
|
| | | GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH;
|
| | | GPIO_InitStruct.Pull = LL_GPIO_PULL_UP;
|
| | | LL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
| | | |
| | | |
| | | //Sel pin
|
| | | GPIO_InitStruct.Pin = LL_GPIO_PIN_15; |
| | | GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT;
|
| | | GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH;
|
| | | GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
| | | GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
| | | LL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
| | | |
| | | |
| | | //RST pin
|
| | | GPIO_InitStruct.Pin = LL_GPIO_PIN_6; |
| | | GPIO_InitStruct.Mode = LL_GPIO_MODE_OUTPUT;
|
| | | GPIO_InitStruct.Speed = LL_GPIO_SPEED_FREQ_HIGH;
|
| | | GPIO_InitStruct.OutputType = LL_GPIO_OUTPUT_PUSHPULL;
|
| | | GPIO_InitStruct.Pull = LL_GPIO_PULL_NO;
|
| | | LL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
| | |
|
| | | #endif
|
| | |
|