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.cpp@2:9059b675917e, 2016-02-07 (annotated)
- Committer:
- sk398
- Date:
- Sun Feb 07 18:20:55 2016 +0000
- Revision:
- 2:9059b675917e
- Parent:
- 1:a0209f182a64
- Child:
- 3:7fcd006e1bc6
Latch Driver using SR Latches
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sk398 | 0:87f2d094bea3 | 1 | #include "mbed.h" |
sk398 | 0:87f2d094bea3 | 2 | #include "Latch_FET_Driver.h" |
sk398 | 0:87f2d094bea3 | 3 | |
sk398 | 1:a0209f182a64 | 4 | Latch_FET_Driver::Latch_FET_Driver(PinName set,PinName reset) |
sk398 | 0:87f2d094bea3 | 5 | { |
sk398 | 1:a0209f182a64 | 6 | SetPin = new DigitalOut(set); |
sk398 | 1:a0209f182a64 | 7 | ResetPin = new DigitalOut(reset); |
sk398 | 2:9059b675917e | 8 | // Ensure that SR latch does not enter unknown state |
sk398 | 2:9059b675917e | 9 | Latch_FET_Driver::initialState(); |
sk398 | 2:9059b675917e | 10 | } |
sk398 | 2:9059b675917e | 11 | |
sk398 | 2:9059b675917e | 12 | void Latch_FET_Driver::initialState() |
sk398 | 2:9059b675917e | 13 | { |
sk398 | 2:9059b675917e | 14 | SetPin -> write(LOW); |
sk398 | 2:9059b675917e | 15 | ResetPin ->write(HIGH); |
sk398 | 2:9059b675917e | 16 | } |
sk398 | 2:9059b675917e | 17 | |
sk398 | 2:9059b675917e | 18 | void Latch_FET_Driver::outputHigh() |
sk398 | 2:9059b675917e | 19 | { |
sk398 | 2:9059b675917e | 20 | ResetPin -> write(LOW); |
sk398 | 2:9059b675917e | 21 | SetPin -> write(HIGH); |
sk398 | 0:87f2d094bea3 | 22 | } |
sk398 | 0:87f2d094bea3 | 23 | |
sk398 | 2:9059b675917e | 24 | void Latch_FET_Driver::outputLow() |
sk398 | 0:87f2d094bea3 | 25 | { |
sk398 | 2:9059b675917e | 26 | SetPin -> write(LOW); |
sk398 | 2:9059b675917e | 27 | ResetPin -> write(HIGH); |
sk398 | 2:9059b675917e | 28 | |
sk398 | 0:87f2d094bea3 | 29 | } |
sk398 | 0:87f2d094bea3 | 30 | |
sk398 | 2:9059b675917e | 31 | |
sk398 | 2:9059b675917e | 32 | //int Latch_FET_Driver::setOutput() |
sk398 | 2:9059b675917e | 33 | //{ |
sk398 | 2:9059b675917e | 34 | // ResetPin = LOW; |
sk398 | 2:9059b675917e | 35 | // |
sk398 | 2:9059b675917e | 36 | // return 0; |
sk398 | 2:9059b675917e | 37 | //} |
sk398 | 2:9059b675917e | 38 | // |
sk398 | 2:9059b675917e | 39 | //int Latch_FET_Driver::resetOutput() |
sk398 | 2:9059b675917e | 40 | //{ |
sk398 | 2:9059b675917e | 41 | // |
sk398 | 2:9059b675917e | 42 | //} |
sk398 | 2:9059b675917e | 43 |