Rev 2 | Rev 4 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 2 | Rev 3 | ||
|---|---|---|---|
| Line 1... | Line 1... | ||
| 1 | /* USER CODE BEGIN Header */ |
1 | /* USER CODE BEGIN Header */ |
| 2 | /** |
2 | /** |
| 3 | ****************************************************************************** |
3 | ****************************************************************************** |
| 4 | * @file : main.c |
4 | * @file : main.c |
| 5 | * @brief : Main program body |
5 | * @brief : Main program body |
| 6 | ****************************************************************************** |
6 | ****************************************************************************** |
| 7 | * @attention |
7 | * @attention |
| 8 | * |
8 | * |
| 9 | * Copyright (c) 2023 STMicroelectronics. |
9 | * Copyright (c) 2023 STMicroelectronics. |
| 10 | * All rights reserved. |
10 | * All rights reserved. |
| 11 | * |
11 | * |
| 12 | * This software is licensed under terms that can be found in the LICENSE file |
12 | * This software is licensed under terms that can be found in the LICENSE file |
| 13 | * in the root directory of this software component. |
13 | * in the root directory of this software component. |
| 14 | * If no LICENSE file comes with this software, it is provided AS-IS. |
14 | * If no LICENSE file comes with this software, it is provided AS-IS. |
| 15 | * |
15 | * |
| 16 | ****************************************************************************** |
16 | ****************************************************************************** |
| 17 | */ |
17 | */ |
| 18 | /* USER CODE END Header */ |
18 | /* USER CODE END Header */ |
| 19 | /* Includes ------------------------------------------------------------------*/ |
19 | /* Includes ------------------------------------------------------------------*/ |
| 20 | #include "main.h" |
20 | #include "main.h" |
| 21 | 21 | ||
| 22 | /* Private includes ----------------------------------------------------------*/ |
22 | /* Private includes ----------------------------------------------------------*/ |
| Line 39... | Line 39... | ||
| 39 | /* USER CODE BEGIN PD */ |
39 | /* USER CODE BEGIN PD */ |
| 40 | /* USER CODE END PD */ |
40 | /* USER CODE END PD */ |
| 41 | 41 | ||
| 42 | /* Private macro -------------------------------------------------------------*/ |
42 | /* Private macro -------------------------------------------------------------*/ |
| 43 | /* USER CODE BEGIN PM */ |
43 | /* USER CODE BEGIN PM */ |
| - | 44 | ||
| 44 | /* USER CODE END PM */ |
45 | /* USER CODE END PM */ |
| 45 | 46 | ||
| 46 | /* Private variables ---------------------------------------------------------*/ |
47 | /* Private variables ---------------------------------------------------------*/ |
| 47 | CAN_HandleTypeDef hcan; |
48 | CAN_HandleTypeDef hcan; |
| 48 | 49 | ||
| Line 92... | Line 93... | ||
| 92 | int i; |
93 | int i; |
| 93 | for (i = 0; i < sizeof(PLX_SensorInfo);++i) |
94 | for (i = 0; i < sizeof(PLX_SensorInfo);++i) |
| 94 | PutCharSerial(&uc2, info.bytes[i]); |
95 | PutCharSerial(&uc2, info.bytes[i]); |
| 95 | } |
96 | } |
| 96 | 97 | ||
| - | 98 | void triggerSAW() |
|
| - | 99 | { |
|
| - | 100 | ///@todo trigger the PIP signal on Timer 2 |
|
| - | 101 | } |
|
| - | 102 | ||
| 97 | /* USER CODE END PFP */ |
103 | /* USER CODE END PFP */ |
| 98 | 104 | ||
| 99 | /* Private user code ---------------------------------------------------------*/ |
105 | /* Private user code ---------------------------------------------------------*/ |
| 100 | /* USER CODE BEGIN 0 */ |
106 | /* USER CODE BEGIN 0 */ |
| 101 | 107 | ||
| Line 410... | Line 416... | ||
| 410 | /* USER CODE BEGIN IWDG_Init 1 */ |
416 | /* USER CODE BEGIN IWDG_Init 1 */ |
| 411 | 417 | ||
| 412 | /* USER CODE END IWDG_Init 1 */ |
418 | /* USER CODE END IWDG_Init 1 */ |
| 413 | hiwdg.Instance = IWDG; |
419 | hiwdg.Instance = IWDG; |
| 414 | hiwdg.Init.Prescaler = IWDG_PRESCALER_4; |
420 | hiwdg.Init.Prescaler = IWDG_PRESCALER_4; |
| 415 | hiwdg.Init.Reload = 4095; |
421 | hiwdg.Init.Reload = 819; |
| 416 | if (HAL_IWDG_Init(&hiwdg) != HAL_OK) |
422 | if (HAL_IWDG_Init(&hiwdg) != HAL_OK) |
| 417 | { |
423 | { |
| 418 | Error_Handler(); |
424 | Error_Handler(); |
| 419 | } |
425 | } |
| 420 | /* USER CODE BEGIN IWDG_Init 2 */ |
426 | /* USER CODE BEGIN IWDG_Init 2 */ |
| Line 691... | Line 697... | ||
| 691 | __HAL_RCC_GPIOD_CLK_ENABLE(); |
697 | __HAL_RCC_GPIOD_CLK_ENABLE(); |
| 692 | __HAL_RCC_GPIOA_CLK_ENABLE(); |
698 | __HAL_RCC_GPIOA_CLK_ENABLE(); |
| 693 | __HAL_RCC_GPIOB_CLK_ENABLE(); |
699 | __HAL_RCC_GPIOB_CLK_ENABLE(); |
| 694 | 700 | ||
| 695 | /*Configure GPIO pin Output Level */ |
701 | /*Configure GPIO pin Output Level */ |
| 696 | HAL_GPIO_WritePin(GPIOA, SPI1_NSS_Pin|SPI1_RESET_Pin, GPIO_PIN_RESET); |
702 | HAL_GPIO_WritePin(GPIOA, GPIO_PIN_4|GPIO_PIN_6, GPIO_PIN_RESET); |
| 697 | 703 | ||
| 698 | /*Configure GPIO pin Output Level */ |
704 | /*Configure GPIO pin Output Level */ |
| 699 | HAL_GPIO_WritePin(SPI1_CD_GPIO_Port, SPI1_CD_Pin, GPIO_PIN_RESET); |
705 | HAL_GPIO_WritePin(GPIOB, GPIO_PIN_0, GPIO_PIN_RESET); |
| 700 | 706 | ||
| 701 | /*Configure GPIO pins : SPI1_NSS_Pin SPI1_RESET_Pin */ |
707 | /*Configure GPIO pins : PA4 PA6 */ |
| 702 | GPIO_InitStruct.Pin = SPI1_NSS_Pin|SPI1_RESET_Pin; |
708 | GPIO_InitStruct.Pin = GPIO_PIN_4|GPIO_PIN_6; |
| 703 | GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; |
709 | GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; |
| 704 | GPIO_InitStruct.Pull = GPIO_NOPULL; |
710 | GPIO_InitStruct.Pull = GPIO_NOPULL; |
| 705 | GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; |
711 | GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; |
| 706 | HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); |
712 | HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); |
| 707 | 713 | ||
| 708 | /*Configure GPIO pin : SPI1_CD_Pin */ |
714 | /*Configure GPIO pin : PB0 */ |
| 709 | GPIO_InitStruct.Pin = SPI1_CD_Pin; |
715 | GPIO_InitStruct.Pin = GPIO_PIN_0; |
| 710 | GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; |
716 | GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; |
| 711 | GPIO_InitStruct.Pull = GPIO_NOPULL; |
717 | GPIO_InitStruct.Pull = GPIO_NOPULL; |
| 712 | GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; |
718 | GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW; |
| 713 | HAL_GPIO_Init(SPI1_CD_GPIO_Port, &GPIO_InitStruct); |
719 | HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); |
| 714 | 720 | ||
| 715 | /*Configure GPIO pin : PUSHBUTTON_Pin */ |
721 | /*Configure GPIO pin : PB12 */ |
| 716 | GPIO_InitStruct.Pin = PUSHBUTTON_Pin; |
722 | GPIO_InitStruct.Pin = GPIO_PIN_12; |
| 717 | GPIO_InitStruct.Mode = GPIO_MODE_INPUT; |
723 | GPIO_InitStruct.Mode = GPIO_MODE_INPUT; |
| 718 | GPIO_InitStruct.Pull = GPIO_PULLUP; |
724 | GPIO_InitStruct.Pull = GPIO_PULLUP; |
| 719 | HAL_GPIO_Init(PUSHBUTTON_GPIO_Port, &GPIO_InitStruct); |
725 | HAL_GPIO_Init(GPIOB, &GPIO_InitStruct); |
| 720 | 726 | ||
| 721 | /*Configure GPIO pin : dualSpark_Pin */ |
727 | /*Configure GPIO pin : PA9 */ |
| 722 | GPIO_InitStruct.Pin = dualSpark_Pin; |
728 | GPIO_InitStruct.Pin = GPIO_PIN_9; |
| 723 | GPIO_InitStruct.Mode = GPIO_MODE_INPUT; |
729 | GPIO_InitStruct.Mode = GPIO_MODE_INPUT; |
| 724 | GPIO_InitStruct.Pull = GPIO_PULLUP; |
730 | GPIO_InitStruct.Pull = GPIO_PULLUP; |
| 725 | HAL_GPIO_Init(dualSpark_GPIO_Port, &GPIO_InitStruct); |
731 | HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); |
| 726 | 732 | ||
| 727 | } |
733 | } |
| 728 | 734 | ||
| 729 | /* USER CODE BEGIN 4 */ |
735 | /* USER CODE BEGIN 4 */ |
| 730 | 736 | ||