Skip to content

Commit

Permalink
Created New Count Monitor Data Type and Changed IC_Module #4 to that …
Browse files Browse the repository at this point in the history
…type instead of a generic IC_Module Type

The Count_Monitor will merely monitor the number of pulses sent by a PWM signal.  Therefore, it can be a different, and simpler, type of Input Capture configuration and does not need to use the more complex IC_Module functions or data.
  • Loading branch information
ZacharyDownum committed Apr 4, 2018
1 parent 4a98f30 commit 0d42b21
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions Dependencies/Input Capture/InputCapture.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#pragma once

typedef struct IC_Buffer IC_Buffer;
typedef struct Count_Monitor_Buffer Count_Monitor_Buffer;

struct IC_Buffer
{
Expand All @@ -14,7 +15,13 @@ struct IC_Buffer
int fallingTime;
};

struct Count_Monitor_Buffer
{
int numberOfCounts;
};

typedef struct IC_Module IC_Module;
typedef struct Count_Monitor Count_Monitor;

//this struct is designed to store information about
//pwm-type square wave input signals
Expand All @@ -32,6 +39,15 @@ struct IC_Module
void (*Update)(struct IC_Module*);
};

struct Count_Monitor
{
//this variable will hold a reference to the number of counts held by the
//stepper motor. Negative values are CW, positive values are CCW.
int numberOfCounts;

void (*Initialize)(Count_Monitor*);
void (*Update)(Count_Monitor*);
};


//NOTE: all these modules are intended to be used with
Expand Down Expand Up @@ -77,8 +93,8 @@ void IC3_Update(IC_Module* IC3_Module);
//it must be named IC4Interrupt so it can
//be recognized as an IC module #4 interrupt
void __attribute__ ((__interrupt__, auto_psv)) _IC4Interrupt(void);
void IC4_Initialize(IC_Module* IC4_Module);
void IC4_Update(IC_Module* IC4_Module);
void IC4_Initialize(Count_Monitor* IC4_Module);
void IC4_Update(Count_Monitor* IC4_Module);


//Unused as of now in the hovercraft project, but it is here because
Expand Down

0 comments on commit 0d42b21

Please sign in to comment.