Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: MCP23017 TCS3472_I2C WattBob_TextLCD mbed
fpga.cpp@3:843b830ee8bd, 2015-11-11 (annotated)
- Committer:
- dreamselec
- Date:
- Wed Nov 11 03:45:30 2015 +0000
- Revision:
- 3:843b830ee8bd
- Child:
- 4:4eebb4de22a7
The MBED program is supposed to work both when connected to PC, and on it's own. So making use of Serial (UART) interrupts, to listen for incoming commands when PC is connected. Currently only mbed control works, no commands are sent to PC, or FPGA
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| dreamselec | 3:843b830ee8bd | 1 | #include "fpga.h" |
| dreamselec | 3:843b830ee8bd | 2 | #include "mbed.h" |
| dreamselec | 3:843b830ee8bd | 3 | #include "globals.h" |
| dreamselec | 3:843b830ee8bd | 4 | |
| dreamselec | 3:843b830ee8bd | 5 | |
| dreamselec | 3:843b830ee8bd | 6 | /** Function that checks first IR sensor to detect if block in shoot |
| dreamselec | 3:843b830ee8bd | 7 | @return 1 if sensor beam broken, 0 otherwise |
| dreamselec | 3:843b830ee8bd | 8 | */ |
| dreamselec | 3:843b830ee8bd | 9 | int blockIsInserted(){ |
| dreamselec | 3:843b830ee8bd | 10 | // Blaire get your shit together. |
| dreamselec | 3:843b830ee8bd | 11 | // Read sensor |
| dreamselec | 3:843b830ee8bd | 12 | // Simulation |
| dreamselec | 3:843b830ee8bd | 13 | wait(1.0); |
| dreamselec | 3:843b830ee8bd | 14 | return 1; |
| dreamselec | 3:843b830ee8bd | 15 | } |
| dreamselec | 3:843b830ee8bd | 16 | |
| dreamselec | 3:843b830ee8bd | 17 | /** Function that checks if block is also breaking the second IR sensor. |
| dreamselec | 3:843b830ee8bd | 18 | @result true if it does, false otherwise |
| dreamselec | 3:843b830ee8bd | 19 | */ |
| dreamselec | 3:843b830ee8bd | 20 | int blockIsLarge(){ |
| dreamselec | 3:843b830ee8bd | 21 | return 0; |
| dreamselec | 3:843b830ee8bd | 22 | } |
| dreamselec | 3:843b830ee8bd | 23 | |
| dreamselec | 3:843b830ee8bd | 24 | /** Moves the stopping servo in the "hopper" to stop blocks from falling |
| dreamselec | 3:843b830ee8bd | 25 | @param position: TBD |
| dreamselec | 3:843b830ee8bd | 26 | */ |
| dreamselec | 3:843b830ee8bd | 27 | void moveStoppingServo(int position) { |
| dreamselec | 3:843b830ee8bd | 28 | |
| dreamselec | 3:843b830ee8bd | 29 | } |
| dreamselec | 3:843b830ee8bd | 30 | |
| dreamselec | 3:843b830ee8bd | 31 | /** Moves the servoe which decides which basket block should go into i.e. bad/good |
| dreamselec | 3:843b830ee8bd | 32 | @param positon: TBD |
| dreamselec | 3:843b830ee8bd | 33 | */ |
| dreamselec | 3:843b830ee8bd | 34 | void moveSortingServo(int position){ |
| dreamselec | 3:843b830ee8bd | 35 | |
| dreamselec | 3:843b830ee8bd | 36 | } |
| dreamselec | 3:843b830ee8bd | 37 | |
| dreamselec | 3:843b830ee8bd | 38 | /** Reset the stopping servo to default posiotn i.e. not letting blcoks fall. |
| dreamselec | 3:843b830ee8bd | 39 | */ |
| dreamselec | 3:843b830ee8bd | 40 | void resetStoppingServo(){ |
| dreamselec | 3:843b830ee8bd | 41 | |
| dreamselec | 3:843b830ee8bd | 42 | } |
| dreamselec | 3:843b830ee8bd | 43 | /** Reset the sorting servo to default posiont i.e. falling blocks go in haz-bin |
| dreamselec | 3:843b830ee8bd | 44 | */ |
| dreamselec | 3:843b830ee8bd | 45 | void resetSortingServo(){ |
| dreamselec | 3:843b830ee8bd | 46 | |
| dreamselec | 3:843b830ee8bd | 47 | } |
| dreamselec | 3:843b830ee8bd | 48 | /** Reset both servos, simply calls their respective reset methods. |
| dreamselec | 3:843b830ee8bd | 49 | */ |
| dreamselec | 3:843b830ee8bd | 50 | void resetAllServos(){ |
| dreamselec | 3:843b830ee8bd | 51 | resetSortingServo(); |
| dreamselec | 3:843b830ee8bd | 52 | resetStoppingServo(); |
| dreamselec | 3:843b830ee8bd | 53 | } |
