Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* USER CODE BEGIN PV */
- uint64_t tx_address = 0x11223344AA;
- char buf[32] = "Hello World!";
- uint16_t tx_data[2] = {501, 502};
- /* USER CODE END PV */
- /* Private function prototypes -----------------------------------------------*/
- void SystemClock_Config(void);
- /* USER CODE BEGIN PFP */
- /* USER CODE END PFP */
- /* Private user code ---------------------------------------------------------*/
- /* USER CODE BEGIN 0 */
- /* USER CODE END 0 */
- /**
- * @brief The application entry point.
- * @retval int
- */
- int main(void)
- {
- /* USER CODE BEGIN 1 */
- /* USER CODE END 1 */
- /* MCU Configuration--------------------------------------------------------*/
- /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
- HAL_Init();
- /* USER CODE BEGIN Init */
- /* USER CODE END Init */
- /* Configure the system clock */
- SystemClock_Config();
- /* USER CODE BEGIN SysInit */
- /* USER CODE END SysInit */
- /* Initialize all configured peripherals */
- MX_GPIO_Init();
- MX_SPI1_Init();
- MX_USART1_UART_Init();
- /* USER CODE BEGIN 2 */
- NRF24_begin(CE_GPIO_Port, CSN_Pin, CE_Pin, hspi1);
- nrf24_DebugUART_Init(huart1);
- /* Transmit NO ACK */
- NRF24_stopListening();
- NRF24_openWritingPipe(tx_address);
- NRF24_setAutoAck(false);
- NRF24_setChannel(52);
- NRF24_setPayloadSize(32);
- printRadioSettings();
- /* USER CODE END 2 */
- /* Infinite loop */
- /* USER CODE BEGIN WHILE */
- while (1)
- {
- /* USER CODE END WHILE */
- /* USER CODE BEGIN 3 */
- if(NRF24_write(buf, 32))
- {
- HAL_UART_Transmit(&huart1, (uint8_t *)"Transmitted Successfully\r\n", strlen("Transmitted Successfully\r\n"), 10);
- }
- else
- {
- HAL_UART_Transmit(&huart1, (uint8_t *)"Error\r\n", strlen("Error\r\n"), 10);
- }
- HAL_Delay(2000);
- }
- /* USER CODE END 3 */
- }
Add Comment
Please, Sign In to add comment