annotate BootLoader/Inc/base_bootloader.h @ 220:e524a824d8f2 Improve_IPC_Sync

Added schedule point for functions executed once in a second SPI communication takes place every 100ms triggered by the master (main). Synchronisation is done using the SPI RX complete callback which is called ~4ms after communication was started. In the previous implementation this could happen in parallel to usage of data. To solve this potential problem the execution of functions called once a second was moved from 1000ms to 980ms giving a 20ms window for execution.
author ideenmodellierer
date Sun, 31 Mar 2019 15:49:47 +0200
parents ea1003f63e44
children 4e10a3e087a1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
30
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
1 ///////////////////////////////////////////////////////////////////////////////
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
2 /// -*- coding: UTF-8 -*-
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
3 ///
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
4 /// \file BootLoader/Inc/base_bootloader.h
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
5 /// \brief Header for main.c module
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
6 /// \author MCD Application Team
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
7 /// \date 26-February-2014
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
8 ///
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
9 /// $Id$
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
10 ///////////////////////////////////////////////////////////////////////////////
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
11 /// \par Copyright (c) 2014-2018 Heinrichs Weikamp gmbh
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
12 ///
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
13 /// This program is free software: you can redistribute it and/or modify
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
14 /// it under the terms of the GNU General Public License as published by
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
15 /// the Free Software Foundation, either version 3 of the License, or
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
16 /// (at your option) any later version.
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
17 ///
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
18 /// This program is distributed in the hope that it will be useful,
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
19 /// but WITHOUT ANY WARRANTY; without even the implied warranty of
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
20 /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
21 /// GNU General Public License for more details.
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
22 ///
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
23 /// You should have received a copy of the GNU General Public License
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
24 /// along with this program. If not, see <http://www.gnu.org/licenses/>.
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
25 //////////////////////////////////////////////////////////////////////////////
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
26 /**
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
27 ******************************************************************************
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
28 * @attention
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
29 *
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
30 * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
31 *
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
32 * Redistribution and use in source and binary forms, with or without modification,
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
33 * are permitted provided that the following conditions are met:
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
34 * 1. Redistributions of source code must retain the above copyright notice,
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
35 * this list of conditions and the following disclaimer.
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
36 * 2. Redistributions in binary form must reproduce the above copyright notice,
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
37 * this list of conditions and the following disclaimer in the documentation
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
38 * and/or other materials provided with the distribution.
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
39 * 3. Neither the name of STMicroelectronics nor the names of its contributors
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
40 * may be used to endorse or promote products derived from this software
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
41 * without specific prior written permission.
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
42 *
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
43 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
44 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
45 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
46 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
47 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
48 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
49 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
50 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
51 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
52 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
53 *
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
54 ******************************************************************************
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
55 */
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
56
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
57 /* Define to prevent recursive inclusion -------------------------------------*/
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
58 #ifndef BASE_BOOTLOADER_H
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
59 #define BASE_BOOTLOADER_H
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
60
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
61 /* Includes ------------------------------------------------------------------*/
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
62
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
63 #define STM32F429xx
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
64
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
65 #include "stm32f4xx_hal.h"
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
66
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
67 #include "tStructure.h"
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
68 #include "settings.h"
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
69
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
70 /* Exported types ------------------------------------------------------------*/
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
71 /* Exported constants --------------------------------------------------------*/
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
72
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
73 /* Exported macro ------------------------------------------------------------*/
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
74
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
75 #define TOP_LAYER 1
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
76 #define BACKGRD_LAYER 0
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
77
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
78 #define SURFMODE 1
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
79 #define DIVEMODE 2
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
80
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
81 typedef enum
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
82 {
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
83 ST_Boot = 0,
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
84 ST_Surface,
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
85 ST_Dive,
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
86 ST_Menu,
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
87 ST_END
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
88 } SState;
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
89
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
90 typedef enum
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
91 {
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
92 ACTION_IDLE_TICK = 0,
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
93 ACTION_IDLE_SECOND,
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
94 ACTION_MODE_CHANGE,
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
95 ACTION_TIMEOUT,
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
96 ACTION_BUTTON_CUSTOM,
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
97 ACTION_BUTTON_BACK,
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
98 ACTION_BUTTON_NEXT,
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
99 ACTION_BUTTON_ENTER,
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
100 ACTION_BUTTON_ENTER_FINAL,
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
101 ACTION_END
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
102 } SAction;
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
103
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
104 /* Exported macro ------------------------------------------------------------*/
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
105 /* Exported functions ------------------------------------------------------- */
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
106
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
107 uint32_t get_globalState(void);
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
108 void set_globalState(uint32_t newID);
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
109 void get_globalStateList(SStateList *output);
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
110 void set_globalState_Menu_Page(uint8_t page);
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
111 void set_globalState_Menu_Line(uint8_t line);
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
112 void get_idSpecificStateList(uint32_t id, SStateList *output);
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
113 void delayMicros(uint32_t micros);
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
114 void get_RTC_DateTime(RTC_DateTypeDef * sdatestructureget, RTC_TimeTypeDef * stimestructureget);
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
115 void set_RTC_DateTime(RTC_DateTypeDef * sdatestructure, RTC_TimeTypeDef * stimestructure);
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
116 uint8_t get_globalMode(void);
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
117 void set_globalMode(uint8_t newMode);
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
118 void set_globalState_Log_Page(uint8_t pageIsLine);
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
119 void set_globalState_Base(void);
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
120
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
121 void set_returnFromComm(void);
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
122
ea1003f63e44 ADD GPL License ...
jDG
parents: 25
diff changeset
123 #endif /* BASE_BOOTLOADER_H */