CQエレクトロニクス・セミナ「実習・マイコンを動かしながら学ぶディジタル・フィルタ」で使うプログラムを,入力として STM32F746 の内蔵 ADC を使うように変更したもの. http://seminar.cqpub.co.jp/ccm/ES18-0020
Dependencies: mbed Array_Matrix BSP_DISCO_F746NG LCD_DISCO_F746NG TS_DISCO_F746NG
Diff: F746_Gui_New/NumericLabel.hpp
- Revision:
- 2:dd48e1e59daa
- Parent:
- 1:501a83a5ee9d
--- a/F746_Gui_New/NumericLabel.hpp Wed Nov 08 11:43:52 2017 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -//----------------------------------------------------------- -// NumericLabel class -- derived class of Label class -// -// 2016/11/07, Copyright (c) 2016 MIKAMI, Naoki -//----------------------------------------------------------- - -#ifndef F746_NUMERIC_LABEL_HPP -#define F746_NUMERIC_LABEL_HPP - -#include "Label.hpp" - -namespace Mikami -{ - template <typename T> class NumericLabel : public Label - { - public: - // Constructor without drawing value - NumericLabel(uint16_t x, uint16_t y, - const char fmt[], - TextAlignMode mode = LEFT, - sFONT &fonts = Font12, - uint32_t textColor = GuiBase::ENUM_TEXT, - uint32_t backColor = GuiBase::ENUM_BACK) - : Label(x, y, "", mode, fonts, textColor, backColor), FMT_(fmt) {} - - // Constructor with drawing value - NumericLabel(uint16_t x, uint16_t y, - const char fmt[], T val, - TextAlignMode mode = LEFT, - sFONT &fonts = Font12, - uint32_t textColor = GuiBase::ENUM_TEXT, - uint32_t backColor = GuiBase::ENUM_BACK) - : Label(x, y, "", mode, fonts, textColor, backColor), FMT_(fmt) - { Draw(val); } - - // Draw value using format specified in constructor - void Draw(T val) - { - sprintf(str_, FMT_, val); - Label::Draw(str_); - } - - // Draw value - void Draw(const char fmt[], T val) - { - sprintf(str_, fmt, val); - Label::Draw(str_); - } - - // Draw previous value with specified color - void Redraw(uint32_t color) - { Label::Draw(str_, color); } - - private: - const char *const FMT_; - char str_[81]; - - // disallow copy constructor and assignment operator - NumericLabel(const NumericLabel&); - NumericLabel& operator=(const NumericLabel&); - }; -} -#endif // F746_NUMERIC_LABEL_HPP -