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@3:7fcd006e1bc6, 2016-02-07 (annotated)
- Committer:
- sk398
- Date:
- Sun Feb 07 18:21:13 2016 +0000
- Revision:
- 3:7fcd006e1bc6
- Parent:
- 2:9059b675917e
- Child:
- 5:7d1b124490ed
Updated
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 | //int Latch_FET_Driver::setOutput() |
sk398 | 2:9059b675917e | 32 | //{ |
sk398 | 2:9059b675917e | 33 | // ResetPin = LOW; |
sk398 | 2:9059b675917e | 34 | // |
sk398 | 2:9059b675917e | 35 | // return 0; |
sk398 | 2:9059b675917e | 36 | //} |
sk398 | 2:9059b675917e | 37 | // |
sk398 | 2:9059b675917e | 38 | //int Latch_FET_Driver::resetOutput() |
sk398 | 2:9059b675917e | 39 | //{ |
sk398 | 2:9059b675917e | 40 | // |
sk398 | 2:9059b675917e | 41 | //} |
sk398 | 2:9059b675917e | 42 |