Rev 63 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 63 | Rev 64 | ||
---|---|---|---|
Line 45... | Line 45... | ||
45 | /* USER CODE BEGIN PM */ |
45 | /* USER CODE BEGIN PM */ |
46 | 46 | ||
47 | /* USER CODE END PM */ |
47 | /* USER CODE END PM */ |
48 | 48 | ||
49 | /* Private variables ---------------------------------------------------------*/ |
49 | /* Private variables ---------------------------------------------------------*/ |
- | 50 | I2C_HandleTypeDef hi2c1; |
|
- | 51 | ||
50 | SPI_HandleTypeDef hspi1; |
52 | SPI_HandleTypeDef hspi1; |
51 | 53 | ||
52 | TIM_HandleTypeDef htim2; |
54 | TIM_HandleTypeDef htim2; |
53 | TIM_HandleTypeDef htim3; |
55 | TIM_HandleTypeDef htim3; |
54 | TIM_HandleTypeDef htim9; |
56 | TIM_HandleTypeDef htim9; |
Line 96... | Line 98... | ||
96 | static void MX_USART3_UART_Init(void); |
98 | static void MX_USART3_UART_Init(void); |
97 | static void MX_TIM3_Init(void); |
99 | static void MX_TIM3_Init(void); |
98 | static void MX_TIM9_Init(void); |
100 | static void MX_TIM9_Init(void); |
99 | static void MX_TIM2_Init(void); |
101 | static void MX_TIM2_Init(void); |
100 | static void MX_UART4_Init(void); |
102 | static void MX_UART4_Init(void); |
- | 103 | static void MX_I2C1_Init(void); |
|
101 | /* USER CODE BEGIN PFP */ |
104 | /* USER CODE BEGIN PFP */ |
102 | 105 | ||
103 | // the dial is the switch number we are using. |
106 | // the dial is the switch number we are using. |
104 | // suppress is the ItemIndex we wish to suppress on this display |
107 | // suppress is the ItemIndex we wish to suppress on this display |
105 | int DisplayCurrent(int dial, int suppress) |
108 | int DisplayCurrent(int dial, int suppress) |
Line 152... | Line 155... | ||
152 | /* USER CODE BEGIN 0 */ |
155 | /* USER CODE BEGIN 0 */ |
153 | 156 | ||
154 | /* USER CODE END 0 */ |
157 | /* USER CODE END 0 */ |
155 | 158 | ||
156 | /** |
159 | /** |
157 | * @brief The application entry point. |
160 | * @brief The application entry point. |
158 | * @retval int |
161 | * @retval int |
159 | */ |
162 | */ |
160 | int main(void) |
163 | int main(void) |
161 | { |
164 | { |
162 | /* USER CODE BEGIN 1 */ |
165 | /* USER CODE BEGIN 1 */ |
163 | __HAL_RCC_SPI1_CLK_ENABLE(); |
166 | __HAL_RCC_SPI1_CLK_ENABLE(); |
164 | __HAL_RCC_USART1_CLK_ENABLE(); // PLX main port |
167 | __HAL_RCC_USART1_CLK_ENABLE(); // PLX main port |
Line 198... | Line 201... | ||
198 | MX_USART3_UART_Init(); |
201 | MX_USART3_UART_Init(); |
199 | MX_TIM3_Init(); |
202 | MX_TIM3_Init(); |
200 | MX_TIM9_Init(); |
203 | MX_TIM9_Init(); |
201 | MX_TIM2_Init(); |
204 | MX_TIM2_Init(); |
202 | MX_UART4_Init(); |
205 | MX_UART4_Init(); |
- | 206 | MX_I2C1_Init(); |
|
203 | /* USER CODE BEGIN 2 */ |
207 | /* USER CODE BEGIN 2 */ |
204 | 208 | ||
205 | /* Turn on USART1 IRQ */ |
209 | /* Turn on USART1 IRQ */ |
206 | HAL_NVIC_SetPriority(USART1_IRQn, 2, 0); |
210 | HAL_NVIC_SetPriority(USART1_IRQn, 2, 0); |
207 | HAL_NVIC_EnableIRQ(USART1_IRQn); |
211 | HAL_NVIC_EnableIRQ(USART1_IRQn); |
Line 459... | Line 463... | ||
459 | } |
463 | } |
460 | /* USER CODE END 3 */ |
464 | /* USER CODE END 3 */ |
461 | } |
465 | } |
462 | 466 | ||
463 | /** |
467 | /** |
464 | * @brief System Clock Configuration |
468 | * @brief System Clock Configuration |
465 | * @retval None |
469 | * @retval None |
466 | */ |
470 | */ |
467 | void SystemClock_Config(void) |
471 | void SystemClock_Config(void) |
468 | { |
472 | { |
469 | RCC_OscInitTypeDef RCC_OscInitStruct = {0}; |
473 | RCC_OscInitTypeDef RCC_OscInitStruct = {0}; |
470 | RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; |
474 | RCC_ClkInitTypeDef RCC_ClkInitStruct = {0}; |
471 | 475 | ||
472 | /** Configure the main internal regulator output voltage |
476 | /** Configure the main internal regulator output voltage |
473 | */ |
477 | */ |
474 | __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1); |
478 | __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1); |
475 | 479 | ||
476 | /** Initializes the RCC Oscillators according to the specified parameters |
480 | /** Initializes the RCC Oscillators according to the specified parameters |
477 | * in the RCC_OscInitTypeDef structure. |
481 | * in the RCC_OscInitTypeDef structure. |
478 | */ |
482 | */ |
479 | RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; |
483 | RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; |
480 | RCC_OscInitStruct.HSEState = RCC_HSE_ON; |
484 | RCC_OscInitStruct.HSEState = RCC_HSE_ON; |
481 | RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; |
485 | RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; |
482 | RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE; |
486 | RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE; |
483 | RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL12; |
487 | RCC_OscInitStruct.PLL.PLLMUL = RCC_PLL_MUL12; |
Line 486... | Line 490... | ||
486 | { |
490 | { |
487 | Error_Handler(); |
491 | Error_Handler(); |
488 | } |
492 | } |
489 | 493 | ||
490 | /** Initializes the CPU, AHB and APB buses clocks |
494 | /** Initializes the CPU, AHB and APB buses clocks |
491 | */ |
495 | */ |
492 | RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2; |
496 | RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK |
- | 497 | |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2; |
|
493 | RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; |
498 | RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; |
494 | RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; |
499 | RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; |
495 | RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1; |
500 | RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1; |
496 | RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1; |
501 | RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1; |
497 | 502 | ||
Line 500... | Line 505... | ||
500 | Error_Handler(); |
505 | Error_Handler(); |
501 | } |
506 | } |
502 | } |
507 | } |
503 | 508 | ||
504 | /** |
509 | /** |
- | 510 | * @brief I2C1 Initialization Function |
|
- | 511 | * @param None |
|
- | 512 | * @retval None |
|
- | 513 | */ |
|
- | 514 | static void MX_I2C1_Init(void) |
|
- | 515 | { |
|
- | 516 | ||
- | 517 | /* USER CODE BEGIN I2C1_Init 0 */ |
|
- | 518 | ||
- | 519 | /* USER CODE END I2C1_Init 0 */ |
|
- | 520 | ||
- | 521 | /* USER CODE BEGIN I2C1_Init 1 */ |
|
- | 522 | ||
- | 523 | /* USER CODE END I2C1_Init 1 */ |
|
- | 524 | hi2c1.Instance = I2C1; |
|
- | 525 | hi2c1.Init.ClockSpeed = 100000; |
|
- | 526 | hi2c1.Init.DutyCycle = I2C_DUTYCYCLE_2; |
|
- | 527 | hi2c1.Init.OwnAddress1 = 0; |
|
- | 528 | hi2c1.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT; |
|
- | 529 | hi2c1.Init.DualAddressMode = I2C_DUALADDRESS_DISABLE; |
|
- | 530 | hi2c1.Init.OwnAddress2 = 0; |
|
- | 531 | hi2c1.Init.GeneralCallMode = I2C_GENERALCALL_DISABLE; |
|
- | 532 | hi2c1.Init.NoStretchMode = I2C_NOSTRETCH_DISABLE; |
|
- | 533 | if (HAL_I2C_Init(&hi2c1) != HAL_OK) |
|
- | 534 | { |
|
- | 535 | Error_Handler(); |
|
- | 536 | } |
|
- | 537 | /* USER CODE BEGIN I2C1_Init 2 */ |
|
- | 538 | ||
- | 539 | /* USER CODE END I2C1_Init 2 */ |
|
- | 540 | ||
- | 541 | } |
|
- | 542 | ||
- | 543 | /** |
|
505 | * @brief SPI1 Initialization Function |
544 | * @brief SPI1 Initialization Function |
506 | * @param None |
545 | * @param None |
507 | * @retval None |
546 | * @retval None |
508 | */ |
547 | */ |
509 | static void MX_SPI1_Init(void) |
548 | static void MX_SPI1_Init(void) |
510 | { |
549 | { |
511 | 550 | ||
512 | /* USER CODE BEGIN SPI1_Init 0 */ |
551 | /* USER CODE BEGIN SPI1_Init 0 */ |
513 | 552 | ||
Line 534... | Line 573... | ||
534 | Error_Handler(); |
573 | Error_Handler(); |
535 | } |
574 | } |
536 | /* USER CODE BEGIN SPI1_Init 2 */ |
575 | /* USER CODE BEGIN SPI1_Init 2 */ |
537 | 576 | ||
538 | /* USER CODE END SPI1_Init 2 */ |
577 | /* USER CODE END SPI1_Init 2 */ |
- | 578 | ||
539 | } |
579 | } |
540 | 580 | ||
541 | /** |
581 | /** |
542 | * @brief TIM2 Initialization Function |
582 | * @brief TIM2 Initialization Function |
543 | * @param None |
583 | * @param None |
544 | * @retval None |
584 | * @retval None |
545 | */ |
585 | */ |
546 | static void MX_TIM2_Init(void) |
586 | static void MX_TIM2_Init(void) |
547 | { |
587 | { |
548 | 588 | ||
549 | /* USER CODE BEGIN TIM2_Init 0 */ |
589 | /* USER CODE BEGIN TIM2_Init 0 */ |
550 | 590 | ||
Line 578... | Line 618... | ||
578 | Error_Handler(); |
618 | Error_Handler(); |
579 | } |
619 | } |
580 | /* USER CODE BEGIN TIM2_Init 2 */ |
620 | /* USER CODE BEGIN TIM2_Init 2 */ |
581 | 621 | ||
582 | /* USER CODE END TIM2_Init 2 */ |
622 | /* USER CODE END TIM2_Init 2 */ |
- | 623 | ||
583 | } |
624 | } |
584 | 625 | ||
585 | /** |
626 | /** |
586 | * @brief TIM3 Initialization Function |
627 | * @brief TIM3 Initialization Function |
587 | * @param None |
628 | * @param None |
588 | * @retval None |
629 | * @retval None |
589 | */ |
630 | */ |
590 | static void MX_TIM3_Init(void) |
631 | static void MX_TIM3_Init(void) |
591 | { |
632 | { |
592 | 633 | ||
593 | /* USER CODE BEGIN TIM3_Init 0 */ |
634 | /* USER CODE BEGIN TIM3_Init 0 */ |
594 | 635 | ||
Line 626... | Line 667... | ||
626 | Error_Handler(); |
667 | Error_Handler(); |
627 | } |
668 | } |
628 | /* USER CODE BEGIN TIM3_Init 2 */ |
669 | /* USER CODE BEGIN TIM3_Init 2 */ |
629 | 670 | ||
630 | /* USER CODE END TIM3_Init 2 */ |
671 | /* USER CODE END TIM3_Init 2 */ |
- | 672 | ||
631 | } |
673 | } |
632 | 674 | ||
633 | /** |
675 | /** |
634 | * @brief TIM9 Initialization Function |
676 | * @brief TIM9 Initialization Function |
635 | * @param None |
677 | * @param None |
636 | * @retval None |
678 | * @retval None |
637 | */ |
679 | */ |
638 | static void MX_TIM9_Init(void) |
680 | static void MX_TIM9_Init(void) |
639 | { |
681 | { |
640 | 682 | ||
641 | /* USER CODE BEGIN TIM9_Init 0 */ |
683 | /* USER CODE BEGIN TIM9_Init 0 */ |
642 | 684 | ||
Line 674... | Line 716... | ||
674 | Error_Handler(); |
716 | Error_Handler(); |
675 | } |
717 | } |
676 | /* USER CODE BEGIN TIM9_Init 2 */ |
718 | /* USER CODE BEGIN TIM9_Init 2 */ |
677 | 719 | ||
678 | /* USER CODE END TIM9_Init 2 */ |
720 | /* USER CODE END TIM9_Init 2 */ |
- | 721 | ||
679 | } |
722 | } |
680 | 723 | ||
681 | /** |
724 | /** |
682 | * @brief UART4 Initialization Function |
725 | * @brief UART4 Initialization Function |
683 | * @param None |
726 | * @param None |
684 | * @retval None |
727 | * @retval None |
685 | */ |
728 | */ |
686 | static void MX_UART4_Init(void) |
729 | static void MX_UART4_Init(void) |
687 | { |
730 | { |
688 | 731 | ||
689 | /* USER CODE BEGIN UART4_Init 0 */ |
732 | /* USER CODE BEGIN UART4_Init 0 */ |
690 | 733 | ||
Line 706... | Line 749... | ||
706 | Error_Handler(); |
749 | Error_Handler(); |
707 | } |
750 | } |
708 | /* USER CODE BEGIN UART4_Init 2 */ |
751 | /* USER CODE BEGIN UART4_Init 2 */ |
709 | 752 | ||
710 | /* USER CODE END UART4_Init 2 */ |
753 | /* USER CODE END UART4_Init 2 */ |
- | 754 | ||
711 | } |
755 | } |
712 | 756 | ||
713 | /** |
757 | /** |
714 | * @brief USART1 Initialization Function |
758 | * @brief USART1 Initialization Function |
715 | * @param None |
759 | * @param None |
716 | * @retval None |
760 | * @retval None |
717 | */ |
761 | */ |
718 | static void MX_USART1_UART_Init(void) |
762 | static void MX_USART1_UART_Init(void) |
719 | { |
763 | { |
720 | 764 | ||
721 | /* USER CODE BEGIN USART1_Init 0 */ |
765 | /* USER CODE BEGIN USART1_Init 0 */ |
722 | 766 | ||
Line 738... | Line 782... | ||
738 | Error_Handler(); |
782 | Error_Handler(); |
739 | } |
783 | } |
740 | /* USER CODE BEGIN USART1_Init 2 */ |
784 | /* USER CODE BEGIN USART1_Init 2 */ |
741 | 785 | ||
742 | /* USER CODE END USART1_Init 2 */ |
786 | /* USER CODE END USART1_Init 2 */ |
- | 787 | ||
743 | } |
788 | } |
744 | 789 | ||
745 | /** |
790 | /** |
746 | * @brief USART2 Initialization Function |
791 | * @brief USART2 Initialization Function |
747 | * @param None |
792 | * @param None |
748 | * @retval None |
793 | * @retval None |
749 | */ |
794 | */ |
750 | static void MX_USART2_UART_Init(void) |
795 | static void MX_USART2_UART_Init(void) |
751 | { |
796 | { |
752 | 797 | ||
753 | /* USER CODE BEGIN USART2_Init 0 */ |
798 | /* USER CODE BEGIN USART2_Init 0 */ |
754 | 799 | ||
Line 770... | Line 815... | ||
770 | Error_Handler(); |
815 | Error_Handler(); |
771 | } |
816 | } |
772 | /* USER CODE BEGIN USART2_Init 2 */ |
817 | /* USER CODE BEGIN USART2_Init 2 */ |
773 | 818 | ||
774 | /* USER CODE END USART2_Init 2 */ |
819 | /* USER CODE END USART2_Init 2 */ |
- | 820 | ||
775 | } |
821 | } |
776 | 822 | ||
777 | /** |
823 | /** |
778 | * @brief USART3 Initialization Function |
824 | * @brief USART3 Initialization Function |
779 | * @param None |
825 | * @param None |
780 | * @retval None |
826 | * @retval None |
781 | */ |
827 | */ |
782 | static void MX_USART3_UART_Init(void) |
828 | static void MX_USART3_UART_Init(void) |
783 | { |
829 | { |
784 | 830 | ||
785 | /* USER CODE BEGIN USART3_Init 0 */ |
831 | /* USER CODE BEGIN USART3_Init 0 */ |
786 | 832 | ||
Line 802... | Line 848... | ||
802 | Error_Handler(); |
848 | Error_Handler(); |
803 | } |
849 | } |
804 | /* USER CODE BEGIN USART3_Init 2 */ |
850 | /* USER CODE BEGIN USART3_Init 2 */ |
805 | 851 | ||
806 | /* USER CODE END USART3_Init 2 */ |
852 | /* USER CODE END USART3_Init 2 */ |
- | 853 | ||
807 | } |
854 | } |
808 | 855 | ||
809 | /** |
856 | /** |
810 | * @brief GPIO Initialization Function |
857 | * @brief GPIO Initialization Function |
811 | * @param None |
858 | * @param None |
812 | * @retval None |
859 | * @retval None |
813 | */ |
860 | */ |
814 | static void MX_GPIO_Init(void) |
861 | static void MX_GPIO_Init(void) |
815 | { |
862 | { |
816 | GPIO_InitTypeDef GPIO_InitStruct = {0}; |
863 | GPIO_InitTypeDef GPIO_InitStruct = {0}; |
817 | 864 | ||
818 | /* GPIO Ports Clock Enable */ |
865 | /* GPIO Ports Clock Enable */ |
Line 823... | Line 870... | ||
823 | 870 | ||
824 | /*Configure GPIO pin Output Level */ |
871 | /*Configure GPIO pin Output Level */ |
825 | HAL_GPIO_WritePin(SPI_NSS1_GPIO_Port, SPI_NSS1_Pin, GPIO_PIN_SET); |
872 | HAL_GPIO_WritePin(SPI_NSS1_GPIO_Port, SPI_NSS1_Pin, GPIO_PIN_SET); |
826 | 873 | ||
827 | /*Configure GPIO pin Output Level */ |
874 | /*Configure GPIO pin Output Level */ |
828 | HAL_GPIO_WritePin(GPIOA, SPI_CD_Pin | BT_BUTTON_Pin, GPIO_PIN_RESET); |
875 | HAL_GPIO_WritePin(GPIOA, SPI_CD_Pin|BT_BUTTON_Pin, GPIO_PIN_RESET); |
829 | 876 | ||
830 | /*Configure GPIO pin Output Level */ |
877 | /*Configure GPIO pin Output Level */ |
831 | HAL_GPIO_WritePin(GPIOC, SPI_RESET_Pin | POWER_LATCH_Pin | USB_PWR_Pin, GPIO_PIN_RESET); |
878 | HAL_GPIO_WritePin(GPIOC, SPI_RESET_Pin|POWER_LATCH_Pin|USB_PWR_Pin, GPIO_PIN_RESET); |
832 | 879 | ||
833 | /*Configure GPIO pin Output Level */ |
880 | /*Configure GPIO pin Output Level */ |
834 | HAL_GPIO_WritePin(SPI_NSS2_GPIO_Port, SPI_NSS2_Pin, GPIO_PIN_SET); |
881 | HAL_GPIO_WritePin(SPI_NSS2_GPIO_Port, SPI_NSS2_Pin, GPIO_PIN_SET); |
835 | 882 | ||
836 | /*Configure GPIO pins : SPI_NSS1_Pin SPI_CD_Pin */ |
883 | /*Configure GPIO pins : SPI_NSS1_Pin SPI_CD_Pin */ |
837 | GPIO_InitStruct.Pin = SPI_NSS1_Pin | SPI_CD_Pin; |
884 | GPIO_InitStruct.Pin = SPI_NSS1_Pin|SPI_CD_Pin; |
838 | GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; |
885 | GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; |
839 | GPIO_InitStruct.Pull = GPIO_NOPULL; |
886 | GPIO_InitStruct.Pull = GPIO_NOPULL; |
840 | GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; |
887 | GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; |
841 | HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); |
888 | HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); |
842 | 889 | ||
843 | /*Configure GPIO pins : SPI_RESET_Pin SPI_NSS2_Pin POWER_LATCH_Pin USB_PWR_Pin */ |
890 | /*Configure GPIO pins : SPI_RESET_Pin SPI_NSS2_Pin POWER_LATCH_Pin USB_PWR_Pin */ |
844 | GPIO_InitStruct.Pin = SPI_RESET_Pin | SPI_NSS2_Pin | POWER_LATCH_Pin | USB_PWR_Pin; |
891 | GPIO_InitStruct.Pin = SPI_RESET_Pin|SPI_NSS2_Pin|POWER_LATCH_Pin|USB_PWR_Pin; |
845 | GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; |
892 | GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; |
846 | GPIO_InitStruct.Pull = GPIO_NOPULL; |
893 | GPIO_InitStruct.Pull = GPIO_NOPULL; |
847 | GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; |
894 | GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; |
848 | HAL_GPIO_Init(GPIOC, &GPIO_InitStruct); |
895 | HAL_GPIO_Init(GPIOC, &GPIO_InitStruct); |
849 | 896 | ||
850 | /*Configure GPIO pins : BT_STATE_Pin SW1_PUSH_Pin SW2_PUSH_Pin */ |
897 | /*Configure GPIO pins : BT_STATE_Pin SW1_PUSH_Pin SW2_PUSH_Pin */ |
851 | GPIO_InitStruct.Pin = BT_STATE_Pin | SW1_PUSH_Pin | SW2_PUSH_Pin; |
898 | GPIO_InitStruct.Pin = BT_STATE_Pin|SW1_PUSH_Pin|SW2_PUSH_Pin; |
852 | GPIO_InitStruct.Mode = GPIO_MODE_INPUT; |
899 | GPIO_InitStruct.Mode = GPIO_MODE_INPUT; |
853 | GPIO_InitStruct.Pull = GPIO_PULLUP; |
900 | GPIO_InitStruct.Pull = GPIO_PULLUP; |
854 | HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); |
901 | HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); |
855 | 902 | ||
856 | /*Configure GPIO pin : IGNITION_Pin */ |
903 | /*Configure GPIO pin : IGNITION_Pin */ |
Line 863... | Line 910... | ||
863 | GPIO_InitStruct.Pin = BT_BUTTON_Pin; |
910 | GPIO_InitStruct.Pin = BT_BUTTON_Pin; |
864 | GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_OD; |
911 | GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_OD; |
865 | GPIO_InitStruct.Pull = GPIO_NOPULL; |
912 | GPIO_InitStruct.Pull = GPIO_NOPULL; |
866 | GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; |
913 | GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; |
867 | HAL_GPIO_Init(BT_BUTTON_GPIO_Port, &GPIO_InitStruct); |
914 | HAL_GPIO_Init(BT_BUTTON_GPIO_Port, &GPIO_InitStruct); |
- | 915 | ||
868 | } |
916 | } |
869 | 917 | ||
870 | /* USER CODE BEGIN 4 */ |
918 | /* USER CODE BEGIN 4 */ |
871 | 919 | ||
872 | /* USER CODE END 4 */ |
920 | /* USER CODE END 4 */ |
873 | 921 | ||
874 | /** |
922 | /** |
875 | * @brief This function is executed in case of error occurrence. |
923 | * @brief This function is executed in case of error occurrence. |
876 | * @retval None |
924 | * @retval None |
877 | */ |
925 | */ |
878 | void Error_Handler(void) |
926 | void Error_Handler(void) |
879 | { |
927 | { |
880 | /* USER CODE BEGIN Error_Handler_Debug */ |
928 | /* USER CODE BEGIN Error_Handler_Debug */ |
881 | /* User can add his own implementation to report the HAL error return state */ |
929 | /* User can add his own implementation to report the HAL error return state */ |
882 | 930 | ||
883 | /* USER CODE END Error_Handler_Debug */ |
931 | /* USER CODE END Error_Handler_Debug */ |
884 | } |
932 | } |
885 | 933 | ||
886 | #ifdef USE_FULL_ASSERT |
934 | #ifdef USE_FULL_ASSERT |
887 | /** |
935 | /** |
888 | * @brief Reports the name of the source file and the source line number |
936 | * @brief Reports the name of the source file and the source line number |
889 | * where the assert_param error has occurred. |
937 | * where the assert_param error has occurred. |
890 | * @param file: pointer to the source file name |
938 | * @param file: pointer to the source file name |
891 | * @param line: assert_param error line source number |
939 | * @param line: assert_param error line source number |
892 | * @retval None |
940 | * @retval None |
893 | */ |
941 | */ |
894 | void assert_failed(uint8_t *file, uint32_t line) |
942 | void assert_failed(uint8_t *file, uint32_t line) |
895 | { |
943 | { |
896 | /* USER CODE BEGIN 6 */ |
944 | /* USER CODE BEGIN 6 */ |
897 | /* User can add his own implementation to report the file name and line number, |
945 | /* User can add his own implementation to report the file name and line number, |
898 | tex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */ |
946 | tex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */ |