![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
CQエレクトロニクス・セミナ「実習・マイコンを動かしながら学ぶディジタル・フィルタ」で使うプログラム.1次IIRフィルタの係数をターミナルから変更できる. http://seminar.cqpub.co.jp/ccm/ES18-0020
Dependencies: mbed Array_Matrix BSP_DISCO_F746NG LCD_DISCO_F746NG TS_DISCO_F746NG
F746_Gui_New/SeekbarGroup.cpp@2:aa11055138a2, 2017-11-08 (annotated)
- Committer:
- MikamiUitOpen
- Date:
- Wed Nov 08 11:10:56 2017 +0000
- Revision:
- 2:aa11055138a2
- Parent:
- 0:47718d3154d9
3
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
MikamiUitOpen | 0:47718d3154d9 | 1 | //----------------------------------------------------------- |
MikamiUitOpen | 0:47718d3154d9 | 2 | // SeekbarGroup class |
MikamiUitOpen | 0:47718d3154d9 | 3 | // |
MikamiUitOpen | 0:47718d3154d9 | 4 | // 2017/01/25, Copyright (c) 2017 MIKAMI, Naoki |
MikamiUitOpen | 0:47718d3154d9 | 5 | //----------------------------------------------------------- |
MikamiUitOpen | 0:47718d3154d9 | 6 | |
MikamiUitOpen | 0:47718d3154d9 | 7 | #include "SeekbarGroup.hpp" |
MikamiUitOpen | 0:47718d3154d9 | 8 | |
MikamiUitOpen | 0:47718d3154d9 | 9 | namespace Mikami |
MikamiUitOpen | 0:47718d3154d9 | 10 | { |
MikamiUitOpen | 0:47718d3154d9 | 11 | SeekbarGroup::SeekbarGroup( |
MikamiUitOpen | 0:47718d3154d9 | 12 | uint16_t x0, uint16_t y0, uint16_t length, |
MikamiUitOpen | 0:47718d3154d9 | 13 | uint16_t number, uint16_t space, |
MikamiUitOpen | 0:47718d3154d9 | 14 | float min, float max, float initialValue, |
MikamiUitOpen | 0:47718d3154d9 | 15 | SeekBar::Orientation hv, |
MikamiUitOpen | 0:47718d3154d9 | 16 | uint32_t thumbColor, uint16_t thumbSize, uint16_t width, |
MikamiUitOpen | 0:47718d3154d9 | 17 | uint32_t colorL, uint32_t colorH, uint32_t backColor) |
MikamiUitOpen | 0:47718d3154d9 | 18 | : NUMBER_(number) |
MikamiUitOpen | 0:47718d3154d9 | 19 | { |
MikamiUitOpen | 0:47718d3154d9 | 20 | seekBars_.SetSize(number); |
MikamiUitOpen | 0:47718d3154d9 | 21 | for (int n=0; n<number; n++) |
MikamiUitOpen | 0:47718d3154d9 | 22 | { |
MikamiUitOpen | 0:47718d3154d9 | 23 | uint16_t x = x0; |
MikamiUitOpen | 0:47718d3154d9 | 24 | uint16_t y = y0; |
MikamiUitOpen | 0:47718d3154d9 | 25 | if (hv == SeekBar::Holizontal) y += space*n; |
MikamiUitOpen | 0:47718d3154d9 | 26 | else x += space*n; |
MikamiUitOpen | 0:47718d3154d9 | 27 | seekBars_[n] = |
MikamiUitOpen | 0:47718d3154d9 | 28 | new SeekBar(x, y, length, min, max, initialValue, hv, |
MikamiUitOpen | 0:47718d3154d9 | 29 | thumbColor, thumbSize, width, |
MikamiUitOpen | 0:47718d3154d9 | 30 | colorL, colorH, backColor); |
MikamiUitOpen | 0:47718d3154d9 | 31 | } |
MikamiUitOpen | 0:47718d3154d9 | 32 | } |
MikamiUitOpen | 0:47718d3154d9 | 33 | |
MikamiUitOpen | 0:47718d3154d9 | 34 | // Get slided number |
MikamiUitOpen | 0:47718d3154d9 | 35 | bool SeekbarGroup::GetSlidedNumber(int &num) |
MikamiUitOpen | 0:47718d3154d9 | 36 | { |
MikamiUitOpen | 0:47718d3154d9 | 37 | bool active = false; |
MikamiUitOpen | 0:47718d3154d9 | 38 | for (int n=0; n<NUMBER_; n++) |
MikamiUitOpen | 0:47718d3154d9 | 39 | if (seekBars_[n]->IsActive()) active = true; |
MikamiUitOpen | 0:47718d3154d9 | 40 | if (!active) return false; |
MikamiUitOpen | 0:47718d3154d9 | 41 | |
MikamiUitOpen | 0:47718d3154d9 | 42 | if (!GuiBase::PanelTouched()) |
MikamiUitOpen | 0:47718d3154d9 | 43 | { |
MikamiUitOpen | 0:47718d3154d9 | 44 | for (int n=0; n<NUMBER_; n++) |
MikamiUitOpen | 0:47718d3154d9 | 45 | { |
MikamiUitOpen | 0:47718d3154d9 | 46 | if (seekBars_[n]->GetSlided()) |
MikamiUitOpen | 0:47718d3154d9 | 47 | seekBars_[n]->Draw(seekBars_[n]->GetValue()); |
MikamiUitOpen | 0:47718d3154d9 | 48 | seekBars_[n]->SetSlided(false); |
MikamiUitOpen | 0:47718d3154d9 | 49 | } |
MikamiUitOpen | 0:47718d3154d9 | 50 | return false; |
MikamiUitOpen | 0:47718d3154d9 | 51 | } |
MikamiUitOpen | 0:47718d3154d9 | 52 | |
MikamiUitOpen | 0:47718d3154d9 | 53 | bool rtn = false; |
MikamiUitOpen | 0:47718d3154d9 | 54 | uint16_t x, y; |
MikamiUitOpen | 0:47718d3154d9 | 55 | for (int n=0; n<NUMBER_; n++) |
MikamiUitOpen | 0:47718d3154d9 | 56 | { |
MikamiUitOpen | 0:47718d3154d9 | 57 | if (seekBars_[n]->IsOnThumb(x, y)) |
MikamiUitOpen | 0:47718d3154d9 | 58 | { |
MikamiUitOpen | 0:47718d3154d9 | 59 | if ((num != n) && Range(num)) |
MikamiUitOpen | 0:47718d3154d9 | 60 | seekBars_[num]->Draw(seekBars_[num]->GetValue()); |
MikamiUitOpen | 0:47718d3154d9 | 61 | num = n; |
MikamiUitOpen | 0:47718d3154d9 | 62 | seekBars_[n]->SetValue(seekBars_[n]->ToValue(SeekBar::Point(x, y))); |
MikamiUitOpen | 0:47718d3154d9 | 63 | seekBars_[n]->Draw(seekBars_[n]->GetValue(), true); |
MikamiUitOpen | 0:47718d3154d9 | 64 | seekBars_[n]->SetSlided(true); |
MikamiUitOpen | 0:47718d3154d9 | 65 | rtn = true; |
MikamiUitOpen | 0:47718d3154d9 | 66 | } |
MikamiUitOpen | 0:47718d3154d9 | 67 | if (rtn) break; |
MikamiUitOpen | 0:47718d3154d9 | 68 | } |
MikamiUitOpen | 0:47718d3154d9 | 69 | return rtn; |
MikamiUitOpen | 0:47718d3154d9 | 70 | } |
MikamiUitOpen | 0:47718d3154d9 | 71 | } |
MikamiUitOpen | 0:47718d3154d9 | 72 |