Beispiel #1
0
uint16_t rfxx_wrt_cmd(uint16_t aCmd) {
	uint8_t  i;
	uint16_t temp = 0;

	LOW_SCK();
	LOW_SEL();

	//for (i=0; i<16; i++) {
	for (i = 0; i < sizeof(uint16_t); ++i) {

		temp <<= 1;
		if (SDO_HI()) temp |= 0x0001;

		LOW_SCK();
		(aCmd & 0x8000) ? (HI_SDI()) : (LOW_SDI());
		/*
		if (aCmd & 0x8000)
			HI_SDI();
		else
			LOW_SDI();
		*/
		HI_SCK();

		aCmd <<= 1;
	}

	LOW_SCK();
	HI_SEL();

	return temp;
}
Beispiel #2
0
unsigned int RFXX_WRT_CMD(unsigned int aCmd){
  unsigned char i;
  unsigned int temp;
  temp=0;
  LOW_SCK();
  LOW_SEL();
  for(i=0;i<16;i++){
    if(aCmd&0x8000){
      HI_SDI();
      }else{
      LOW_SDI();
    }
    HI_SCK();
    temp<<=1;
    if(SDO_HI()){
      temp|=0x0001;
    }
    LOW_SCK();
    aCmd<<=1;
  };
  HI_SEL();
  return(temp);
}