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: BSP_DISCO_F746NG LCD_DISCO_F746NG TS_DISCO_F746NG mbed BUTTON_GROUP
my_classes/button.hpp
- Committer:
- MikamiUitOpen
- Date:
- 2015-11-05
- Revision:
- 1:27bfb11afcff
- Parent:
- 0:9a78f27b84a4
File content as of revision 1:27bfb11afcff:
//-----------------------------------------------------------
// Button class -- Header
//
// 2015/11/05, Copyright (c) 2015 MIKAMI, Naoki
//-----------------------------------------------------------
#ifndef F746_BUTTON_HPP
#define F746_BUTTON_HPP
#include "mbed.h"
#include "TS_DISCO_F746NG.h"
#include "LCD_DISCO_F746NG.h"
namespace Mikami
{
class Button
{
public:
// Constructor
Button(LCD_DISCO_F746NG &lcd, TS_DISCO_F746NG &ts,
uint16_t x, uint16_t y, uint16_t width, uint16_t height,
uint32_t color, char str[] = "", sFONT &fonts = Font12,
uint32_t textColor = LCD_COLOR_WHITE);
// Draw button
void Draw(uint32_t color, uint32_t textColor = LCD_COLOR_WHITE);
// Redraw button with created color
void ReDraw(uint32_t textColor = LCD_COLOR_WHITE)
{ Draw(COLOR_, textColor); }
// Erase button with selected color
void Erase(uint32_t color)
{ Draw(color, color); }
// Check touch detected
bool Touched();
// Check touch detected and redraw button
bool Touched(uint32_t color);
private:
LCD_DISCO_F746NG *const LCD_;
TS_DISCO_F746NG *const TS_;
const uint16_t X_, Y_, W_, H_;
const uint32_t COLOR_;
sFONT *const FONTS_;
char str_[81];
// disallow copy constructor and assignment operator
Button(const Button&);
Button& operator=(const Button&);
};
}
#endif // F746_BUTTON_HPP