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.

Committer:
sk398
Date:
Thu Mar 10 16:25:15 2016 +0000
Revision:
7:909d7e3822d8
Parent:
5:7d1b124490ed
Delay time updated

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sk398 5:7d1b124490ed 1 /* #####################################################################
sk398 7:909d7e3822d8 2 Latch_FET_Driver.h
sk398 7:909d7e3822d8 3 ------------------
sk398 7:909d7e3822d8 4
sk398 7:909d7e3822d8 5 Surface Ship, Group 5
sk398 7:909d7e3822d8 6 ---------------------
sk398 5:7d1b124490ed 7
sk398 5:7d1b124490ed 8 Written by: Steven Kay
sk398 5:7d1b124490ed 9
sk398 5:7d1b124490ed 10 Date: February 2016
sk398 5:7d1b124490ed 11
sk398 5:7d1b124490ed 12 Function: This
sk398 7:909d7e3822d8 13
sk398 7:909d7e3822d8 14 Version: 1.0
sk398 7:909d7e3822d8 15
sk398 7:909d7e3822d8 16 Version History
sk398 7:909d7e3822d8 17 ---------------
sk398 5:7d1b124490ed 18
sk398 7:909d7e3822d8 19 1.1 rgdfgdfgdfggdfgdg
sk398 7:909d7e3822d8 20
sk398 7:909d7e3822d8 21 1.0 gdgddfdddgd
sk398 7:909d7e3822d8 22
sk398 7:909d7e3822d8 23 ##################################################################### */
sk398 5:7d1b124490ed 24
sk398 5:7d1b124490ed 25
sk398 0:87f2d094bea3 26 #include "mbed.h"
sk398 0:87f2d094bea3 27
sk398 0:87f2d094bea3 28 #ifndef LATCH_FET_DRIVER
sk398 0:87f2d094bea3 29 #define LATCH_FET_DRIVER
sk398 0:87f2d094bea3 30
sk398 0:87f2d094bea3 31
sk398 0:87f2d094bea3 32 #define LOW 0
sk398 0:87f2d094bea3 33 #define HIGH 1
sk398 0:87f2d094bea3 34
sk398 5:7d1b124490ed 35 #define STATE_DELAY 10
sk398 5:7d1b124490ed 36
sk398 0:87f2d094bea3 37
sk398 0:87f2d094bea3 38 class Latch_FET_Driver
sk398 0:87f2d094bea3 39 {
sk398 0:87f2d094bea3 40
sk398 0:87f2d094bea3 41 public:
sk398 5:7d1b124490ed 42 /* =============================================================
sk398 5:7d1b124490ed 43 Latch_FET_Driver constructor
sk398 5:7d1b124490ed 44
sk398 5:7d1b124490ed 45 Inputs
sk398 5:7d1b124490ed 46 ------
sk398 5:7d1b124490ed 47 PinName D: Pin to create D input to D Latch
sk398 5:7d1b124490ed 48 PinName CLK: Pin to create CLK input to D Latch
sk398 5:7d1b124490ed 49
sk398 5:7d1b124490ed 50 Description
sk398 5:7d1b124490ed 51 -----------
sk398 5:7d1b124490ed 52
sk398 5:7d1b124490ed 53 Once the new DigitalOut types are assigned, the D Latch at
sk398 5:7d1b124490ed 54 the given Pins is initialised to an outputLow state, ensuring
sk398 5:7d1b124490ed 55 that uopn setup, a known state is entered quickly.
sk398 5:7d1b124490ed 56
sk398 5:7d1b124490ed 57 ============================================================= */
sk398 5:7d1b124490ed 58 Latch_FET_Driver(PinName D,PinName CLK);
sk398 5:7d1b124490ed 59
sk398 5:7d1b124490ed 60 /* =============================================================
sk398 5:7d1b124490ed 61 outputHigh public method
sk398 5:7d1b124490ed 62
sk398 5:7d1b124490ed 63 Inputs
sk398 5:7d1b124490ed 64 ------
sk398 5:7d1b124490ed 65 No functionally passed parameters
sk398 5:7d1b124490ed 66 The method acts upon the DigitalOut types; _D and _CLK
sk398 5:7d1b124490ed 67
sk398 5:7d1b124490ed 68 Description
sk398 5:7d1b124490ed 69 -----------
sk398 5:7d1b124490ed 70 Procedure to assert a HIGH state onto a D Latch attached to
sk398 5:7d1b124490ed 71 PinName D and PinName CLK
sk398 5:7d1b124490ed 72 ============================================================= */
sk398 2:9059b675917e 73 void outputHigh();
sk398 5:7d1b124490ed 74
sk398 5:7d1b124490ed 75 /* =============================================================
sk398 5:7d1b124490ed 76 outputLow public method
sk398 5:7d1b124490ed 77
sk398 5:7d1b124490ed 78 Inputs
sk398 5:7d1b124490ed 79 ------
sk398 5:7d1b124490ed 80 No functionally passed parameters
sk398 5:7d1b124490ed 81 The method acts upon the DigitalOut types; _D and _CLK
sk398 5:7d1b124490ed 82
sk398 5:7d1b124490ed 83 Description
sk398 5:7d1b124490ed 84 -----------
sk398 5:7d1b124490ed 85 Procedure to assert a LOW state onto a D Latch attached to
sk398 5:7d1b124490ed 86 PinName D and PinName CLK
sk398 5:7d1b124490ed 87 ============================================================= */
sk398 2:9059b675917e 88 void outputLow();
sk398 5:7d1b124490ed 89
sk398 0:87f2d094bea3 90 private:
sk398 0:87f2d094bea3 91
sk398 0:87f2d094bea3 92 protected:
sk398 5:7d1b124490ed 93 // DigitalOut types used for assignment of PinName data types
sk398 5:7d1b124490ed 94 DigitalOut *_D;
sk398 5:7d1b124490ed 95 DigitalOut *_CLK;
sk398 0:87f2d094bea3 96 };
sk398 0:87f2d094bea3 97
sk398 0:87f2d094bea3 98 #endif