PICSimLab - Programmable IC Simulator Laboratory 0.9.2
PICSimLab - API
Loading...
Searching...
No Matches
board_McLab2.h
1/* ########################################################################
2
3 PICSimLab - Programmable IC Simulator Laboratory
4
5 ########################################################################
6
7 Copyright (c) : 2010-2024 Luis Claudio GambĂ´a Lopes <lcgamboa@yahoo.com>
8
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2, or (at your option)
12 any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22
23 For e-mail suggestions : lcgamboa@yahoo.com
24 ######################################################################## */
25
26#ifndef BOARD_McLab2_H
27#define BOARD_McLab2_H
28
29#include "../devices/lcd_hd44780.h"
30#include "../devices/mi2c_24CXXX.h"
31#include "../devices/rtc_ds1307.h"
32#include "../devices/swbounce.h"
33#include "bsim_picsim.h"
34
35#define BOARD_McLab2_Name "McLab2"
36
37class cboard_McLab2 : public bsim_picsim {
38private:
39 unsigned char p_BT[4];
40
41 unsigned char pot1;
42 unsigned char active;
43
44 lcd_t lcd;
45
46 mi2c_t mi2c;
47
48 int vtc;
49 int vt;
50
51 int lcde;
52
53 int sound_on;
54
55 float vp2in;
56 float vp2[2];
57 float temp[2];
58 float ref;
59
60 int rpmstp;
61 int rpmc;
62
63 unsigned char d;
64 unsigned char sda, sck;
65
66 unsigned char jmp[8];
67 unsigned int lm1[40]; // luminosidade media display
68 unsigned int lm2[40]; // luminosidade media display
69 unsigned int lm3[40]; // luminosidade media display
70 unsigned int lm4[40]; // luminosidade media display
71
72 int buzzerId;
73
74 int vent[2];
75
76 char mi2c_tmp_name[200];
77
78 void RegisterRemoteControl(void) override;
79 SWBounce_t bounce;
80 int TimerID;
81 int heater_pwr;
82 int cooler_pwr;
83
84public:
85 // Return the board name
86 std::string GetName(void) override { return BOARD_McLab2_Name; };
87 std::string GetAboutInfo(void) override { return "L.C. Gamboa \n <lcgamboa@yahoo.com>"; };
88 cboard_McLab2(void);
89 ~cboard_McLab2(void);
90 void Draw(void) override;
91 void Run_CPU(void) override;
92 std::string GetSupportedDevices(void) override {
93 return "PIC16F1789,PIC16F1939,PIC16F777,PIC16F877A,PIC16F887,PIC18F452,PIC18F4520,PIC18F4550,PIC18F45K50,"
94 "PIC18F4580,PIC18F4620,PIC18F47K40,";
95 };
96 int MInit(const char* processor, const char* fname, float freq) override;
97 void Reset(void) override;
98 int MDumpMemory(const char* mfname) override;
99 void EvMouseButtonPress(unsigned int button, unsigned int x, unsigned int y, unsigned int state) override;
100 void EvMouseButtonRelease(unsigned int button, unsigned int x, unsigned int y, unsigned int state) override;
101 void EvMouseMove(unsigned int button, unsigned int x, unsigned int y, unsigned int state) override;
102 void EvKeyPress(unsigned int key, unsigned int mask) override;
103 void EvKeyRelease(unsigned int key, unsigned int mask) override;
104 void EvOnShow(void) override;
105 void RefreshStatus(void) override;
106 void WritePreferences(void) override;
107 void ReadPreferences(char* name, char* value) override;
108 void SetScale(double scale) override;
109 unsigned short GetInputId(char* name) override;
110 unsigned short GetOutputId(char* name) override;
111 void OnTime(void);
112};
113
114#endif /* BOARD_McLab2_H */
Definition bsim_picsim.h:34
Definition board_McLab2.h:37
void Run_CPU(void) override
Paralle thread called ever 100ms to run cpu code.
Definition board_McLab2.cc:609
std::string GetName(void) override
Get board name registered in PICSimLab.
Definition board_McLab2.h:86
void RegisterRemoteControl(void) override
Register remote control variables.
Definition board_McLab2.cc:895
std::string GetAboutInfo(void) override
Return the about information of part.
Definition board_McLab2.h:87
void Reset(void) override
Reset board status.
Definition board_McLab2.cc:858
void EvOnShow(void) override
Event on the board.
Definition board_McLab2.cc:1176
unsigned short GetInputId(char *name) override
return the input ids numbers of names used in input map
Definition board_McLab2.cc:1181
void ReadPreferences(char *name, char *value) override
Called whe configuration file load preferences.
Definition board_McLab2.cc:1381
std::string GetSupportedDevices(void) override
Return a list of supported microcontrollers.
Definition board_McLab2.h:92
void EvMouseButtonRelease(unsigned int button, unsigned int x, unsigned int y, unsigned int state) override
Event on the board.
Definition board_McLab2.cc:1091
void RefreshStatus(void) override
Called ever 1s to refresh status.
Definition board_McLab2.cc:1352
void SetScale(double scale) override
Set board draw scale.
Definition board_McLab2.cc:208
void EvMouseMove(unsigned int button, unsigned int x, unsigned int y, unsigned int state) override
Event on the board.
Definition board_McLab2.cc:1072
void Draw(void) override
Called ever 100ms to draw board.
Definition board_McLab2.cc:242
int MDumpMemory(const char *mfname) override
board microcontroller save non volatile memory to hex file
Definition board_McLab2.cc:224
int MInit(const char *processor, const char *fname, float freq) override
board microcontroller init
Definition board_McLab2.cc:191
unsigned short GetOutputId(char *name) override
return the output ids numbers of names used in output map
Definition board_McLab2.cc:1222
void EvKeyPress(unsigned int key, unsigned int mask) override
Event on the board.
Definition board_McLab2.cc:1135
void EvMouseButtonPress(unsigned int button, unsigned int x, unsigned int y, unsigned int state) override
Event on the board.
Definition board_McLab2.cc:946
void WritePreferences(void) override
Called to save board preferences in configuration file.
Definition board_McLab2.cc:1368
void EvKeyRelease(unsigned int key, unsigned int mask) override
Event on the board.
Definition board_McLab2.cc:1154
Definition swbounce.h:29
Definition lcd_hd44780.h:67
Definition mi2c_24CXXX.h:28