Edson Manoel da Silva / Mbed 2 deprecated Pedometer

Dependencies:   MMA8452 N5110 PowerControl mbed

Embed: (wiki syntax)

« Back to documentation index

main.h File Reference

main.h File Reference

Header file containing functions prototypes and global variables. More...

Go to the source code of this file.

Namespaces

namespace  lcd
 

GPIO output for Nokia 5110 Display.


namespace  mma8452
 

GPIO output for mma8452 accelerometer sensor.


namespace  leds
 

Debug leds.


namespace  buzzer
 

PWM for the buzzer.


namespace  serial
 

Serial interface.


namespace  timer1
 

First timer used.


namespace  timer2
 

Second timer used.


namespace  timer3
 

Chronometer timer.


namespace  local
 

Create Local File System.


namespace  I1
 

Create the interrupt for Transient Detection.


namespace  I2
 

Create the interrupt for Pulse(Tap) Detection.


Functions

void Interrupt ()
 Set a flag to alert that a Transient Detection Interrupt has ocurred.
void Interrupt2 ()
 Set a flag to alert that a Pulse Detection Interrupt has ocurred.
void error ()
 Blind the LEDS for state machine error alert.
void TimerExpired1 ()
 Set a flag to alert that a Timer1 Interrupt has ocurred.
void TimerExpired2 ()
 Set a flag to alert that a Timer2 Interrupt has ocurred.
void TimerExpired3 ()
 Performs the calculation for the chronometer time.
void writeDataToFile (char *date, int data1, float data2)
 Saves the data collected in the stepping count to the flash disk.

Variables

unsigned char second = 0
unsigned char minute = 0
unsigned char hour = 0
unsigned char state = 0
unsigned char I1_flag = 0
unsigned char I2_flag = 0
unsigned char timerFlag1 = 0
unsigned char timerFlag2 = 0
unsigned char aux = 0
char Int_SourceSystem = 0
char Int_SourceTrans = 0
unsigned char length
char buffer [14]
unsigned int step = 0
float km = 0
float km_day [30] = {}
float acc_vector = 0
double sub_x = 0
double sub_y = 0
double sub_z = 0

Detailed Description

Header file containing functions prototypes and global variables.

Implementation of a Pedometer using the accelerometer MMA8452Q, Nokia 5110 display and the mbed LPC1768. Revision 1.5.

Author:
Edson Manoel da Silva
Date:
May 2015

Definition in file main.h.


Function Documentation

void error (  )

Blind the LEDS for state machine error alert.

Error function. In case of error of the state machine

Definition at line 313 of file main.cpp.

void Interrupt (  )

Set a flag to alert that a Transient Detection Interrupt has ocurred.

Controls the Transient Detection Interrupt flag

Definition at line 301 of file main.cpp.

void Interrupt2 (  )

Set a flag to alert that a Pulse Detection Interrupt has ocurred.

Controls the Pulse(Tap)Detection Interrupt flag

Definition at line 307 of file main.cpp.

void TimerExpired1 (  )

Set a flag to alert that a Timer1 Interrupt has ocurred.

Timer 1 flag

Definition at line 323 of file main.cpp.

void TimerExpired2 (  )

Set a flag to alert that a Timer2 Interrupt has ocurred.

Timer 2 Flag

Definition at line 329 of file main.cpp.

void TimerExpired3 (  )

Performs the calculation for the chronometer time.

Calculates the chronometer time

Definition at line 335 of file main.cpp.

void writeDataToFile ( char *  date,
int  data1,
float  data2 
)

Saves the data collected in the stepping count to the flash disk.

Parameters:
date- the date of the data
data1- steps
data2- Kilometer

Saves the km and steps data to flash disk

Definition at line 352 of file main.cpp.


Variable Documentation

float acc_vector = 0

Variable for check if a step was performed

Definition at line 122 of file main.h.

unsigned char aux = 0

Auxiliar for checking if the user stopped using the device

Definition at line 109 of file main.h.

char buffer[14]

Buffer used for printing strings on the display

Definition at line 115 of file main.h.

unsigned char hour = 0

hour flag set in TimerExpired3

Definition at line 103 of file main.h.

unsigned char I1_flag = 0

Interrupt flag set in Transient Detection Interrupt

Definition at line 105 of file main.h.

unsigned char I2_flag = 0

Interrupt flag set in Pulse(Tap) Detection Interrupt

Definition at line 106 of file main.h.

char Int_SourceSystem = 0

Variable used to read the MMA8452Q Interrupt Source Register

Definition at line 111 of file main.h.

char Int_SourceTrans = 0

Variable used to clear the MMA8452Q Interrupt Registers

Definition at line 112 of file main.h.

float km = 0

Variable used to ccalculate the kilometers

Definition at line 118 of file main.h.

float km_day[30] = {}

Variable used to ccalculate the kilometers per day

Definition at line 120 of file main.h.

unsigned char length

Variable used to check the string length to be printed in the LCD

Definition at line 114 of file main.h.

unsigned char minute = 0

minute flag set in TimerExpired3

Definition at line 102 of file main.h.

unsigned char second = 0

second flag set in TimerExpired3

Definition at line 101 of file main.h.

unsigned char state = 0

state variable for the FSM

Definition at line 104 of file main.h.

unsigned int step = 0

Variable used to ccalculate the steps

Definition at line 117 of file main.h.

double sub_x = 0

Variable used for calibration

Definition at line 123 of file main.h.

double sub_y = 0

Variable used for calibration

Definition at line 124 of file main.h.

double sub_z = 0

Variable used for calibration

Definition at line 125 of file main.h.

unsigned char timerFlag1 = 0

Interrupt flag set in Timer1

Definition at line 107 of file main.h.

unsigned char timerFlag2 = 0

Interrupt flag set in Timer2

Definition at line 108 of file main.h.