Ejemplo n.º 1
0
Archivo: vfo.cpp Proyecto: radi8/vfo
// When we arrive here from a right button click on the bandButtons group the variable
// cur_Band will hold the index to the required band button
void vfo::storeVFO()
{
    int retrievedFreq;
    int cnt;

    qDebug() << "From storeVFO(), band button = " << cur_Band;

    if (selectedVFO != 'B') {
        retrievedFreq = readA(); //Using vfoA
    } else {
        retrievedFreq = readB();
    }
    // Search to see if the freq is already stored
    for (cnt = 0; cnt < 4; cnt++) {       //If the freq is in one of the memories then set
        if (retrievedFreq == bands[cur_Band][cnt]) break;  // the browsePtr to point to it.
    }
    if (cnt != 4) { //cnt will be 4 if no matching memory freq.
        browsePtr = cnt; // Points to matching memory position & we don't need to store it.
    }   else {
        bands[cur_Band][bDat_index]--;
        bands[cur_Band][bDat_index] &= 0x03;
        bands[cur_Band][bands[cur_Band][bDat_index]] = retrievedFreq;
        browsePtr = bands[cur_Band][bDat_index]; //Point to last stored freq.
    }
    timer.start(500,this);
    ui->btnGrpBand->checkedButton()->setStyleSheet("background-color: yellow");
}
Ejemplo n.º 2
0
Archivo: vfo.cpp Proyecto: radi8/vfo
void vfo::on_pBtnvfoB_clicked()
{
    if (selectedVFO != 'B') {
        if (ui->pBtnRIT->isChecked()) {
            ui->pBtnRIT->setChecked(false);
            on_pBtnRIT_clicked();
        }
        selectedVFO = 'B';
        ui->pBtnvfoB->setStyleSheet("background-color: rgb(85, 255, 0)");
        ui->pBtnvfoA->setStyleSheet("background-color: normal");
        ui->pBtnSplit->setStyleSheet("background-color: normal");
        vfoEnabled(false, true);
        setBandButton(readB());
        writeB(readB());
    }
}
Ejemplo n.º 3
0
Archivo: vfo.cpp Proyecto: radi8/vfo
void vfo::wheelEvent(QWheelEvent *event)
{
    QString str;
    int x, digit;
    int direction = 0;
    static const int mult[2][9] = {
        {100000000,10000000,1000000,100000,10000,1000,100,10,1},            // Retrieve with mult[0][0 ... 8]
        {-100000000,-10000000,-1000000,-100000,-10000,-1000,-100,-10,-1}    // Retrieve with mult[1][0 ... 8]
    };

    digit = getDigit(event->x(), event->y());
    if (digit != 9) {  // getDigit returns 9 if click was outside display area so we just fall through.
        if (event->delta() < 0) direction = 1;  // x becomes pos or neg depending on wheel rotation.
        if (digit < 9) { // getDigit returns 0 ... 8 if we clicked on vfoA
            x = mult[direction][digit];
            x = x + readA();
            if (x >= 0 && x <= 999999999)  // Safe to update the display without overflow or underflow.
                writeA(x);
        } else {                  // getDigit returns 10 ... 18 if we clicked on vfoB
            digit = digit - 10; // so convert to 1 ... 8.
            x = mult[direction][digit];
            x = x + readB();
            if (x >= 0 && x <= 999999999)  // Safe to update the display without overflow or underflow.
                writeB(x);
        }
    }  //We fall through to here without processing the wheel if getDigit returns 9.
}
Ejemplo n.º 4
0
Archivo: vfo.cpp Proyecto: radi8/vfo
void vfo::on_pBtnExch_clicked()
{
    int exchTemp;

    exchTemp = readA();
    writeA(readB());
    writeB(exchTemp);
}
Ejemplo n.º 5
0
long long vfo::getTxFrequency()
{
    if(selectedVFO == 'A') {
        return readA();
    } else {
        return readB();
    }
}
Ejemplo n.º 6
0
Archivo: vfo.cpp Proyecto: radi8/vfo
void vfo::on_toolBtnDn_clicked()
{
    switch (selectedVFO) {
    case 'A':
    case 'S': {
        writeA(readA() - 24000);
        break;
    }
    case 'B':
        writeB(readB() - 24000);
    }
}
Ejemplo n.º 7
0
Archivo: vfo.cpp Proyecto: radi8/vfo
void vfo::on_pBtnRIT_clicked()
{
    int chkd = -1;

    if (ui->pBtnRIT->isChecked()) {
        chkd = 1;
    }
    if (selectedVFO != 'B') { // Using vfoA or Split if 'B' is not selectedVFO.
        writeA(readA() + ui->hSlider->value() * chkd);
    } else {
        writeB(readB() + ui->hSlider->value() * chkd);
    }
}
Ejemplo n.º 8
0
void vfo::on_pBtnvfoB_clicked()
{
    if (selectedVFO != 'B' && ptt == false) {
        if (ui->pBtnRIT->isChecked()) {
            ui->pBtnRIT->setChecked(false);
            on_pBtnRIT_clicked();
        }
        selectedVFO = 'B';
        setVfoBtnColour();
        vfoEnabled(false, true);
        emit frequencyChanged(readB());
    }
}
Ejemplo n.º 9
0
Archivo: vfo.cpp Proyecto: radi8/vfo
void vfo::processRIT(int rit)
{
    static int freq = 0;

    freq = rit - freq; // freq now holds difference between last rit and this.
    if (selectedVFO != 'B') { // Using vfoA or Split if 'B' is not selectedVFO.
        freq += readA();
        if (ui->pBtnRIT->isChecked()) writeA(freq);
    } else {
        freq += readB();
        if (ui->pBtnRIT->isChecked()) writeB(freq);
    }
    freq = rit;
}
Ejemplo n.º 10
0
void Timer0A_Handler(void){
	unsigned int newPortDValues;
  unsigned int newPortBValues;
  TIMER0_ICR_R = TIMER_ICR_TATOCINT;// acknowledge timer0A timeout

	TIMER0_TAILR_R = interrupt_cycles_a - 1; //TIMER0_TAILR_R + periodShift;
	
	newPortDValues = readD();
	newPortBValues = readB();
	portBValues = newPortBValues;
	portDValues = newPortDValues;
	//read ports
	//for each bit, if the value is different, send through zigbee 
 // (*PeriodicTask)();                // execute user task
}
Ejemplo n.º 11
0
void vfo::on_pBtnExch_clicked()
{
    long long exchTemp1;
    long long exchTemp2;

    exchTemp1 = readA();
    exchTemp2 = readB();

    writeA(exchTemp2);
    writeB(exchTemp1);
    if(selectedVFO == 'B') {
        emit frequencyChanged(exchTemp1);
    } else {
        emit frequencyChanged(exchTemp2);
    }
}
Ejemplo n.º 12
0
void vfo::pttChange(bool pttState)
{
    long long temp;

    ptt = pttState;
    if(ptt) { // Going from Rx to Tx
        if(selectedVFO=='S') { //We are going to transmit on vfoB frequency
            temp = readA();                 //Because we are switched to vfoA we will place the
            emit frequencyChanged(readB()); //value of vfoB in it when doing the frequency change
            writeA(temp);                   //hence needing to save and restore vfoA via temp.
        }
    } else { // Going from Tx to Rx
        if(selectedVFO=='S') { //We are going to receive on vfoA frequency
            emit frequencyChanged(readA());
        }
    }
    setVfoBtnColour();
}
Ejemplo n.º 13
0
Archivo: vfo.cpp Proyecto: radi8/vfo
void vfo::on_pBtnSplit_clicked()
{
    if (selectedVFO != 'S') {
        if (ui->pBtnRIT->isChecked()) {
            ui->pBtnRIT->setChecked(false);
            on_pBtnRIT_clicked();
        }
        selectedVFO = 'S';
        ui->pBtnvfoA->setStyleSheet("background-color: rgb(85, 255, 0)");
        ui->pBtnvfoB->setStyleSheet("background-color: rgb(255, 155, 155)");
        ui->pBtnSplit->setStyleSheet("background-color: rgb(0, 170, 255)");
        vfoEnabled(true, false);
        setBandButton(readA());
        if (ptt == true) {
            writeB(readB());
        } else {
            writeA(readA());
        }
    }
}
Ejemplo n.º 14
0
/**
  \brief Commits all the changes in the buffer to disk.
  \return The  number of bytes written are returned or <0 if error
*/
int NMFile::commit()
{
	char buf[32768];
	int rc = 0;
	if(fd < 0) {
		cerr << " NMFile commit failed: Create or open a file first" << '\n';
		return -1;
	}
	memset(buf,'\0',32768);
	if( length() > 0) {
		readB(buf,length());
		rc = ::write(fd, buf, strlen(buf));
		if(rc < 0) {
			cerr << "NMFile commit failed: " << strerror(errno) << '\n';
			return rc;
		}	
	}
	if(length() > 0) commit();
	clear();
	return rc;
}
Ejemplo n.º 15
0
__attribute__((noreturn)) void main(void){
	cli();
	//set-up serial communications
	DDRD=28;//3 serial pins on d.2 to d.4 d.5 to d.7 contain msbs for flash data d.0 to d.4 is in port C
	DDRB=62;//serial clocks (B.1 SHCP) (B.2 Latch) (B.3 CE#) (B.4 OE#) (B.5 WE#)
	UBRR0H=0;
	UBRR0L=3;//set to 0.5M baud
	UCSR0A|=2;//double speed aysnc
	UCSR0B = (1<<RXEN0)|(1<<TXEN0);//Enable receiver and transmitter
	UCSR0C=6;//async 1 stop bit 8bit char no parity bits
	_delay_ms(50);
	StringPgm(PSTR("RDY"));
	USART_Receive();//wait for handshake
	char mode = USART_Receive();//wait for mode
	StringPgm(PSTR("RDY"));
	serialWrB(readId(0));
	uint8_t cap=readId(1);
	serialWrB(cap);
	__uint24 capacity=524288L;
	switch(cap){
		case 0xB5:
			capacity=131072L;
		case 0xB6:
			capacity=262144L;
		break;
	}
	if(mode=='W'){
		chipErase();
		serialWrB('D');
		verifyF(capacity);
		__uint24 x;
		for (x=0;x<capacity;++x){
			pgmB(x,USART_Receive());
			serialWrB(readB(x));
		}
	}else if(mode=='R')
		ReadChip(capacity);
	while(1);
}
Ejemplo n.º 16
0
Archivo: vfo.cpp Proyecto: radi8/vfo
void vfo::btnGrpBand(int btn)
{
    int retrievedFreq;
    int vfoFreq;
    int cnt;
//    bool vfoBflag;

    btn = -1 * (btn + 2); //Map buttons (-2 .. -14) to (0 .. 11)
    // Test to see if we are changing band.
    if (btn != cur_Band) {
        cur_Band = btn; //Yes, so retrieve current freq for band.
        retrievedFreq = bands[btn][bDat_cFreq];
        for (cnt = 0; cnt < 4; cnt++) {   //If the freq is in one of the memories then set
            if (retrievedFreq == bands[btn][cnt]) break;  // the browsePtr to point to it.
        }
        if (cnt != 4) { //cnt will be 4 if no matching memory.
            browsePtr = cnt; // Points to matching memory position
        }   else {
            browsePtr = bands[btn][bDat_index]; //Initialised to point to last stored freq.
        }
    } else {
        retrievedFreq = bands[btn][browsePtr];
        if (selectedVFO != 'B') {
        vfoFreq = readA();
        }   else {
        vfoFreq = readB();
        }
        if (vfoFreq == retrievedFreq) {
            browsePtr++;
            browsePtr &= 0x03;
            retrievedFreq = bands[btn][browsePtr];
        }
    }
    if (selectedVFO != 'B') {
        writeA(retrievedFreq);
    } else {
        writeB(retrievedFreq);
    }
}
Ejemplo n.º 17
0
void vfo::wheelEvent(QWheelEvent *event)
{
    QString str;
    long long x;
    int digit;
    int direction = 1;
    bool isVfoA = true;
    static const int mult[9] = {100000000,10000000,1000000,100000,10000,1000,100,10,1};

    digit = getDigit(event->x(), event->y());
    if (digit != 9) {  // getDigit returns 9 if click was outside display area so we just fall through.
        if (event->delta() < 0) direction = -1;  // x becomes pos or neg depending on wheel rotation.
        if (digit > 9) { // getDigit returns 10 ... 18 if we clicked on vfoB
            digit = digit - 10; // so convert to 1 ... 8.
            isVfoA = false;
        }
        x = mult[digit]*direction;
        if(isVfoA) {    //If true we scrolled on vfoA
//qDebug()<<Q_FUNC_INFO<<"The value of x = "<<", & readA() = "<<readA();
            if(selectedVFO == 'A' || selectedVFO == 'S') {
                emit frequencyMoved(x, 1);
            }
            else {
                writeA(readA() - x);
            }
        }
        else {  //We scrolled on vfoB
//qDebug()<<Q_FUNC_INFO<<"The value of x = "<< x<<", & readB() = "<<readB();
            if(selectedVFO == 'B') {
                emit frequencyMoved(x, 1);
            }
            else {
                writeB(readB() - x);
            }
        }
    }  //We fall through to here without processing the wheel if getDigit returns 9.
}
Ejemplo n.º 18
0
void vfo::mousePressEvent(QMouseEvent *event)
{
    bool isVFOa = false;
    int digit, cnt;
    QString myStr = "";
    long long freq;

    if (event->button() == Qt::RightButton) {

//qDebug()<<Q_FUNC_INFO<<": event x/y = "<<event->x()<<"/"<<event->y();

        //Check to see if we have right clicked on the band button group
        if ((event->x() > 414) && (event->x() < 573) &&
            (event->y() > 6) && (event->y() < 111)) {
//            storeVFO(); //make the selected button flash yellow & call store routine
            timer.start(500,this);
            ui->btnGrpBand->checkedButton()->setStyleSheet("background-color: yellow");
            emit rightBandClick();  //connected to Band:quickMemStore via UI:quickMemStore

        }   // Check to see if we have right clicked the RIT slider
        else if ((event->x() > 189) && (event->x() < 403) &&
                 (event->y() > 89) && (event->y() < 111)) {
                ui->hSlider->setValue(0);
        }
        // We have clicked either on the display or somewhere else on the widget

        else {  // Check to see if we have clicked outside the vfo display area
            digit = getDigit(event->x(), event->y());
//qDebug()<<Q_FUNC_INFO<<": The value of digit is ..."<<digit;
            if (digit != 9) {       // getDigit returns 9 if click was outside display area.
                if (digit < 9) {    // getDigit returns 0 ... 8 if we clicked on vfoA
                    freq = readA();
                    isVFOa = true;
                    myStr = ui->lbl_Amhz->text() + ui->lbl_Akhz->text() + ui->lbl_Ahz->text();
                }
                else {                  // getDigit returns 10 ... 18 if we clicked on vfoB
                    digit = digit - 10; // so convert to 1 ... 8.
                    freq = readB();
                    myStr = ui->lbl_Bmhz->text() + ui->lbl_Bkhz->text() + ui->lbl_Bhz->text();
                }
                for (cnt = myStr.length(); cnt < 9; cnt++) {
                    myStr = "0" + myStr;
                }
                for (cnt = digit; cnt < 9; cnt++) {
                    myStr[cnt] = QChar('0');
                    ui->hSlider->setValue(0);
                }
                freq = freq - myStr.toLongLong();
                if (isVFOa) {   //We right clicked on vfoA
                    if(selectedVFO == 'A' || selectedVFO == 'S') {
                        emit frequencyMoved(freq, 1);
//qDebug()<<Q_FUNC_INFO<<": vfoA, emit frequencyChanged(myStr.toLongLong()) = "<<freq;
                    }
                    else {
                        writeA(myStr.toLongLong());
//qDebug()<<Q_FUNC_INFO<<": vfoA, writeA(myStr.toInt()) = "<<freq;
                    }
                }
//                else if(ui->pBtnSubRx->isChecked()) { //We right clicked on vfoB
//qDebug()<<Q_FUNC_INFO<<": vfoB and subRx mode";
//                }
                else if(selectedVFO == 'B') {
                        emit frequencyMoved(freq, 1);
//qDebug()<<Q_FUNC_INFO<<": Line 187 ... vfoB, emit frequencyMoved(freq, 1) = "<<freq;
                }
                else {
                        writeB(myStr.toLongLong());
//qDebug()<<Q_FUNC_INFO<<": vfoB, writeA(myStr.toInt()) = "<<freq;
                }
            }
        }
    }   //If event not right button or getDigit = 9, fall thru to here with no processing.
}
Ejemplo n.º 19
0
void vfo::on_pBtnBtoA_clicked()
{
    writeA(readB());
    emit frequencyChanged(readB());
}
Ejemplo n.º 20
0
Archivo: vfo.cpp Proyecto: radi8/vfo
void vfo::writeSettings()
{
    QSettings settings("freesoftware","vfo");

    settings.setValue("vfoA_f", readA());
    settings.setValue("vfoB_f", readB());
    settings.setValue("Band0_Mem00",bands[0][bDat_mem00]);
    settings.setValue("Band0_Mem01",bands[0][bDat_mem01]);
    settings.setValue("Band0_Mem02",bands[0][bDat_mem02]);
    settings.setValue("Band0_Mem03",bands[0][bDat_mem03]);
    settings.setValue("Band0_Cfreq",bands[0][bDat_cFreq]);
    settings.setValue("Band0_Fqmin",bands[0][bDat_fqmin]);
    settings.setValue("Band0_Fqmax",bands[0][bDat_fqmax]);
    settings.setValue("Band0_Modee",bands[0][bDat_modee]);
    settings.setValue("Band0_FiltH",bands[0][bDat_filtH]);
    settings.setValue("Band0_FiltL",bands[0][bDat_filtL]);
    settings.setValue("Band0_Index",bands[0][bDat_index]);

    settings.setValue("Band1_Mem00",bands[1][bDat_mem00]);
    settings.setValue("Band1_Mem01",bands[1][bDat_mem01]);
    settings.setValue("Band1_Mem02",bands[1][bDat_mem02]);
    settings.setValue("Band1_Mem03",bands[1][bDat_mem03]);
    settings.setValue("Band1_Cfreq",bands[1][bDat_cFreq]);
    settings.setValue("Band1_Fqmin",bands[1][bDat_fqmin]);
    settings.setValue("Band1_Fqmax",bands[1][bDat_fqmax]);
    settings.setValue("Band1_Modee",bands[1][bDat_modee]);
    settings.setValue("Band1_FiltH",bands[1][bDat_filtH]);
    settings.setValue("Band1_FiltL",bands[1][bDat_filtL]);
    settings.setValue("Band1_Index",bands[1][bDat_index]);

    settings.setValue("Band2_Mem00",bands[2][bDat_mem00]);
    settings.setValue("Band2_Mem01",bands[2][bDat_mem01]);
    settings.setValue("Band2_Mem02",bands[2][bDat_mem02]);
    settings.setValue("Band2_Mem03",bands[2][bDat_mem03]);
    settings.setValue("Band2_Cfreq",bands[2][bDat_cFreq]);
    settings.setValue("Band2_Fqmin",bands[2][bDat_fqmin]);
    settings.setValue("Band2_Fqmax",bands[2][bDat_fqmax]);
    settings.setValue("Band2_Modee",bands[2][bDat_modee]);
    settings.setValue("Band2_FiltH",bands[2][bDat_filtH]);
    settings.setValue("Band2_FiltL",bands[2][bDat_filtL]);
    settings.setValue("Band2_Index",bands[2][bDat_index]);

    settings.setValue("Band3_Mem00",bands[3][bDat_mem00]);
    settings.setValue("Band3_Mem01",bands[3][bDat_mem01]);
    settings.setValue("Band3_Mem02",bands[3][bDat_mem02]);
    settings.setValue("Band3_Mem03",bands[3][bDat_mem03]);
    settings.setValue("Band3_Cfreq",bands[3][bDat_cFreq]);
    settings.setValue("Band3_Fqmin",bands[3][bDat_fqmin]);
    settings.setValue("Band3_Fqmax",bands[3][bDat_fqmax]);
    settings.setValue("Band3_Modee",bands[3][bDat_modee]);
    settings.setValue("Band3_FiltH",bands[3][bDat_filtH]);
    settings.setValue("Band3_FiltL",bands[3][bDat_filtL]);
    settings.setValue("Band3_Index",bands[3][bDat_index]);

    settings.setValue("Band4_Mem00",bands[4][bDat_mem00]);
    settings.setValue("Band4_Mem01",bands[4][bDat_mem01]);
    settings.setValue("Band4_Mem02",bands[4][bDat_mem02]);
    settings.setValue("Band4_Mem03",bands[4][bDat_mem03]);
    settings.setValue("Band4_Cfreq",bands[4][bDat_cFreq]);
    settings.setValue("Band4_Fqmin",bands[4][bDat_fqmin]);
    settings.setValue("Band4_Fqmax",bands[4][bDat_fqmax]);
    settings.setValue("Band4_Modee",bands[4][bDat_modee]);
    settings.setValue("Band4_FiltH",bands[4][bDat_filtH]);
    settings.setValue("Band4_FiltL",bands[4][bDat_filtL]);
    settings.setValue("Band4_Index",bands[4][bDat_index]);

    settings.setValue("Band5_Mem00",bands[5][bDat_mem00]);
    settings.setValue("Band5_Mem01",bands[5][bDat_mem01]);
    settings.setValue("Band5_Mem02",bands[5][bDat_mem02]);
    settings.setValue("Band5_Mem03",bands[5][bDat_mem03]);
    settings.setValue("Band5_Cfreq",bands[5][bDat_cFreq]);
    settings.setValue("Band5_Fqmin",bands[5][bDat_fqmin]);
    settings.setValue("Band5_Fqmax",bands[5][bDat_fqmax]);
    settings.setValue("Band5_Modee",bands[5][bDat_modee]);
    settings.setValue("Band5_FiltH",bands[5][bDat_filtH]);
    settings.setValue("Band5_FiltL",bands[5][bDat_filtL]);
    settings.setValue("Band5_Index",bands[5][bDat_index]);

    settings.setValue("Band6_Mem00",bands[6][bDat_mem00]);
    settings.setValue("Band6_Mem01",bands[6][bDat_mem01]);
    settings.setValue("Band6_Mem02",bands[6][bDat_mem02]);
    settings.setValue("Band6_Mem03",bands[6][bDat_mem03]);
    settings.setValue("Band6_Cfreq",bands[6][bDat_cFreq]);
    settings.setValue("Band6_Fqmin",bands[6][bDat_fqmin]);
    settings.setValue("Band6_Fqmax",bands[6][bDat_fqmax]);
    settings.setValue("Band6_Modee",bands[6][bDat_modee]);
    settings.setValue("Band6_FiltH",bands[6][bDat_filtH]);
    settings.setValue("Band6_FiltL",bands[6][bDat_filtL]);
    settings.setValue("Band6_Index",bands[6][bDat_index]);

    settings.setValue("Band7_Mem00",bands[7][bDat_mem00]);
    settings.setValue("Band7_Mem01",bands[7][bDat_mem01]);
    settings.setValue("Band7_Mem02",bands[7][bDat_mem02]);
    settings.setValue("Band7_Mem03",bands[7][bDat_mem03]);
    settings.setValue("Band7_Cfreq",bands[7][bDat_cFreq]);
    settings.setValue("Band7_Fqmin",bands[7][bDat_fqmin]);
    settings.setValue("Band7_Fqmax",bands[7][bDat_fqmax]);
    settings.setValue("Band7_Modee",bands[7][bDat_modee]);
    settings.setValue("Band7_FiltH",bands[7][bDat_filtH]);
    settings.setValue("Band7_FiltL",bands[7][bDat_filtL]);
    settings.setValue("Band7_Index",bands[7][bDat_index]);

    settings.setValue("Band8_Mem00",bands[8][bDat_mem00]);
    settings.setValue("Band8_Mem01",bands[8][bDat_mem01]);
    settings.setValue("Band8_Mem02",bands[8][bDat_mem02]);
    settings.setValue("Band8_Mem03",bands[8][bDat_mem03]);
    settings.setValue("Band8_Cfreq",bands[8][bDat_cFreq]);
    settings.setValue("Band8_Fqmin",bands[8][bDat_fqmin]);
    settings.setValue("Band8_Fqmax",bands[8][bDat_fqmax]);
    settings.setValue("Band8_Modee",bands[8][bDat_modee]);
    settings.setValue("Band8_FiltH",bands[8][bDat_filtH]);
    settings.setValue("Band8_FiltL",bands[8][bDat_filtL]);
    settings.setValue("Band8_Index",bands[8][bDat_index]);

    settings.setValue("Band9_Mem00",bands[9][bDat_mem00]);
    settings.setValue("Band9_Mem01",bands[9][bDat_mem01]);
    settings.setValue("Band9_Mem02",bands[9][bDat_mem02]);
    settings.setValue("Band9_Mem03",bands[9][bDat_mem03]);
    settings.setValue("Band9_Cfreq",bands[9][bDat_cFreq]);
    settings.setValue("Band9_Fqmin",bands[9][bDat_fqmin]);
    settings.setValue("Band9_Fqmax",bands[9][bDat_fqmax]);
    settings.setValue("Band9_Modee",bands[9][bDat_modee]);
    settings.setValue("Band9_FiltH",bands[9][bDat_filtH]);
    settings.setValue("Band9_FiltL",bands[9][bDat_filtL]);
    settings.setValue("Band9_Index",bands[9][bDat_index]);

    settings.setValue("Band10_Mem00",bands[10][bDat_mem00]);
    settings.setValue("Band10_Mem01",bands[10][bDat_mem01]);
    settings.setValue("Band10_Mem02",bands[10][bDat_mem02]);
    settings.setValue("Band10_Mem03",bands[10][bDat_mem03]);
    settings.setValue("Band10_Cfreq",bands[10][bDat_cFreq]);
    settings.setValue("Band10_Fqmin",bands[10][bDat_fqmin]);
    settings.setValue("Band10_Fqmax",bands[10][bDat_fqmax]);
    settings.setValue("Band10_Modee",bands[10][bDat_modee]);
    settings.setValue("Band10_FiltH",bands[10][bDat_filtH]);
    settings.setValue("Band10_FiltL",bands[10][bDat_filtL]);
    settings.setValue("Band10_Index",bands[10][bDat_index]);

    settings.setValue("Band11_Mem00",bands[11][bDat_mem00]);
    settings.setValue("Band11_Mem01",bands[11][bDat_mem01]);
    settings.setValue("Band11_Mem02",bands[11][bDat_mem02]);
    settings.setValue("Band11_Mem03",bands[11][bDat_mem03]);
    settings.setValue("Band11_Cfreq",bands[11][bDat_cFreq]);
    settings.setValue("Band11_Fqmin",bands[11][bDat_fqmin]);
    settings.setValue("Band11_Fqmax",bands[11][bDat_fqmax]);
    settings.setValue("Band11_Modee",bands[11][bDat_modee]);
    settings.setValue("Band11_FiltH",bands[11][bDat_filtH]);
    settings.setValue("Band11_FiltL",bands[11][bDat_filtL]);
    settings.setValue("Band11_Index",bands[11][bDat_index]);
}
Ejemplo n.º 21
0
Archivo: vfo.cpp Proyecto: radi8/vfo
void vfo::on_pBtnBtoA_clicked()
{
    writeA(readB());
}
Ejemplo n.º 22
0
void vfo::writeSettings(QSettings* settings)
{
    settings->beginGroup("vfo");
    settings->setValue("vfoB_f", readB());
    settings->endGroup();
}
Ejemplo n.º 23
0
	uint16_t readU(){
		return readB();
	}
