cis001v2

Committer:
thomashaine
Date:
Wed Feb 10 16:38:32 2021 +0000
Revision:
8:66caa906d24c
Parent:
7:4c77f017b4b8
v2

Who changed what in which revision?

UserRevisionLine numberNew contents of line
thomashaine 0:e7352f4f3dcb 1 /* USER CODE BEGIN Header */
thomashaine 0:e7352f4f3dcb 2 /**
thomashaine 0:e7352f4f3dcb 3 ******************************************************************************
thomashaine 0:e7352f4f3dcb 4 * @file : main.h
thomashaine 0:e7352f4f3dcb 5 * @brief : Header for main.c file.
thomashaine 0:e7352f4f3dcb 6 * This file contains the common defines of the application.
thomashaine 0:e7352f4f3dcb 7 ******************************************************************************
thomashaine 0:e7352f4f3dcb 8 * @attention
thomashaine 0:e7352f4f3dcb 9 *
thomashaine 0:e7352f4f3dcb 10 * <h2><center>&copy; Copyright (c) 2020 STMicroelectronics.
thomashaine 0:e7352f4f3dcb 11 * All rights reserved.</center></h2>
thomashaine 0:e7352f4f3dcb 12 *
thomashaine 0:e7352f4f3dcb 13 * This software component is licensed by ST under BSD 3-Clause license,
thomashaine 0:e7352f4f3dcb 14 * the "License"; You may not use this file except in compliance with the
thomashaine 0:e7352f4f3dcb 15 * License. You may obtain a copy of the License at:
thomashaine 0:e7352f4f3dcb 16 * opensource.org/licenses/BSD-3-Clause
thomashaine 0:e7352f4f3dcb 17 *
thomashaine 0:e7352f4f3dcb 18 ******************************************************************************
thomashaine 0:e7352f4f3dcb 19 */
thomashaine 0:e7352f4f3dcb 20 /* USER CODE END Header */
thomashaine 0:e7352f4f3dcb 21
thomashaine 0:e7352f4f3dcb 22 /* Define to prevent recursive inclusion -------------------------------------*/
thomashaine 0:e7352f4f3dcb 23 #ifndef __MAIN_H
thomashaine 0:e7352f4f3dcb 24 #define __MAIN_H
thomashaine 0:e7352f4f3dcb 25
thomashaine 0:e7352f4f3dcb 26 #ifdef __cplusplus
thomashaine 0:e7352f4f3dcb 27 extern "C" {
thomashaine 0:e7352f4f3dcb 28 #endif
thomashaine 0:e7352f4f3dcb 29
thomashaine 0:e7352f4f3dcb 30 /* Includes ------------------------------------------------------------------*/
thomashaine 0:e7352f4f3dcb 31 #include "stm32h7xx_hal.h"
thomashaine 0:e7352f4f3dcb 32
thomashaine 7:4c77f017b4b8 33
thomashaine 0:e7352f4f3dcb 34 /* Private includes ----------------------------------------------------------*/
thomashaine 0:e7352f4f3dcb 35 /* USER CODE BEGIN Includes */
thomashaine 0:e7352f4f3dcb 36
thomashaine 0:e7352f4f3dcb 37 /* USER CODE END Includes */
thomashaine 0:e7352f4f3dcb 38
thomashaine 0:e7352f4f3dcb 39 /* Exported types ------------------------------------------------------------*/
thomashaine 0:e7352f4f3dcb 40 /* USER CODE BEGIN ET */
thomashaine 0:e7352f4f3dcb 41
thomashaine 0:e7352f4f3dcb 42 /* USER CODE END ET */
thomashaine 0:e7352f4f3dcb 43
thomashaine 0:e7352f4f3dcb 44 /* Exported constants --------------------------------------------------------*/
thomashaine 0:e7352f4f3dcb 45 /* USER CODE BEGIN EC */
thomashaine 0:e7352f4f3dcb 46
thomashaine 6:b544e474f959 47 const int frame_bsize_8b =640*480*1; //640*480 pixels de 1 byte
thomashaine 8:66caa906d24c 48 const int frame_bsize_QVGA_8b =320*240*1; //320*240 pixels de 1 byte
thomashaine 6:b544e474f959 49 const int frame_bsize_QQVGA_8b =160*120*1; //160*120 pixels de 1 byte
thomashaine 8:66caa906d24c 50 const int frame_bsize_10b =640*240*2; //640*240 pixels de 2 bytes
thomashaine 8:66caa906d24c 51 const int frame_bsize_QVGA_10b =320*240*2; //320*240 pixels de 2 bytes
thomashaine 8:66caa906d24c 52 const int frame_bsize_QQVGA_10b =160*120*2; //160*120 pixels de 2 bytes
thomashaine 8:66caa906d24c 53
thomashaine 8:66caa906d24c 54 // same value but in word size
thomashaine 8:66caa906d24c 55 const int frame_wsize_8b =frame_bsize_8b/4; //640*480 pixels de 1 byte /4 pour donner la tailler en word
thomashaine 8:66caa906d24c 56 const int frame_wsize_QVGA_8b =frame_bsize_QVGA_8b/4; //320*240 pixels de 1 byte /4 pour donner la tailler en word
thomashaine 8:66caa906d24c 57 const int frame_wsize_QQVGA_8b =frame_bsize_QQVGA_8b/4; //160*120 pixels de 1 byte /4 pour donner la tailler en word
thomashaine 8:66caa906d24c 58 const int frame_wsize_10b =frame_bsize_10b/4; //640*240 pixels de 2 bytes /4 pour donner la tailler en word
thomashaine 8:66caa906d24c 59 const int frame_wsize_QVGA_10b =frame_bsize_QVGA_10b/4; //320*240 pixels de 2 bytes /4 pour donner la tailler en word
thomashaine 8:66caa906d24c 60 const int frame_wsize_QQVGA_10b =frame_bsize_QQVGA_10b/4; //160*120 pixels de 2 bytes /4 pour donner la tailler en word
thomashaine 8:66caa906d24c 61
thomashaine 8:66caa906d24c 62
thomashaine 0:e7352f4f3dcb 63
thomashaine 0:e7352f4f3dcb 64 /* USER CODE END EC */
thomashaine 0:e7352f4f3dcb 65
thomashaine 0:e7352f4f3dcb 66 /* Exported macro ------------------------------------------------------------*/
thomashaine 0:e7352f4f3dcb 67 /* USER CODE BEGIN EM */
thomashaine 0:e7352f4f3dcb 68
thomashaine 0:e7352f4f3dcb 69 /* USER CODE END EM */
thomashaine 0:e7352f4f3dcb 70
thomashaine 0:e7352f4f3dcb 71 /* Exported functions prototypes ---------------------------------------------*/
thomashaine 0:e7352f4f3dcb 72 void Error_Handler(void);
thomashaine 0:e7352f4f3dcb 73
thomashaine 0:e7352f4f3dcb 74 /* USER CODE BEGIN EFP */
thomashaine 0:e7352f4f3dcb 75
thomashaine 0:e7352f4f3dcb 76 /* Private function prototypes -----------------------------------------------*/
thomashaine 1:5060c8ea0ccd 77 // functions for sending frame over ethernet
thomashaine 1:5060c8ea0ccd 78 void print_start_frame(void);
thomashaine 1:5060c8ea0ccd 79 void send_frame_ethernet(void);
thomashaine 1:5060c8ea0ccd 80 int send_frame_ethernet_nohandshake_while(void);
thomashaine 1:5060c8ea0ccd 81
thomashaine 1:5060c8ea0ccd 82
thomashaine 6:b544e474f959 83 void process_message(int rcount, char* rbuffer);
thomashaine 6:b544e474f959 84
thomashaine 1:5060c8ea0ccd 85 // configuration functions
thomashaine 1:5060c8ea0ccd 86 static void MX_GPIO_Init(void);
thomashaine 1:5060c8ea0ccd 87 static void MX_DMA_Init(void);
thomashaine 1:5060c8ea0ccd 88 static void MX_DCMI_Init_8b(void);
thomashaine 1:5060c8ea0ccd 89 static void MX_DCMI_Init_10b(void);
thomashaine 1:5060c8ea0ccd 90
thomashaine 1:5060c8ea0ccd 91 // capture functions
thomashaine 1:5060c8ea0ccd 92 void start_capture_10b();
thomashaine 1:5060c8ea0ccd 93 void start_video();
thomashaine 1:5060c8ea0ccd 94 void suspend_capture(void);
thomashaine 1:5060c8ea0ccd 95 void resume_capture(void);
thomashaine 1:5060c8ea0ccd 96 void stop_capture(void);
thomashaine 0:e7352f4f3dcb 97
thomashaine 0:e7352f4f3dcb 98
thomashaine 8:66caa906d24c 99 // IRQ handler for DMA/MDMA
thomashaine 8:66caa906d24c 100 //void HAL_DMA_IRQHandler(DMA_HandleTypeDef* hdma);
thomashaine 8:66caa906d24c 101 void DMA2_Stream1_IRQHandler(void);
thomashaine 8:66caa906d24c 102 //void DMA1_Stream0_IRQHandler(void);
thomashaine 8:66caa906d24c 103 //void DMA1_Stream1_IRQHandler(void);
thomashaine 8:66caa906d24c 104 void HAL_DMA_XferErrorCallback (DMA_HandleTypeDef * hddma);
thomashaine 8:66caa906d24c 105 void HAL_DMA_XferCpltCallback (DMA_HandleTypeDef * hddma);
thomashaine 8:66caa906d24c 106
thomashaine 8:66caa906d24c 107 // IRQ and callback handler for DCMI
thomashaine 8:66caa906d24c 108 void HAL_DCMI_FrameEventCallback(DCMI_HandleTypeDef *hdcmi);
thomashaine 8:66caa906d24c 109 void HAL_DCMI_VsyncEventCallback(DCMI_HandleTypeDef *hdcmi);
thomashaine 8:66caa906d24c 110 void HAL_DCMI_LineEventCallback (DCMI_HandleTypeDef *hdcmi);
thomashaine 8:66caa906d24c 111 void HAL_DCMI_ErrorCallback (DCMI_HandleTypeDef *hdcmi);
thomashaine 8:66caa906d24c 112 //void HAL_DCMI_IRQHandler (DCMI_HandleTypeDef * hdcmi);
thomashaine 8:66caa906d24c 113
thomashaine 8:66caa906d24c 114
thomashaine 8:66caa906d24c 115
thomashaine 8:66caa906d24c 116
thomashaine 0:e7352f4f3dcb 117 /* USER CODE END EFP */
thomashaine 0:e7352f4f3dcb 118
thomashaine 0:e7352f4f3dcb 119 /* Private defines -----------------------------------------------------------*/
thomashaine 0:e7352f4f3dcb 120 #define B1_Pin GPIO_PIN_13
thomashaine 0:e7352f4f3dcb 121 #define B1_GPIO_Port GPIOC
thomashaine 0:e7352f4f3dcb 122 #define OSC32_IN_Pin GPIO_PIN_14
thomashaine 0:e7352f4f3dcb 123 #define OSC32_IN_GPIO_Port GPIOC
thomashaine 0:e7352f4f3dcb 124 #define OSC32_OUT_Pin GPIO_PIN_15
thomashaine 0:e7352f4f3dcb 125 #define OSC32_OUT_GPIO_Port GPIOC
thomashaine 0:e7352f4f3dcb 126 #define USB_FS_PWR_EN_Pin GPIO_PIN_10
thomashaine 0:e7352f4f3dcb 127 #define USB_FS_PWR_EN_GPIO_Port GPIOF
thomashaine 0:e7352f4f3dcb 128 #define PH0_MCU_Pin GPIO_PIN_0
thomashaine 0:e7352f4f3dcb 129 #define PH0_MCU_GPIO_Port GPIOH
thomashaine 0:e7352f4f3dcb 130 #define PH1_MCU_Pin GPIO_PIN_1
thomashaine 0:e7352f4f3dcb 131 #define PH1_MCU_GPIO_Port GPIOH
thomashaine 0:e7352f4f3dcb 132 #define LD1_Pin GPIO_PIN_0
thomashaine 0:e7352f4f3dcb 133 #define LD1_GPIO_Port GPIOB
thomashaine 0:e7352f4f3dcb 134 #define LD3_Pin GPIO_PIN_14
thomashaine 0:e7352f4f3dcb 135 #define LD3_GPIO_Port GPIOB
thomashaine 0:e7352f4f3dcb 136 #define STLINK_RX_Pin GPIO_PIN_8
thomashaine 0:e7352f4f3dcb 137 #define STLINK_RX_GPIO_Port GPIOD
thomashaine 0:e7352f4f3dcb 138 #define STLINK_TX_Pin GPIO_PIN_9
thomashaine 0:e7352f4f3dcb 139 #define STLINK_TX_GPIO_Port GPIOD
thomashaine 0:e7352f4f3dcb 140 #define USB_FS_OVCR_Pin GPIO_PIN_7
thomashaine 0:e7352f4f3dcb 141 #define USB_FS_OVCR_GPIO_Port GPIOG
thomashaine 0:e7352f4f3dcb 142 #define USB_FS_VBUS_Pin GPIO_PIN_9
thomashaine 0:e7352f4f3dcb 143 #define USB_FS_VBUS_GPIO_Port GPIOA
thomashaine 0:e7352f4f3dcb 144 #define USB_FS_ID_Pin GPIO_PIN_10
thomashaine 0:e7352f4f3dcb 145 #define USB_FS_ID_GPIO_Port GPIOA
thomashaine 0:e7352f4f3dcb 146 #define USB_FS_N_Pin GPIO_PIN_11
thomashaine 0:e7352f4f3dcb 147 #define USB_FS_N_GPIO_Port GPIOA
thomashaine 0:e7352f4f3dcb 148 #define USB_FS_P_Pin GPIO_PIN_12
thomashaine 0:e7352f4f3dcb 149 #define USB_FS_P_GPIO_Port GPIOA
thomashaine 0:e7352f4f3dcb 150 #define LD2_Pin GPIO_PIN_1
thomashaine 0:e7352f4f3dcb 151 #define LD2_GPIO_Port GPIOE
thomashaine 0:e7352f4f3dcb 152 /* USER CODE BEGIN Private defines */
thomashaine 0:e7352f4f3dcb 153
thomashaine 0:e7352f4f3dcb 154 /* USER CODE END Private defines */
thomashaine 0:e7352f4f3dcb 155
thomashaine 0:e7352f4f3dcb 156 #ifdef __cplusplus
thomashaine 0:e7352f4f3dcb 157 }
thomashaine 0:e7352f4f3dcb 158 #endif
thomashaine 0:e7352f4f3dcb 159
thomashaine 0:e7352f4f3dcb 160 #endif /* __MAIN_H */
thomashaine 0:e7352f4f3dcb 161
thomashaine 0:e7352f4f3dcb 162 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/