Example #1
0
File: RF.c Project: AubrCool/ble-1
void fsk_offset(char set)
{
    long buf32;
    short in,bu16, out;

   in = BT_MDM_CON6 & 0XFFFF;
   /*printf("\n %d.%d", in, (short)(BT_MDM_CON7 & 0XFFFF));*/
   in = in << fsk_offset_op;
   if(set)
   {
      buf32 = (long) (in<<fsk_offset_c1) + (long) (fsk_offset_dly<<fsk_offset_1) - (long) (fsk_offset_dly<<(fsk_offset_c1+1));
      bu16 = buf32 >> fsk_offset_1;
      out = (bu16 + fsk_offset_dly)>>fsk_offset_op;
      fsk_offset_dly = bu16;

      if(offset_cnt > 50)
      {
          /*printf("*%d.", out );*/
          SFR(BT_MDM_CON6, 16, 12, out);
          //SFR(BT_MDM_CON7, 16, 12, out);
          SFR(BT_MDM_CON0, 30, 1, 1);        // fsk carrier frequency deviation switch
         // SFR(BT_MDM_CON0, 31, 1, 1);        // psk carrier frequency deviation switch
      }
      else
      {
          SFR(BT_MDM_CON0, 30, 1, 0);        // fsk carrier frequency deviation switch
        //  SFR(BT_MDM_CON0, 31, 1, 0);        // psk carrier frequency deviation switch
          offset_cnt++;
      }
   }
   else
   {
Example #2
0
static void dAstroOmega (LALStatus *s, REAL8 *domegaz, REAL8 z, void *p)
 {
  AstroOmegaParams params;
  AstroOmegaSourceParams sourcep;
  /*AstroOmegaCosmoParams cosmop;*/
  REAL8LALSDensity *SDensitySource;
  REAL8 Rc, dEgw, nu, nuz;

  INITSTATUS(s);
  ATTATCHSTATUSPTR (s);
  params = *((AstroOmegaParams *)p);
  sourcep = params.sourceparams;
  SDensitySource = sourcep.SDensitySource;
  nu = *((REAL8 *)params.extraparams);

  /*frequency in the source frame*/
  nuz = (1. + z) * nu;
  /*single spectral energy density in the source frame*/
  SDensitySource(&dEgw, nuz);
  /*cosmic formation rate*/
  SFR(&Rc, z);
  *domegaz = dEgw * Rc / pow((1.+z),3.5);
  CHECKSTATUSPTR (s);
  DETATCHSTATUSPTR (s);
  RETURN (s);
 }
Example #3
0
void ble_fsk_offset(void *fp, char set)
{
    long buf32;
    short in,bu16, out;
    struct ble_param *packet;
    packet = (struct ble_param *)fp;


   in = BT_MDM_CON6 & 0XFFFF;
  // printf("\n%d", in);
   in = in << fsk_offset_op;
   if(set)
   {
      buf32 = (long) (in<<fsk_offset_c1) + (long) (fsk_offset_dly<<fsk_offset_1) - (long) (fsk_offset_dly<<(fsk_offset_c1+1));
      bu16 = buf32 >> fsk_offset_1;
      out = (bu16 + fsk_offset_dly)>>fsk_offset_op;
      fsk_offset_dly = bu16;

      if(offset_cnt > 50)
      {
         // printf("\n%d.", out );
         // SFR(BT_MDM_CON6, 16, 12, out);
         // SFR(BT_MDM_CON7, 16, 12, out);
          packet->MDM_SET = (0xffff & out) <<16 | (0xffff & out);          //FSK
          SFR(BT_MDM_CON1, 14, 2, 3);        // fsk carrier frequency deviation switch
          SFR(BT_MDM_CON0, 30, 2, 3);        // psk carrier frequency deviation switch
      }
      else
      {
          packet->MDM_SET = 0;
          SFR(BT_MDM_CON1, 14, 2, 0);        // fsk carrier frequency deviation switch
          SFR(BT_MDM_CON0, 30, 2, 0);        // psk carrier frequency deviation switch
          offset_cnt++;
      }
   }
   else
   {
Map2FileMapping::Map2FileMapping()
{
	// Agronomy hedge
	AHConfig.name = AH;
	AHConfig.rangeStart = 2;
	AHConfig.rangeEnd = 54;
	AHConfig.rowStart = 3;
	AHConfig.rowEnd = 52;
	AHConfig.id = 1;

	// rep 1 SHORT_PLANT 
	SubFieldRect SFR(2, 8, 3, 52);
	AHConfig.addTypeSubFieldRect(REP_1, SHORT_PLANT, SFR);
	//rep 1 TALL_PLANT
	SFR.setParam(9, 15, 3, 52);
	AHConfig.addTypeSubFieldRect(REP_1, TALL_PLANT, SFR);
	//rep 1 PS_PLANT 
	SFR.setParam(16, 27, 3, 52);
	AHConfig.addTypeSubFieldRect(REP_1, PS_PLANT, SFR);
	// rep2 SHORT_PLANT 
	SFR.setParam(48, 54, 3, 52);
	AHConfig.addTypeSubFieldRect(REP_2, SHORT_PLANT, SFR);
	// rep2 TALL_PLANT 
	SFR.setParam(29, 35, 3, 52);
	AHConfig.addTypeSubFieldRect(REP_2, TALL_PLANT, SFR);
	// rep 2 PS_PLANT 
	SFR.setParam(36, 47, 3, 52);
	AHConfig.addTypeSubFieldRect(REP_2, PS_PLANT, SFR);

	fieldConfigVec.push_back(AHConfig);

	// Curtiss hedge part 1
	CHConfigPt1.name = CH1;
	CHConfigPt1.rangeStart = 2;
	CHConfigPt1.rangeEnd = 39;
	CHConfigPt1.rowStart = 3;
	CHConfigPt1.rowEnd = 48;
	CHConfigPt1.id = 3;

	// rep 1 SHORT_PLANT 
	SFR.setParam(2, 9, 3, 48);
	CHConfigPt1.addTypeSubFieldRect(REP_1, SHORT_PLANT, SFR);
	//rep 1 TALL_PLANT 
	SFR.setParam(9, 16, 3, 48);
	CHConfigPt1.addTypeSubFieldRect(REP_1, TALL_PLANT, SFR);
	//rep 1 PS_PLANT 
	SFR.setParam(16, 28, 3, 48);
	CHConfigPt1.addTypeSubFieldRect(REP_1, PS_PLANT, SFR);
	// rep2 SHORT_PLANT 
	SFR.setParam(28, 35, 3, 48);
	CHConfigPt1.addTypeSubFieldRect(REP_2, SHORT_PLANT, SFR);
	// rep2 TALL_PLANT 
	SFR.setParam(35, 39, 3, 48);
	CHConfigPt1.addTypeSubFieldRect(REP_2, TALL_PLANT, SFR);

	fieldConfigVec.push_back(CHConfigPt1);

	// Curtiss hedge part 2
	CHConfigPt2.name = CH2;
	CHConfigPt2.rangeStart = 2;
	CHConfigPt2.rangeEnd = 18;
	CHConfigPt2.rowStart = 53;
	CHConfigPt2.rowEnd = 92;
	CHConfigPt2.id = 3;

	// rep2 TALL_PLANT 
	SFR.setParam(2, 4, 53, 92);
	CHConfigPt2.addTypeSubFieldRect(REP_2, TALL_PLANT, SFR);
	// rep2 PS_PLANT 
	SFR.setParam(4, 18, 53, 92);
	CHConfigPt2.addTypeSubFieldRect(REP_2, PS_PLANT, SFR);

	fieldConfigVec.push_back(CHConfigPt2);

	// Agronomy single 
	ASConfig.name = AS;
	ASConfig.rangeStart = 1;
	ASConfig.rangeEnd = 69;
	ASConfig.rowStart = 1;
	ASConfig.rowEnd = 18;
	ASConfig.id = 2;

	fieldConfigVec.push_back(ASConfig);

	// Curtiss single
	CSConfig.name = CSP;
	CSConfig.rangeStart = 1;
	CSConfig.rangeEnd = 94;
	CSConfig.rowStart = 1;
	CSConfig.rowEnd = 13;
	CSConfig.id = 4;
	// rep1 SHORT_PLANT 1 
	SFR.setParam(1, 12, 1, 13);
	CSConfig.addTypeSubFieldRect(REP_1, SHORT_PLANT, SFR);
	// rep1 TALL_PLANT
	SFR.setParam(14, 25, 1, 13);
	CSConfig.addTypeSubFieldRect(REP_1, TALL_PLANT, SFR);
	// rep1 PS_PLANT
	SFR.setParam(27, 46, 1, 13);
	CSConfig.addTypeSubFieldRect(REP_1, PS_PLANT, SFR);
	// rep2 SHORT_PLANT 1 
	SFR.setParam(48, 59, 1, 13);
	CSConfig.addTypeSubFieldRect(REP_2, SHORT_PLANT, SFR);
	// rep2 TALL_PLANT
	SFR.setParam(61, 72, 1, 13);
	CSConfig.addTypeSubFieldRect(REP_2, TALL_PLANT, SFR);
	// rep2 PS_PLANT
	SFR.setParam(73, 94, 1, 13);
	CSConfig.addTypeSubFieldRect(REP_2, PS_PLANT, SFR);

	fieldConfigVec.push_back(CSConfig);

};
Example #5
0
void bt_pll_scan(void)
{
	unsigned char udat8, dato, dath, datl, dat_buf, i;

	SFR(BTA_CON12,  9,  1,  1);   //PLL_VCD_EN
	SFR(BTA_CON12, 10,  1,  0);   //PLL_VCD_OE

	dath  = 74;

	for(i = 0; i < 5; i++)
	{
		udat8 = dath+20;
		datl  = dath;
		SFR(BTA_CON10, 2, 5, (0x1f>>i)); //PLL_CAPS   //<2420:F  >2420:7
		while(1)
		{
			SFR(BTA_CON11, 0, 8, udat8); //PLL_FS
			delay(sys_clk*200);
			dato  = 0;
			dato |= (BTA_CON15 >> 10) & 0x03;
			dato |= (BTA_CON15 >> 10) & 0x03;
			dato |= (BTA_CON15 >> 10) & 0x03;
			if(dato == 1) //PLL_VCH_DO = 1;
			{
				dath = 74;
				datl = 74;
				printf("a");
				break;
			}
			else if(dato == 0) //
			{
				while(dato !=1)
				{
					udat8++;
					if(udat8 > 163) break;
					SFR(BTA_CON11,  0,  8,  udat8); //PLL_FS
					delay(sys_clk*200);
					dato  = 0;
					dato |= (BTA_CON15 >> 10) & 0x03;
					dato |= (BTA_CON15 >> 10) & 0x03;
					dato |= (BTA_CON15 >> 10) & 0x03;
					printf("b");
				}
				dat_buf = udat8;

				while(dato !=2)
				{
					udat8--;
					if(udat8 < 74) break;
					SFR(BTA_CON11,  0,  8,  udat8); //PLL_FS
					delay(sys_clk*200);
					dato  = 0;
					dato |= (BTA_CON15 >> 10) & 0x03;
					dato |= (BTA_CON15 >> 10) & 0x03;
					dato |= (BTA_CON15 >> 10) & 0x03;
					printf("c");
				}
				datl = udat8;
				if(i == 1)
				{
					bt_pll_cap0 = (datl + dath)/2 + 2;
				}
				else if(i == 2)
				{
					bt_pll_cap1 = (datl + dath)/2 + 2;
				}
				else if(i == 3)
				{
					bt_pll_cap2 = (datl + dath)/2 + 2;
				}
				else
				{
					bt_pll_cap3 = (datl + dath)/2 + 2;
				}
				dath = dat_buf;
				break;
			}
			else
			{
				printf("d");
				if(udat8 > 245)
				{
					puts("\n\n\n...2 bt_pll_scan error...\n\n\n");
					break;
				}
				else udat8 = udat8 + 10;
			}
		}
		printf("\nl:%d h:%d",datl,dath);
	}