forked from TroikaTronix/firmata_test
-
Notifications
You must be signed in to change notification settings - Fork 0
/
firmata_test.h
89 lines (71 loc) · 2.15 KB
/
firmata_test.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#ifndef __firmata_test_H__
#define __firmata_test_H__
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma interface "firmata_test.h"
#endif
#include "wx/wx.h" // MFC - changed to quotes for XCode compliance
#include "wx/tglbtn.h" // MFC - changed to quotes for XCode compliance
#include <stdint.h>
//#define LOG_MSG_TO_STDOUT
//#define LOG_MSG_TO_WINDOW
#if defined(LOG_MSG_TO_WINDOW)
#define printf(...) (wxLogMessage(__VA_ARGS__))
#elif defined(LOG_MSG_TO_STDOUT)
#else
#define printf(...)
#endif
// comment this out to enable lots of printing to stdout
const int ID_MENU = 10000;
//----------------------------------------------------------------------------
// MyFrame
//----------------------------------------------------------------------------
class MyFrame: public wxFrame
{
public:
MyFrame( wxWindow *parent, wxWindowID id, const wxString &title,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxDEFAULT_FRAME_STYLE );
private:
wxFlexGridSizer *grid;
wxScrolledWindow *scroll;
int parse_count;
int parse_command_len;
uint8_t parse_buf[4096];
private:
void init_data(void);
void new_size(void);
void add_item_to_grid(int row, int col, wxWindow *item);
void add_pin(int pin);
void UpdateStatus(void);
void Parse(const uint8_t *buf, int len);
void DoMessage(void);
void OnAbout(wxCommandEvent &event);
void OnQuit(wxCommandEvent &event);
void OnIdle(wxIdleEvent &event);
void OnCloseWindow(wxCloseEvent &event);
void OnSize(wxSizeEvent &event);
void OnPort(wxCommandEvent &event);
void OnToggleButton(wxCommandEvent &event);
void OnSliderDrag(wxScrollEvent &event);
void OnModeChange(wxCommandEvent &event);
DECLARE_EVENT_TABLE()
};
class MyMenu: public wxMenu
{
public:
MyMenu(const wxString& title = "", long style = 0);
void OnShowPortList(wxMenuEvent &event);
void OnHighlight(wxMenuEvent &event);
};
//----------------------------------------------------------------------------
// MyApp
//----------------------------------------------------------------------------
class MyApp: public wxApp
{
public:
MyApp();
virtual bool OnInit();
virtual int OnExit();
};
#endif