Jon Freeman / Mbed 2 deprecated Altera_FPGA_test

Dependencies:   MODSERIAL mbed-rtos mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers cnc.h Source File

cnc.h

00001 /**
00002 Programme   COPIED FROM "cnc__machine_driver_3"
00003 Author      Jon Freeman
00004 
00005 Designed to compile and run on:
00006     Mbed LPC1768
00007     Freescale KL25Z
00008     Freescale KL46Z
00009 */
00010 using namespace std;
00011 
00012 typedef float  fl_typ;  //  
00013     
00014 //#define SPI_Enable
00015 #define I2C_Enable
00016 #define ESTOP   0x100   //  bits used in input reading KX3 limit and EStop switches
00017 #define XLIM    1
00018 #define YLIM    2
00019 #define ZLIM    4
00020 #define UNKN    8
00021 
00022 const   fl_typ  TWO_PI = 8.0 * atan(1.0);
00023 const   fl_typ  epsilon = 1e-5;
00024 struct  pirbufgrain {
00025     fl_typ  x,
00026             y,
00027             z,
00028             distance_code,
00029             f_rate;
00030     }   ;
00031 
00032 struct  singleGparam    {   //  Place to put all we know about 'x' or 'j' etc parameter from G Code line
00033     fl_typ          flt;
00034     unsigned long   ul;
00035     int         i,  c;
00036     bool            changed;      // Flagged true when new value for this axis found in Gcode line, false otherwise 
00037 }   ;
00038 
00039 struct  Gparams {  //  Where possibly messy G code line gets ordered and sorted into
00040     struct  singleGparam   x, y, z, i, j, r, a, b, c, d;   //  After sorting, know where to find any X, Y etc values !
00041 }   ;
00042 
00043 const int NumofGParams = sizeof(struct Gparams) / sizeof(struct singleGparam);
00044 
00045 #define clken       XDi
00046 #define d_in_isr    XSt
00047 #define d_in_osr    YDi
00048 #define ld_osr      YSt
00049 #define ld_pir      ZDi
00050 #define sclk        ZSt
00051 #define sclr        ADi
00052