Stepper-Motor-Control  v3.0.0
System on a Chip 2014 - Group 04
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros
heartbeatTask.h File Reference

Header file for heartbeatTask.c. More...

#include <stdbool.h>
#include "includes.h"
#include "events.h"
#include "hardwareAccess.h"
#include "registerAccess.h"
#include "debugAndErrorOutput.h"
#include "dataTypes.h"
Include dependency graph for heartbeatTask.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define LOWER_O   (0b1011100)
 represents the letter o in the lower HEX-segments
 
#define UPPER_O   (0b1100011)
 represents the letter o in the upper HEX-segments
 
#define LINE   (0b1000000)
 represents a centered bar in the HEX-segments
 
#define LED_ON   (0x1)
 turn the led on
 
#define LED_OFF   (0x0)
 turn the led off
 

Functions

void HeartbeatTask (void *pdata)
 The task for the hearbeat and the debug-mode. More...
 
void nextHeartbeatStep (heartbeatState_t *heartbeatStatePtr)
 State machine for the heartbeat. More...
 
void debugAndHeartbeat (heartbeatState_t *heartbeatStatePtr)
 This function implements the debug-logic. More...
 

Detailed Description

Header file for heartbeatTask.c.

Author
Michael Riedel
Marc Kossmann
Version
v2.0.0
Date
18.11.2014

Contains defines, includes, typedefs and declarations needed for this task.

History:

v0.1.0 22.10.2014 Kossmann

  • first draft for milestone 1b

v0.1.1 30.10.2014 Riedel

v0.1.2 31.10.2014 Riedel

  • added defines for HEX-segments
  • added declaration and documentation for sub-functions

v0.1.3 31.10.2014 Riedel & Kossmann

  • finilized heartbeat functionality

v0.1.4 02.11.2014 Riedel

  • corrected documentation

v1.0.0 03.11.2014 Kossmann

  • fixed some minor syntax mistakes to get flawless compile

v1.0.1 13.11. Kossmann

v2.0.0 18.11.2014 Riedel & Kossmann

  • verified functionality -> release MS2

Definition in file heartbeatTask.h.

Function Documentation

void debugAndHeartbeat ( heartbeatState_t heartbeatStatePtr)

This function implements the debug-logic.

In Debug-mode, the registers are read and set in predefined intervals. It automatically calls the nextHeartbeatStep()-function to change the states.

subfunction state
next heartbeat-step every
check Run-Bit in ctrlReg every
check Dir-Bit in ctrlReg every
set stepsReg (+10 / -10) every
set IR-Bit in ctrlReg FOURTH
Parameters
heartbeatStatePtrPoints to the state-structure containing the actual state.

Definition at line 84 of file heartbeatTask.c.

Here is the call graph for this function:

void HeartbeatTask ( void *  pdata)

The task for the hearbeat and the debug-mode.

This task is doing a heartbeat to show scheduling is working. Therefore changes its state every second via the nextHeartbeatStep()-function. When the UserInputTask detects, that the user activated the Debug-Mode, it sends the DEBUG_ON_EVENT. The task then calls the debugAndHeartbeat()-function.

Parameters
pdata: Pointer to parameter structure (not used)

Definition at line 29 of file heartbeatTask.c.

Here is the call graph for this function:

void nextHeartbeatStep ( heartbeatState_t heartbeatStatePtr)

State machine for the heartbeat.

The state machine activates and deactivates the red LED9 and shows the defined HEX-values (LOWER_O, UPPER_O and LINE) on HEX3 accordingly after 1 second.

Parameters
heartbeatStatePtrPoints to the state-structure containing the actual state.

Definition at line 56 of file heartbeatTask.c.

Here is the call graph for this function: