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@4:e51a5f0891a0, 2016-08-26 (annotated)
- Committer:
- ryood
- Date:
- Fri Aug 26 05:11:10 2016 +0000
- Revision:
- 4:e51a5f0891a0
- Parent:
- 3:5b11261a545a
- Child:
- 9:a8adc9b9b3d8
Display Octave Value on LCD
Who changed what in which revision?
| User | Revision | Line number | New contents of line | 
|---|---|---|---|
| ryood | 4:e51a5f0891a0 | 1 | |
| ryood | 0:9a0f67fe026b | 2 | /* | 
| ryood | 0:9a0f67fe026b | 3 | * SequencerDisplay.h | 
| ryood | 0:9a0f67fe026b | 4 | * | 
| ryood | 0:9a0f67fe026b | 5 | * 2016.08.13 | 
| ryood | 0:9a0f67fe026b | 6 | * | 
| ryood | 0:9a0f67fe026b | 7 | */ | 
| ryood | 0:9a0f67fe026b | 8 | #ifndef _SEQUENCE_DISPLAY_H_ | 
| ryood | 0:9a0f67fe026b | 9 | #define _SEQUENCE_DISPLAY_H_ | 
| ryood | 0:9a0f67fe026b | 10 | |
| ryood | 0:9a0f67fe026b | 11 | #include "mbed.h" | 
| ryood | 0:9a0f67fe026b | 12 | #include "Sequence.h" | 
| ryood | 0:9a0f67fe026b | 13 | |
| ryood | 0:9a0f67fe026b | 14 | class SequencerDisplay { | 
| ryood | 0:9a0f67fe026b | 15 | public: | 
| ryood | 3:5b11261a545a | 16 | enum DisplayMode { stop, run }; | 
| ryood | 0:9a0f67fe026b | 17 | |
| ryood | 0:9a0f67fe026b | 18 | SequencerDisplay(Sequence* _sequences, int _sequenceNum) : | 
| ryood | 0:9a0f67fe026b | 19 | sequences(_sequences), | 
| ryood | 0:9a0f67fe026b | 20 | sequenceNum(_sequenceNum), | 
| ryood | 1:1f6d3e65d946 | 21 | octave(0), | 
| ryood | 4:e51a5f0891a0 | 22 | bpm(120), | 
| ryood | 4:e51a5f0891a0 | 23 | waveShape(0), | 
| ryood | 4:e51a5f0891a0 | 24 | modNumber(0) {}; | 
| ryood | 0:9a0f67fe026b | 25 | |
| ryood | 3:5b11261a545a | 26 | void update(enum DisplayMode mode, int step) { | 
| ryood | 0:9a0f67fe026b | 27 | switch (mode) { | 
| ryood | 0:9a0f67fe026b | 28 | case run: | 
| ryood | 0:9a0f67fe026b | 29 | displayWhileRun(step); | 
| ryood | 0:9a0f67fe026b | 30 | break; | 
| ryood | 0:9a0f67fe026b | 31 | case stop: | 
| ryood | 0:9a0f67fe026b | 32 | displayWhileStop(step); | 
| ryood | 0:9a0f67fe026b | 33 | break; | 
| ryood | 0:9a0f67fe026b | 34 | default: | 
| ryood | 0:9a0f67fe026b | 35 | error("SequenceDisplay::update: invalid mode"); | 
| ryood | 0:9a0f67fe026b | 36 | }; | 
| ryood | 0:9a0f67fe026b | 37 | }; | 
| ryood | 0:9a0f67fe026b | 38 | |
| ryood | 0:9a0f67fe026b | 39 | void setOctave(int _octave) { octave = _octave; }; | 
| ryood | 0:9a0f67fe026b | 40 | int getOctave() { return octave; }; | 
| ryood | 0:9a0f67fe026b | 41 | |
| ryood | 1:1f6d3e65d946 | 42 | void setBpm(int _bpm) { bpm = _bpm; }; | 
| ryood | 1:1f6d3e65d946 | 43 | int getBpm() { return bpm; }; | 
| ryood | 1:1f6d3e65d946 | 44 | |
| ryood | 4:e51a5f0891a0 | 45 | void setWaveShape(int _waveShape) { waveShape = _waveShape; } | 
| ryood | 4:e51a5f0891a0 | 46 | int getWaveShape() { return waveShape; } | 
| ryood | 4:e51a5f0891a0 | 47 | |
| ryood | 4:e51a5f0891a0 | 48 | void setModNumber(int _modNumber) { modNumber = _modNumber; } | 
| ryood | 4:e51a5f0891a0 | 49 | int getModNumber() { return modNumber; } | 
| ryood | 4:e51a5f0891a0 | 50 | |
| ryood | 0:9a0f67fe026b | 51 | protected: | 
| ryood | 0:9a0f67fe026b | 52 | virtual void displayWhileRun(int step) { | 
| ryood | 0:9a0f67fe026b | 53 | #if (UART_TRACE) | 
| ryood | 0:9a0f67fe026b | 54 | printf("displayWhileRun step:%d\r\n", step); | 
| ryood | 0:9a0f67fe026b | 55 | #endif | 
| ryood | 0:9a0f67fe026b | 56 | }; | 
| ryood | 0:9a0f67fe026b | 57 | |
| ryood | 0:9a0f67fe026b | 58 | virtual void displayWhileStop(int step) { | 
| ryood | 0:9a0f67fe026b | 59 | #if (UART_TRACE) | 
| ryood | 0:9a0f67fe026b | 60 | printf("displayWhileStop step:%d\r\n", step); | 
| ryood | 0:9a0f67fe026b | 61 | #endif | 
| ryood | 0:9a0f67fe026b | 62 | }; | 
| ryood | 0:9a0f67fe026b | 63 | |
| ryood | 0:9a0f67fe026b | 64 | Sequence* sequences; | 
| ryood | 0:9a0f67fe026b | 65 | int sequenceNum; | 
| ryood | 3:5b11261a545a | 66 | int octave; | 
| ryood | 1:1f6d3e65d946 | 67 | int bpm; | 
| ryood | 4:e51a5f0891a0 | 68 | int waveShape; | 
| ryood | 4:e51a5f0891a0 | 69 | int modNumber; | 
| ryood | 0:9a0f67fe026b | 70 | }; | 
| ryood | 0:9a0f67fe026b | 71 | |
| ryood | 0:9a0f67fe026b | 72 | #endif //_SEQUENCE_DISPLAY_H_ |