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.
SequencerDisplay.h@0:9a0f67fe026b, 2016-08-12 (annotated)
- Committer:
- ryood
- Date:
- Fri Aug 12 20:42:30 2016 +0000
- Revision:
- 0:9a0f67fe026b
- Child:
- 1:1f6d3e65d946
first commit;
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| ryood | 0:9a0f67fe026b | 1 | /* |
| ryood | 0:9a0f67fe026b | 2 | * SequencerDisplay.h |
| ryood | 0:9a0f67fe026b | 3 | * |
| ryood | 0:9a0f67fe026b | 4 | * 2016.08.13 |
| ryood | 0:9a0f67fe026b | 5 | * |
| ryood | 0:9a0f67fe026b | 6 | */ |
| ryood | 0:9a0f67fe026b | 7 | #ifndef _SEQUENCE_DISPLAY_H_ |
| ryood | 0:9a0f67fe026b | 8 | #define _SEQUENCE_DISPLAY_H_ |
| ryood | 0:9a0f67fe026b | 9 | |
| ryood | 0:9a0f67fe026b | 10 | #include "mbed.h" |
| ryood | 0:9a0f67fe026b | 11 | #include "Sequence.h" |
| ryood | 0:9a0f67fe026b | 12 | |
| ryood | 0:9a0f67fe026b | 13 | class SequencerDisplay { |
| ryood | 0:9a0f67fe026b | 14 | public: |
| ryood | 0:9a0f67fe026b | 15 | typedef enum { stop, run } DISPLAY_MODE; |
| ryood | 0:9a0f67fe026b | 16 | |
| ryood | 0:9a0f67fe026b | 17 | SequencerDisplay(Sequence* _sequences, int _sequenceNum) : |
| ryood | 0:9a0f67fe026b | 18 | sequences(_sequences), |
| ryood | 0:9a0f67fe026b | 19 | sequenceNum(_sequenceNum), |
| ryood | 0:9a0f67fe026b | 20 | octave(0) {}; |
| ryood | 0:9a0f67fe026b | 21 | |
| ryood | 0:9a0f67fe026b | 22 | void update(DISPLAY_MODE mode, int step) { |
| ryood | 0:9a0f67fe026b | 23 | switch (mode) { |
| ryood | 0:9a0f67fe026b | 24 | case run: |
| ryood | 0:9a0f67fe026b | 25 | displayWhileRun(step); |
| ryood | 0:9a0f67fe026b | 26 | break; |
| ryood | 0:9a0f67fe026b | 27 | case stop: |
| ryood | 0:9a0f67fe026b | 28 | displayWhileStop(step); |
| ryood | 0:9a0f67fe026b | 29 | break; |
| ryood | 0:9a0f67fe026b | 30 | default: |
| ryood | 0:9a0f67fe026b | 31 | error("SequenceDisplay::update: invalid mode"); |
| ryood | 0:9a0f67fe026b | 32 | }; |
| ryood | 0:9a0f67fe026b | 33 | }; |
| ryood | 0:9a0f67fe026b | 34 | |
| ryood | 0:9a0f67fe026b | 35 | void setOctave(int _octave) { octave = _octave; }; |
| ryood | 0:9a0f67fe026b | 36 | int getOctave() { return octave; }; |
| ryood | 0:9a0f67fe026b | 37 | |
| ryood | 0:9a0f67fe026b | 38 | protected: |
| ryood | 0:9a0f67fe026b | 39 | virtual void displayWhileRun(int step) { |
| ryood | 0:9a0f67fe026b | 40 | #if (UART_TRACE) |
| ryood | 0:9a0f67fe026b | 41 | printf("displayWhileRun step:%d\r\n", step); |
| ryood | 0:9a0f67fe026b | 42 | #endif |
| ryood | 0:9a0f67fe026b | 43 | }; |
| ryood | 0:9a0f67fe026b | 44 | |
| ryood | 0:9a0f67fe026b | 45 | virtual void displayWhileStop(int step) { |
| ryood | 0:9a0f67fe026b | 46 | #if (UART_TRACE) |
| ryood | 0:9a0f67fe026b | 47 | printf("displayWhileStop step:%d\r\n", step); |
| ryood | 0:9a0f67fe026b | 48 | #endif |
| ryood | 0:9a0f67fe026b | 49 | }; |
| ryood | 0:9a0f67fe026b | 50 | |
| ryood | 0:9a0f67fe026b | 51 | Sequence* sequences; |
| ryood | 0:9a0f67fe026b | 52 | int sequenceNum; |
| ryood | 0:9a0f67fe026b | 53 | int octave; |
| ryood | 0:9a0f67fe026b | 54 | }; |
| ryood | 0:9a0f67fe026b | 55 | |
| ryood | 0:9a0f67fe026b | 56 | #endif //_SEQUENCE_DISPLAY_H_ |