Stepper-Motor-Control  v3.0.0
System on a Chip 2014 - Group 04
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros
heartbeatTask.h
Go to the documentation of this file.
1 /**
2  *****************************************************************************
3  * @file heartbeatTask.h
4  * @author Michael Riedel
5  * @author Marc Kossmann
6  * @version v2.0.0
7  * @date 18.11.2014
8  * @brief Header file for heartbeatTask.c
9  * @details Contains defines, includes, typedefs and declarations needed
10  * for this task.
11  *****************************************************************************
12  * @par History:
13  * @details v0.1.0 22.10.2014 Kossmann
14  * - first draft for milestone 1b
15  * @details v0.1.1 30.10.2014 Riedel
16  * - moved DEBUG_ON_EVENT to events.h
17  * @details v0.1.2 31.10.2014 Riedel
18  * - added defines for HEX-segments
19  * - added declaration and documentation for sub-functions
20  * @details v0.1.3 31.10.2014 Riedel & Kossmann
21  * - finilized heartbeat functionality
22  * @details v0.1.4 02.11.2014 Riedel
23  * - corrected documentation
24  * @details v1.0.0 03.11.2014 Kossmann
25  * - fixed some minor syntax mistakes to get flawless compile
26  * @details v1.0.1 13.11. Kossmann
27  * - moved all own data types to dataTypes.h
28  * @details v2.0.0 18.11.2014 Riedel & Kossmann
29  * - verified functionality -> release MS2
30  *****************************************************************************
31  */
32 
33 #ifndef __HEARTBEAT_TASK_H__
34 #define __HEARTBEAT_TASK_H__
35 
36 #include <stdbool.h>
37 #include "includes.h"
38 #include "events.h"
39 #include "hardwareAccess.h"
40 #include "registerAccess.h"
41 #include "debugAndErrorOutput.h"
42 #include "dataTypes.h"
43 
44 #define LOWER_O (0b1011100) //!< represents the letter **o** in the **lower** HEX-segments
45 #define UPPER_O (0b1100011) //!< represents the letter **o** in the **upper** HEX-segments
46 #define LINE (0b1000000) //!< represents a centered **bar** in the HEX-segments
47 #define LED_ON (0x1) //!< turn the led on
48 #define LED_OFF (0x0) //!< turn the led off
49 
50 /**
51  * @brief The task for the hearbeat and the debug-mode.
52  * @details This task is doing a heartbeat to show scheduling is working.
53  * Therefore changes its state every second via the
54  * nextHeartbeatStep()-function. When the UserInputTask detects,
55  * that the user activated the Debug-Mode, it sends the
56  * DEBUG_ON_EVENT. The task then calls the
57  * debugAndHeartbeat()-function.
58  *
59  * @param pdata : Pointer to parameter structure (not used)
60  */
61 void HeartbeatTask(void *pdata);
62 
63 /**
64  * @brief State machine for the heartbeat.
65  * @details The state machine activates and deactivates the red LED9 and
66  * shows the defined HEX-values (LOWER_O, UPPER_O and LINE) on
67  * HEX3 accordingly after 1 second.
68  *
69  * @param heartbeatStatePtr Points to the state-structure containing the
70  * actual state.
71  */
72 void nextHeartbeatStep(heartbeatState_t *heartbeatStatePtr);
73 
74 /**
75  * @brief This function implements the debug-logic
76  * @details In Debug-mode, the **registers are read and set** in predefined
77  * intervals. It automatically calls the
78  * nextHeartbeatStep()-function to change the states.
79  * | subfunction | state |
80  * | ------------------------ | :----: |
81  * | next heartbeat-step | every |
82  * | check Run-Bit in ctrlReg | every |
83  * | check Dir-Bit in ctrlReg | every |
84  * | set stepsReg (+10 / -10) | every |
85  * | set IR-Bit in ctrlReg | FOURTH |
86  *
87  * @param heartbeatStatePtr Points to the state-structure containing the
88  * actual state.
89  */
90 void debugAndHeartbeat(heartbeatState_t *heartbeatStatePtr);
91 
92 #endif // __HEARTBEAT_TASK_H__
enum heartbeatState heartbeatState_t
The state-machine for the heartbeat.
Functions for accessing hardware connected through pio´s and registers.
definitions for used events
void debugAndHeartbeat(heartbeatState_t *heartbeatStatePtr)
This function implements the debug-logic.
Definition: heartbeatTask.c:84
Header file with inline functions to access the registers that are used by the Stepper-Motor-Control ...
void nextHeartbeatStep(heartbeatState_t *heartbeatStatePtr)
State machine for the heartbeat.
Definition: heartbeatTask.c:56
void HeartbeatTask(void *pdata)
The task for the hearbeat and the debug-mode.
Definition: heartbeatTask.c:29
Header file for all own data types.
Defines for Error and Debug-Output Management.