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:
Fri Mar 04 17:53:29 2016 +0000
Revision:
6:073ee2fd1245
Parent:
5:7d1b124490ed
added method to change state based on given input; outputLow and High shifted to private members

Who changed what in which revision?

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