Ejemplo n.º 24
0
	int16_t readI(){
		return readB();
	}
Ejemplo n.º 25
0
Archivo: vfo.cpp Proyecto: radi8/vfo
void vfo::togglePTT(bool pttRq)
{
    int freq;
    bool vfoUsed; // true = vfoA, false = vfoB.

    if (selectedVFO == 'A') {
        freq = readA();
        vfoUsed = true;
    } else if (selectedVFO == 'B') {
        freq = readB();
        vfoUsed = false;
    } else if (pttRq == true) { // Must be split and
        freq = readB();         //we will Tx on vfoB
        vfoUsed = false;
    } else {                // We are receiving so we
        freq = readA();     // will Rx on vfoA.
        vfoUsed = true;
    }  // We have decided on vfo to use and got basic freq. Lets now see if we
       // are doing a valid changeover and if it is Rx to Tx or Tx to Rx.
    if (pttRq == true && ptt == false) { // Going from Rx to Tx
        ptt = true;
        if (ui->pBtnRIT->isChecked()) {
            if (selectedVFO == 'A' || selectedVFO == 'B'){
                freq = freq + ui->hSlider->value() * -1;
                ui->pBtnRIT->setEnabled(false);
                ui->hSlider->setEnabled(false);
            } // We don't modify the vfo frequencies if on split
        }     // and of course no modification if RIT not checked.
        if (vfoUsed == true) { // Using vfoA for transmit frequency
            writeA(freq);
            ui->pBtnvfoA->setStyleSheet("background-color: rgb(255, 0, 0)"); //Red
        } else {
            writeB(freq);
            //TODO set vfoA background to light green and disable display vfoEnabled(false, true)
            vfoEnabled(false, true);
            ui->pBtnvfoA->setStyleSheet("background-color: normal"); //Red
            ui->pBtnvfoB->setStyleSheet("background-color: rgb(255, 0, 0)"); //Red
        }
    } else if (pttRq == false && ptt == true) { //Going from Tx to Rx
        ptt = false;
        if (ui->pBtnRIT->isChecked()) {
            if (selectedVFO == 'A' || selectedVFO == 'B'){
                freq = freq + ui->hSlider->value();
                ui->pBtnRIT->setEnabled(true);
                ui->hSlider->setEnabled(true);
            } // We don't modify the vfo frequencies if on split
        }     // and again no modification if RIT not checked.
        if (selectedVFO == 'A') { // Using vfoA for receive frequency
            writeA(freq);
            ui->pBtnvfoA->setStyleSheet("background-color: rgb(85, 255, 0)"); //Green
        } else  if (selectedVFO == 'B'){
            writeB(freq);
            ui->pBtnvfoB->setStyleSheet("background-color: rgb(85, 255, 0)"); //Green
        } else {
            writeA(freq);
            ui->pBtnvfoB->setStyleSheet("background-color: rgb(255, 155, 155)"); //Light Red
            ui->pBtnvfoA->setStyleSheet("background-color: rgb(85, 255, 0)"); //Green
            vfoEnabled(true, false);
        }
    }
}
Ejemplo n.º 26
0
	int32_t readL(){
		return readB();
	}
