Exemplo n.º 1
0
void sendDataToADG1414(WORD msb)
{
    WORD dummy = 0;
    //BYTE data0 = 0x00;
    //BYTE data1 = 0x00;

    SpiChnEnable(SPI_CHANNEL2, 0);
    SpiChnConfigure(SPI_CHANNEL2, SPI_CONFIG_MSTEN | SPI_CONFIG_MODE16 | SPI_CONFIG_CKP_HIGH);
    SpiChnSetBitRate(SPI_CHANNEL2, 80000000, 4000000);
    SpiChnEnable(SPI_CHANNEL2, 1);

    //data0 = (BYTE)(msb & 0x00FF);
    //data1 = (BYTE)((msb & 0xFF00) >> 8);

    outputPort("c14", LOW);

    //putcSPI2(data0);
    //putcSPI2(data1);
    putcSPI2(msb);

    outputPort("c14", HIGH);

    SpiChnEnable(SPI_CHANNEL2, 0);
    SpiChnConfigure(SPI_CHANNEL2, SPI_CONFIG_MSTEN | SPI_CONFIG_MODE16);
    SpiChnSetBitRate(SPI_CHANNEL2, 80000000, 1000000);
    SpiChnEnable(SPI_CHANNEL2, 1);
}
Exemplo n.º 2
0
void sendDataToAD7490(WORD msb)
{
    outputPort("c13", LOW);

    putcSPI2(msb);

    if(SPI2STATbits.SPIROV)
        SPI2STATbits.SPIROV = 0;

    outputPort("c13", HIGH);
}
Exemplo n.º 3
0
WORD receiveDataFromAD7490(WORD msb)
{
    WORD rdata = 0;

    outputPort("c13", LOW);
    putcSPI2(msb);
    rdata = getcSPI2();
    outputPort("c13", HIGH);

    return rdata;
}
Exemplo n.º 4
0
void NodeInspector::makeLink(const Datum* source, InputPort* target)
{
    if (rows.contains(source))
        scene()->addItem(new Connection(outputPort(source), target));
    else
        link_cache[source] = target;
}
Exemplo n.º 5
0
void NodeInspector::trigger(const NodeState& state)
{
    QList<const Datum*> not_present = rows.keys();

    title_row->setNameValid(state.name_valid);

    for (Datum* d : state.datums)
    {
        if (d->getName().find("__") != 0 && !rows.contains(d))
        {
            rows[d] = new InspectorRow(d, this);
            connect(rows[d], &InspectorRow::layoutChanged,
                    this, &NodeInspector::onLayoutChanged);

            // If we had pending links, construct them now
            if (link_cache.contains(d))
            {
                scene()->addItem(new Connection(outputPort(d), link_cache[d]));
                link_cache.remove(d);
            }
        }
        not_present.removeAll(d);
    }

    for (auto d : not_present)
    {
        delete rows[d];
        rows.remove(d);
    }

    title_row->getButton<InspectorScriptButton>()->setScriptValid(
            state.error_lineno == -1);
    onLayoutChanged();
}
Exemplo n.º 6
0
void pullup_off(unsigned char pin)
{
	volatile unsigned char *out;
	
	unsigned char bit = maskPin(pin);
	unsigned char port = portPin(pin);
	

	out = outputPort(port);

	*out &= ~bit;
}
Exemplo n.º 7
0
void high_pin(unsigned char pin)
{

	volatile unsigned char *out;

	unsigned char bit = maskPin(pin);
	unsigned char port = portPin(pin);
	
	out = outputPort(port);
	
	*out |= bit;
}
Exemplo n.º 8
0
void sendDataToAD5328(BYTE id, WORD msb)
{
    //WORD dummy = 0;
    SpiChnEnable(SPI_CHANNEL2, 0);
    //SpiChnConfigure(SPI_CHANNEL2, SPI_CONFIG_MSTEN | SPI_CONFIG_MODE16 | SPI_CONFIG_CKP_HIGH);
    SpiChnSetBitRate(SPI_CHANNEL2, 80000000, 4000000);
    SpiChnEnable(SPI_CHANNEL2, 1);

    switch(id)
    {
        case 0:
            outputPort("d0", LOW);
            break;
        case 1:
            outputPort("d2", LOW);
            break;
        case 2:
            outputPort("d3", LOW);
            break;
    }

    putcSPI2(msb);
    //dummy = getcSPI2();
    //Delay10us(1);

    switch(id)
    {
        case 0:
            outputPort("d0", HIGH);
            break;
        case 1:
            outputPort("d2", HIGH);
            break;
        case 2:
            outputPort("d3", HIGH);
            break;
    }

    SpiChnEnable(SPI_CHANNEL2, 0);
    SpiChnSetBitRate(SPI_CHANNEL2, 80000000, 1000000);
    SpiChnEnable(SPI_CHANNEL2, 1);
}