obj fn_on_tick (obj args) { obj *argv = get_header (args) -> u.array_val; timeout = get_int_val (argv [1]); tick_action = argv [2]; return (tick_action); }
obj fn_pin (obj args) { obj *argv = get_header (args) -> u.array_val; uint32_t pin = get_int_val (argv [1]); uint8_t val = (argv [2] == obj_NIL) ? LOW : HIGH; digitalWrite (pin, val); return (argv [2]); }
int read_roi_infile(char *infile) { FILE *fp = fopen(infile,"r"); if (fp==NULL) {printf("ERROR: can't open %s ROI input file\n",infile); return(1); } char ctmp[256]; int itmp; double dtmp; int i; // DESCRIPTION VALUE // ---------------------------------------------------------- ----------------------------------------------- get_string_val(fp,datfilename); // First input data file <infile>.dat get_string_val(fp,ctmp); // Second input data file /dev/null get_string_val(fp,ctmp); // Output data file <infile>.slc get_string_val(fp,ctmp); // Output amplitudes file /dev/null get_string_val(fp,ctmp); // 8lk output file 8lk get_int_val(fp,&itmp); // debug flag 0 get_int_val(fp,&itmp); // How many input bytes per line files 1 and 2 13680 13680 get_int_val(fp,&itmp); // How many good bytes per line, including header 13680 13680 get_int_val(fp,&start_line); // First line to read (start at 0) 1 get_int_val(fp,&npatches); // Enter # of range input patches {Get nl from hdr values; patches = nl/11600} get_int_val(fp,&itmp); // First sample pair to use (start at zero) 0 get_int_val(fp,&itmp); // Azimuth Patch Size (Power of 2) 16384 get_int_val(fp,&patch_size); // Number of valid points in azimuth 11600 get_string_val(fp,ctmp); // Deskew the image n get_int_val(fp,&ncaltones); printf("Reading %i caltone values\n",ncaltones); for (i=0;i<ncaltones;i++) get_double_val(fp,&dtmp); // Caltone % of sample rate 0.25 0.25701904296875 get_2int_vals(fp,&itmp,&ns); // Start range bin, number of range bins to process 1 6840 get_int_val(fp,&itmp); // Delta azimuth, range pixels for second file 0 0 get_3double_vals(fp,&dop1,&dop2,&dop3); // Image 1 Doppler centroid quad coefs (Hz/prf) {calculated from dop_est - 3 parameters} get_double_val(fp,&dtmp); // Image 2 Doppler centroid quad coefs (Hz/prf) {copy above 3 values} get_int_val(fp,&itmp); // 1 = use file 1 doppler, 2 = file 2, 3 = avg 1 get_double_val(fp,&earth_rad); // Earth Radius (m) {calculated from get_peg_info} get_double_val(fp,&sc_vel); // Body Fixed S/C velocities 1,2 (m/s) {calculate from EBEF state vector - 2 parameters} get_double_val(fp,&sc_height); // Spacecraft height 1,2 (m) {calculated from get_peg_info - 2 parameters} get_double_val(fp,&dtmp); // Planet GM 0 get_double_val(fp,&dtmp); // Left, Right or Unknown Pointing Right get_double_val(fp,&dtmp); // SCH Velocity Vector 1 {calculated from get_peg_info - 3 parameters} get_double_val(fp,&dtmp); // SCH Velocity Vector 2 {copy above 3 values} get_double_val(fp,&dtmp); // SCH Acceleration Vector 1 {calculated from get_pef_info - 3 parameters} get_double_val(fp,&dtmp); // SCH Acceleration Vector 2 {copy above 3 values} get_double_val(fp,&srf); // Range of first sample in raw data file 1,2 (m) {calculate from the hdr infomation - 2 values} get_double_val(fp,&prf); // PRF 1,2 (pps) {calculate from the hdr information - 2 values} get_double_val(fp,&dtmp); // i/q means, i1,q1, i2,q2 15.5 15.5 15.5 15.5 get_string_val(fp,ctmp); // Flip i/q (y/n) s get_double_val(fp,&dtmp); // Desired azimuth resolution (m) 5 (what should this be???) get_double_val(fp,&dtmp); // Number of azimuth looks 4 (what should this be???) get_double_val(fp,&fs); // Range sampling rate (Hz) 22765000 get_double_val(fp,&chirp_slope); // Chirp Slope (Hz/s) 5.62130178e11 get_double_val(fp,&pulse_duration); // Pulse Duration (s) 33.8e-6 get_int_val(fp,&itmp); // Chirp extension points 0 get_string_val(fp,ctmp); // Secondary range migration correction (y/n) n get_double_val(fp,&wavelength); // Radar Wavelength (m) 0.235 get_int_val(fp,&itmp); // Range Spectral Weighting (1.=none, 0.54=Hamming) 1.0 get_double_val(fp,&dtmp); // Fraction of range bandwidth to remove 0 0 get_double_val(fp,&dtmp); // linear resampling coefs: sloper, intr, slopea, inta 0 0 0 0 get_double_val(fp,&dtmp); // linear resampling deltas: dsloper, dintr, dslopea, dinta 0 0 0 0 get_string_val(fp,ctmp); // AGC file /dev/null get_string_val(fp,dwpfilename); // DWP file /dev/null or DWP file printf("start_line %i\n",start_line); printf("npatches %i\n",npatches); printf("patch_size %i\n",patch_size); printf("num samples %i\n",ns); return(0); }