Ejemplo n.º 27
0
	float readF(){
		return readB();
	}
Ejemplo n.º 28
0
	double readD(){
		return readB();
	}
Ejemplo n.º 29
0
	uint32_t readT(){
		return readB();
	}
Ejemplo n.º 30
0
void analysis::module_iat_analysis(pmodule mod)
{
	DWORD iat = 0;
	DWORD currentEntry = 0;
	DWORD originalsFt = 0;
	DWORD simplesFt = 0;
	DWORD nameImg = 0;
	DWORD funcAddr = 0;
	DWORD modNameAddr=0;
	DWORD modNameOffset=0;
	int i=0;
	unsigned int j = 0;
	unsigned int k = 0;
	char* funcName = NULL;
	char* name = NULL;
	pmodule dest = NULL;
	int nbOfEntries = 0;

	if(mod->iatAddr == mod->baseAddr ) 
		return;

	nbOfEntries = mod->iatSize/ sizeof(IMAGE_IMPORT_DESCRIPTOR) -1;
	
	if( nbOfEntries <= 0)
		return;

	//adresse de l'IAT
	iat = mod->iatAddr;

	modNameOffset = 1;
	while(modNameOffset != 0)
	{
		//IAT = IMAGE_IMPORT_DESCRIPTOR[nbOfEntries]
		//donc current = iat[i]
		currentEntry=iat + (i*sizeof(IMAGE_IMPORT_DESCRIPTOR));

		//IMAGE_IMPORT_DESCRIPTOR.Name (+12)
		modNameOffset=readDw(currentEntry + 12);
		
		if(modNameOffset != 0)
		{

			if(modNameOffset!=0)
			{
				modNameAddr=mod->baseAddr+modNameOffset;

				name=new char[MAX_PATH];
				memset(name, 0x00, MAX_PATH);
				j=0;
				//lecture du nom du module
				while(j!=MAX_PATH && readB(modNameAddr+j)!=0x00)
				{
					name[j]=readB(modNameAddr+j);
					j++;
				}
				dest=gmh(name);

				if(dest!=NULL)
				{
					//IMAGE_IMPORT_DESCRIPTOR.OriginalFirstThunk
					originalsFt=readDw(currentEntry)+mod->baseAddr;
					//IMAGE_IMPORT_DESCRIPTOR.FirstThunk
					simplesFt=readDw(currentEntry + 16)+mod->baseAddr;

					while(readDw(originalsFt)!=0)
					{
						nameImg = readDw(originalsFt)+mod->baseAddr;
						k=0;
						funcName=new char[MAX_PATH];
						memset(funcName, 0x00, MAX_PATH);
						while(k!=MAX_PATH && readB(2+nameImg+k)!=0)
						{
							funcName[k]=readB(nameImg+2+k);
							k++;
						}
						funcAddr=readDw(simplesFt);

						if(!isForwardedFunction(funcName, dest))
						{
							if(funcAddr < dest->codeAddr || funcAddr > dest->endOfCodeAddr)
								fprintf(currentFile, "111|%d|%s||%s.%s|%s.0x%x\n", currentPid, mod->moduleFileName, name, funcName, whosthisaddr(funcAddr), funcAddr);
						}

						//Next !
						originalsFt+=4;
						simplesFt+=4;
						delete[] funcName;
						funcName=NULL;
					}
				}
				else
				{
					fprintf(currentFile, "112|%d|%s||%s|\n\n", currentPid, mod->moduleFileName, name);
				}

				delete[] name;
				name=NULL;
			}
		}
		i++;
	}
}