/*	Copyright  (c)	Günter Woigk 2013 - 2013
					mailto:kio@little-bat.de

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

	Permission to use, copy, modify, distribute, and sell this software and
	its documentation for any purpose is hereby granted without fee, provided
	that the above copyright notice appear in all copies and that both that
	copyright notice and this permission notice appear in supporting
	documentation, and that the name of the copyright holder not be used
	in advertising or publicity pertaining to distribution of the software
	without specific, written prior permission.  The copyright holder makes no
	representations about the suitability of this software for any purpose.
	It is provided "as is" without express or implied warranty.

	THE COPYRIGHT HOLDER DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
	INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
	EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY SPECIAL, INDIRECT OR
	CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
	DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
	TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
	PERFORMANCE OF THIS SOFTWARE.
*/


#ifndef SIOINSPECTOR_H
#define SIOINSPECTOR_H


#include "Inspector.h"

class Sio;
class MyLineEdit;
class QLabel;


class SioInspector : public Inspector
{
	Q_OBJECT

	Sio*	sio;

	MyLineEdit*	led_mra0;
	MyLineEdit*	led_mra1;
	MyLineEdit*	led_mra2;
//	MyLineEdit*	mra_ptr;		// pointer in mra[] and mrb[]

	MyLineEdit*	led_csra;		// clock select register
	MyLineEdit*	led_sra;		// status registers
	MyLineEdit*	led_baudrate_rxa;
	MyLineEdit*	led_baudrate_txa;
	MyLineEdit*	led_ibua;
	MyLineEdit*	led_obua;

	MyLineEdit*	led_mrb0;
	MyLineEdit*	led_mrb1;
	MyLineEdit*	led_mrb2;
//	MyLineEdit*	mrb_ptr;		// pointer in mra[] and mrb[]

	MyLineEdit*	led_csrb;		// clock select register
	MyLineEdit*	led_srb;		// status registers
	MyLineEdit*	led_baudrate_txb;
	MyLineEdit*	led_baudrate_rxb;
	MyLineEdit*	led_ibub;
	MyLineEdit*	led_obub;

	MyLineEdit*	led_isr;		// interrupt status register
	MyLineEdit*	led_imr;		// interrupt mask register

	MyLineEdit*	led_ctp;		// c/t preload value (16 bit)
	MyLineEdit*	ct_period;		// c/t period [s] (double)

	MyLineEdit*	led_acr;		// aux. command register
	MyLineEdit*	led_gpr;		// general purpose register

	MyLineEdit*	led_ipr;		// input port bits
	MyLineEdit*	led_opcr;		// output pin control register
	MyLineEdit*	led_opr;		// output port bits

	QLabel*	info_mra0;
	QLabel*	info_mra1;
	QLabel*	info_mra2;
	QLabel*	info_sra;
	QLabel*	info_mrb0;
	QLabel*	info_mrb1;
	QLabel*	info_mrb2;
	QLabel*	info_srb;

	QLabel*	info_acr;
	QLabel*	info_imr;
	QLabel*	info_isr;
	QLabel*	info_ipr;
	QLabel*	info_opcr;
	QLabel*	info_opr;

	uint mra0,mra1,mra2,csra,sra, mrb0,mrb1,mrb2,csrb,srb;
	uint isr,imr,ctpu,ctpl,acr,gpr,ipr,opcr,opr;
	double txa_tpc,txb_tpc,rxa_tpc,rxb_tpc;
	uint txa_rp,txa_wp,rxa_rp,rxa_wp,txb_rp,txb_wp,rxb_rp,rxb_wp;

//	QPushButton* button_xxx;


	MyLineEdit* newLineEdit(int x, int y, int w, cstr slot);
	QLabel *newLabel(int x,int y, cstr text);
	QLabel *newInfo(int x,int y);

public:
	explicit SioInspector(QWidget* parent, Sio* sio);

signals:

public slots:

virtual void	update();

		void	slot_mra0();
		void	slot_mra1();
		void	slot_mra2();
		void	slot_csra();
		void	slot_sra();
		void	slot_ibua();
		void	slot_obua();

		void	slot_mrb0();
		void	slot_mrb1();
		void	slot_mrb2();
		void	slot_csrb();
		void	slot_srb();
		void	slot_ibub();
		void	slot_obub();

		void	slot_isr();
		void	slot_imr();
		void	slot_ctp();
		void	slot_ctc();
		void	slot_acr();
		void	slot_gpr();
		void	slot_ipcr();
		void	slot_ipr();
		void	slot_opcr();
		void	slot_opr();
};

#endif // SIOINSPECTOR_H





















