Driver to control a peripheral circuit being controlled by the operation of a FET. Inbetween the mbed and FET is a single D type latch, used to latch a signal to the driver.

Latch_FET_Driver.h

Committer:
sk398
Date:
2016-03-04
Revision:
6:073ee2fd1245
Parent:
5:7d1b124490ed

File content as of revision 6:073ee2fd1245:

/* #####################################################################

 Latch_FET_Driver.h
 ------------------
 
 Written by:        Steven Kay
 
 Date:              February 2016
 
 Function:          This 
    
 #####################################################################*/
 
 /*##########################################

    Embedded Software, Assignment 1
    -------------------------------

Written by: Steven Kay

Date:       January 2016

Function:   This program constructs and outputs a
            pulse train on a given output pin based
            on several input configurations generated
            by using switches

##########################################*/


#include "mbed.h"

#ifndef LATCH_FET_DRIVER
#define LATCH_FET_DRIVER


#define LOW 0
#define HIGH 1

#define STATE_DELAY 10


class Latch_FET_Driver
{

public:
    /*  =============================================================
    Latch_FET_Driver constructor 
    
    Inputs
    ------
    PinName D:      Pin to create D input to D Latch
    PinName CLK:    Pin to create CLK input to D Latch 
    
    Description
    -----------
    
    Once the new DigitalOut types are assigned, the D Latch at
    the given Pins is initialised to an outputLow state, ensuring
    that uopn setup, a known state is entered quickly.
    
    =============================================================  */ 
    Latch_FET_Driver(PinName D,PinName CLK);
    
    
    void changeOutputState(bool state);
    
private:
    /*  =============================================================
    outputHigh public method
    
    Inputs
    ------
    No functionally passed parameters
    The method acts upon the DigitalOut types; _D and _CLK
    
    Description
    -----------
    Procedure to assert a HIGH state onto a D Latch attached to
    PinName D and PinName CLK
    =============================================================  */ 
    void outputHigh();
    
    /*  =============================================================
    outputLow public method
    
    Inputs
    ------
    No functionally passed parameters
    The method acts upon the DigitalOut types; _D and _CLK
    
    Description
    -----------
    Procedure to assert a LOW state onto a D Latch attached to
    PinName D and PinName CLK
    =============================================================  */ 
    void outputLow();
    
protected:
    // DigitalOut types used for assignment of PinName data types
    DigitalOut *_D;
    DigitalOut *_CLK;
};

#endif