示例#1
0
文件: cc1101.cpp 项目: Kreyl/nute
void CC_t::IRQHandler() {
    //klPrintf("IRQ\r");
    if (ReadRX()) {
        //FlushRxFIFO();
        NewPktRcvd = true;
    } // if size>0
}
示例#2
0
文件: cc1101.cpp 项目: Kreyl/nute
void CC_t::IRQHandler() {
    if (Aim == caTx) {
        Aim = caIdle;
        TxEndHandler();
    }
    else { // Was receiving
        if (ReadRX((uint8_t*)&PktRx)) NewPktHandler();
        FlushRxFIFO();
        // Do not reenter RX here to allow safely enter TX right after RX
    }
}
示例#3
0
文件: main.cpp 项目: Kreyl/nute
void CC_t::IRQHandler() {
    if (SearchState == IsWaiting) {
        // Will be here if packet received successfully or in case of wrong address
        if (ReadRX()) { // Proceed if read was successful
            // Check address
            if(RX_Pkt.To == ID) {   // This packet is ours
                //klPrintf("From: %u; RSSI: %u\r", RX_Pkt.From, RX_Pkt.RSSI);
                SearchState = IsReplying;
                PktCounter=0;
            }
        } // if read
        FlushRxFIFO();
    }
    else {  // Packet transmitted
        if(++PktCounter == PKTS_TO_REPLY) SearchState = IsWaiting;
    }
}
示例#4
0
void* serialRX(void* params){
	ServoStates state;
	char buf[1024];
	float dt = 1.6f;
	int started = 0;

	while(1){
		int i = -1;
		if(ReadRX(&state)){
			for(i = 0; i < 8; i++){
				fbUpdate(Servos + i, transformSample(state.Angle[i]));
				//printf("%d ", state.Angle[i]);
			}
			//printf("\n");
		}
	}	
}
示例#5
0
文件: main.cpp 项目: Kreyl/nute
void CC_t::IRQHandler() {
    if (SearchState == IsCalling) { // Packet transmitted, enter RX
        if(++PktCounter == TRY_COUNT) {     // Several packets sent
            PktCounter = 0;
            // Increase packet address
            TX_Pkt.To++;
            if (TX_Pkt.To > MAX_ADDRESS) TX_Pkt.To = MIN_ADDRESS;
            // Switch to waiting state
            SearchState = IsWaiting;
            Delay.Reset(&Timer);
        }
    }
    else { // Will be here if packet received successfully or in case of wrong address
        if (ReadRX()) {
            //Uart.Printf("%u\r", RX_Pkt.To);
            // Check address
            if(RX_Pkt.To == CC_ADDRESS) {   // This packet is ours
                //klPrintf("From: %u; RSSI: %u\r", RX_Pkt.From, RX_Pkt.RSSI);
                Signal.Remember(RX_Pkt.From, RX_Pkt.RSSI);
            }
            FlushRxFIFO();
        } // if size>0
    } // if is waiting
}
示例#6
0
文件: cc1101.cpp 项目: Kreyl/nute
void CC_t::IRQHandler() {
    if (ReadRX()) {
        // Do what needed
        FlushRxFIFO();
    } // if size>0
}