├── out ├── pwm.o ├── tim.o ├── delay.o ├── eeprom.o ├── gcode.o ├── gpio.crf ├── gpio.o ├── limits.o ├── main.axf ├── main.crf ├── main.o ├── print.o ├── pwm.crf ├── report.o ├── serial.o ├── tim.crf ├── usart.o ├── core_cm3.o ├── delay.crf ├── eeprom.crf ├── gcode.crf ├── limits.crf ├── planner.o ├── print.crf ├── protocol.o ├── report.crf ├── serial.crf ├── settings.o ├── stepper.o ├── usart.crf ├── core_cm3.crf ├── eepromavr.crf ├── eepromavr.o ├── nuts_bolts.o ├── planner.crf ├── protocol.crf ├── settings.crf ├── startup_stm32f10x_hd.d ├── stepper.crf ├── nuts_bolts.crf ├── stm32f10x_it.o ├── coolant_control.o ├── main.build_log.htm ├── motion_control.crf ├── motion_control.o ├── spindle_control.o ├── stm32f10x_it.crf ├── system_stm32f10x.o ├── coolant_control.crf ├── spindle_control.crf ├── system_stm32f10x.crf ├── startup_stm32f10x_hd.o ├── core_cm3.d ├── main.sct ├── main.lnp ├── tim.d ├── gpio.d ├── delay.d ├── pwm.d ├── eepromavr.d ├── usart.d ├── eeprom.d ├── system_stm32f10x.d ├── stm32f10x_it.d ├── print.d ├── serial.d ├── nuts_bolts.d ├── report.d ├── gcode.d ├── planner.d ├── coolant_control.d ├── settings.d ├── stepper.d ├── limits.d ├── protocol.d ├── spindle_control.d ├── main.d └── motion_control.d ├── desktop.ini ├── user ├── delay.c ├── gpio.h ├── main.c ├── usart.c ├── usart.h ├── pwm │ ├── pwm.c │ ├── pwm.h │ ├── complementary_pwm.c │ └── complementary_pwm.h ├── tim │ ├── tim.c │ └── tim.h ├── cnc │ ├── serial.c │ ├── defaults.h │ ├── spindle_control.c │ ├── limits.h │ ├── spindle_control.h │ ├── print.h │ ├── eepromavr.h │ ├── coolant_control.h │ ├── serial.h │ ├── coolant_control.c │ ├── protocol.h │ ├── motion_control.h │ ├── report.h │ ├── settings.h │ ├── planner.h │ ├── print.c │ ├── gcode.h │ ├── stepper.h │ ├── nuts_bolts.h │ ├── nuts_bolts.c │ ├── eepromavr.c │ ├── README.md │ ├── pin_map.h │ └── settings.c ├── stm32f10x_it.c ├── stm32f10x_it.h ├── delay.h ├── gpio.c ├── stm32f10x_conf.h └── eeprom.h ├── keilkilll.bat ├── lib ├── STM32_lib_3.0.lib ├── stm32f10x_crc.h ├── stm32f10x_wwdg.h ├── stm32f10x_dbgmcu.h ├── stm32f10x_rtc.h ├── stm32f10x_iwdg.h ├── stm32f10x_pwr.h ├── misc.h ├── stm32f10x_exti.h ├── stm32f10x_bkp.h └── stm32f10x_dac.h ├── README.md ├── JLinkSettings.ini ├── JLink Regs CM3.txt ├── sys └── system_stm32f10x.h └── main.uvopt /out/pwm.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/out/pwm.o -------------------------------------------------------------------------------- /out/tim.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/out/tim.o -------------------------------------------------------------------------------- /desktop.ini: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/desktop.ini -------------------------------------------------------------------------------- /out/delay.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/out/delay.o -------------------------------------------------------------------------------- /out/eeprom.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/out/eeprom.o -------------------------------------------------------------------------------- /out/gcode.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/out/gcode.o -------------------------------------------------------------------------------- /out/gpio.crf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/out/gpio.crf -------------------------------------------------------------------------------- /out/gpio.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/out/gpio.o -------------------------------------------------------------------------------- /out/limits.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/out/limits.o -------------------------------------------------------------------------------- /out/main.axf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/out/main.axf -------------------------------------------------------------------------------- /out/main.crf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/out/main.crf -------------------------------------------------------------------------------- /out/main.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/out/main.o -------------------------------------------------------------------------------- /out/print.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/out/print.o -------------------------------------------------------------------------------- /out/pwm.crf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/out/pwm.crf -------------------------------------------------------------------------------- /out/report.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/out/report.o -------------------------------------------------------------------------------- /out/serial.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/out/serial.o -------------------------------------------------------------------------------- /out/tim.crf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/out/tim.crf -------------------------------------------------------------------------------- /out/usart.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/out/usart.o -------------------------------------------------------------------------------- /user/delay.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/user/delay.c -------------------------------------------------------------------------------- /user/gpio.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/user/gpio.h -------------------------------------------------------------------------------- /user/main.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/user/main.c -------------------------------------------------------------------------------- /user/usart.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/user/usart.c -------------------------------------------------------------------------------- /user/usart.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/user/usart.h -------------------------------------------------------------------------------- /keilkilll.bat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/keilkilll.bat -------------------------------------------------------------------------------- /out/core_cm3.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/out/core_cm3.o -------------------------------------------------------------------------------- /out/delay.crf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/out/delay.crf -------------------------------------------------------------------------------- /out/eeprom.crf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/out/eeprom.crf -------------------------------------------------------------------------------- /out/gcode.crf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/out/gcode.crf -------------------------------------------------------------------------------- /out/limits.crf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/out/limits.crf -------------------------------------------------------------------------------- /out/planner.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/out/planner.o -------------------------------------------------------------------------------- /out/print.crf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/out/print.crf -------------------------------------------------------------------------------- /out/protocol.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/out/protocol.o -------------------------------------------------------------------------------- /out/report.crf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/out/report.crf -------------------------------------------------------------------------------- /out/serial.crf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/out/serial.crf -------------------------------------------------------------------------------- /out/settings.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/out/settings.o -------------------------------------------------------------------------------- /out/stepper.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/out/stepper.o -------------------------------------------------------------------------------- /out/usart.crf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/out/usart.crf -------------------------------------------------------------------------------- /user/pwm/pwm.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/user/pwm/pwm.c -------------------------------------------------------------------------------- /user/pwm/pwm.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/user/pwm/pwm.h -------------------------------------------------------------------------------- /user/tim/tim.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/user/tim/tim.c -------------------------------------------------------------------------------- /out/core_cm3.crf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/out/core_cm3.crf -------------------------------------------------------------------------------- /out/eepromavr.crf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/out/eepromavr.crf -------------------------------------------------------------------------------- /out/eepromavr.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/out/eepromavr.o -------------------------------------------------------------------------------- /out/nuts_bolts.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/out/nuts_bolts.o -------------------------------------------------------------------------------- /out/planner.crf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/out/planner.crf -------------------------------------------------------------------------------- /out/protocol.crf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/out/protocol.crf -------------------------------------------------------------------------------- /out/settings.crf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/out/settings.crf -------------------------------------------------------------------------------- /out/startup_stm32f10x_hd.d: -------------------------------------------------------------------------------- 1 | .\out\startup_stm32f10x_hd.o: sys\startup_stm32f10x_hd.s 2 | -------------------------------------------------------------------------------- /out/stepper.crf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/out/stepper.crf -------------------------------------------------------------------------------- /user/cnc/serial.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/user/cnc/serial.c -------------------------------------------------------------------------------- /out/nuts_bolts.crf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/out/nuts_bolts.crf -------------------------------------------------------------------------------- /out/stm32f10x_it.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/out/stm32f10x_it.o -------------------------------------------------------------------------------- /user/cnc/defaults.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/user/cnc/defaults.h -------------------------------------------------------------------------------- /user/stm32f10x_it.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/user/stm32f10x_it.c -------------------------------------------------------------------------------- /lib/STM32_lib_3.0.lib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/lib/STM32_lib_3.0.lib -------------------------------------------------------------------------------- /out/coolant_control.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/out/coolant_control.o -------------------------------------------------------------------------------- /out/main.build_log.htm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/out/main.build_log.htm -------------------------------------------------------------------------------- /out/motion_control.crf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/out/motion_control.crf -------------------------------------------------------------------------------- /out/motion_control.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/out/motion_control.o -------------------------------------------------------------------------------- /out/spindle_control.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/out/spindle_control.o -------------------------------------------------------------------------------- /out/stm32f10x_it.crf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/out/stm32f10x_it.crf -------------------------------------------------------------------------------- /out/system_stm32f10x.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/out/system_stm32f10x.o -------------------------------------------------------------------------------- /out/coolant_control.crf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/out/coolant_control.crf -------------------------------------------------------------------------------- /out/spindle_control.crf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/out/spindle_control.crf -------------------------------------------------------------------------------- /out/system_stm32f10x.crf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/out/system_stm32f10x.crf -------------------------------------------------------------------------------- /out/startup_stm32f10x_hd.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/out/startup_stm32f10x_hd.o -------------------------------------------------------------------------------- /user/cnc/spindle_control.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/user/cnc/spindle_control.c -------------------------------------------------------------------------------- /user/pwm/complementary_pwm.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/user/pwm/complementary_pwm.c -------------------------------------------------------------------------------- /user/pwm/complementary_pwm.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Meekdai/STM32-GRBL/HEAD/user/pwm/complementary_pwm.h -------------------------------------------------------------------------------- /out/core_cm3.d: -------------------------------------------------------------------------------- 1 | .\out\core_cm3.o: sys\core_cm3.c 2 | .\out\core_cm3.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # STM32-GRBL 2 | STM32 CNC Controller (GRBL v0_8) 3 | 4 | 移植GRBL到STM32F103VCT6上面,激光雕刻速度提高许多。 5 | 6 | 目前先开源程序,用MDK5.1编译~ 7 | 8 | 9 | PCB请移步:http://www.cirmall.com/circuit/1978/STM32%20%E6%BF%80%E5%85%89%E9%9B%95%E5%88%BB%E6%9C%BA#/details 10 | -------------------------------------------------------------------------------- /user/stm32f10x_it.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __STM32F10x_IT_H 3 | #define __STM32F10x_IT_H 4 | 5 | 6 | #include "stm32f10x.h" 7 | 8 | void TIM2_IRQHandler(void); 9 | void TIM3_IRQHandler(void); 10 | void TIM4_IRQHandler(void); 11 | void TIM5_IRQHandler(void); 12 | void EXTI9_5_IRQHandler(void); 13 | void EXTI1_IRQHandler(void); 14 | #endif 15 | -------------------------------------------------------------------------------- /JLinkSettings.ini: -------------------------------------------------------------------------------- 1 | [FLASH] 2 | SkipProgOnCRCMatch = 1 3 | VerifyDownload = 1 4 | AllowCaching = 1 5 | EnableFlashDL = 2 6 | Override = 0 7 | Device="ADUC7020X62" 8 | [BREAKPOINTS] 9 | ShowInfoWin = 1 10 | EnableFlashBP = 2 11 | BPDuringExecution = 0 12 | [CPU] 13 | OverrideMemMap = 0 14 | AllowSimulation = 1 15 | ScriptFile="" 16 | [SWO] 17 | SWOLogFile="" 18 | -------------------------------------------------------------------------------- /user/tim/tim.h: -------------------------------------------------------------------------------- 1 | /***************************************************************/ 2 | #include "stm32f10x.h" 3 | /***************************************************************/ 4 | #ifndef __TIM_H 5 | #define __TIM_H 6 | /***************************************************************/ 7 | 8 | void TIM_Configuration(TIM_TypeDef* TIMER,u16 Period,u16 Prescaler,u8 PP); // Prescaler/72M*Period S 7200/72M*10000 9 | 10 | #endif 11 | 12 | 13 | -------------------------------------------------------------------------------- /out/main.sct: -------------------------------------------------------------------------------- 1 | ; ************************************************************* 2 | ; *** Scatter-Loading Description File generated by uVision *** 3 | ; ************************************************************* 4 | 5 | LR_IROM1 0x08000000 0x00010000 { ; load region size_region 6 | ER_IROM1 0x08000000 0x00010000 { ; load address = execution address 7 | *.o (RESET, +First) 8 | *(InRoot$$Sections) 9 | .ANY (+RO) 10 | } 11 | RW_IRAM1 0x20000000 0x00005000 { ; RW data 12 | .ANY (+RW +ZI) 13 | } 14 | } 15 | 16 | -------------------------------------------------------------------------------- /user/delay.h: -------------------------------------------------------------------------------- 1 | /***************************************************************/ 2 | #include "stm32f10x.h" 3 | /***************************************************************/ 4 | #ifndef __DELAY_H 5 | #define __DELAY_H 6 | 7 | /***************************************************************/ 8 | void delay_Configuration(u8 SYSCLK); 9 | void delay_ms(u16 nms); 10 | void delay_us(u32 Nus); 11 | void delay_s(u32 Ns); 12 | void RCC_Configuration(void); 13 | void SoftReset(void); 14 | /***************************************************************/ 15 | 16 | 17 | #endif 18 | 19 | -------------------------------------------------------------------------------- /JLink Regs CM3.txt: -------------------------------------------------------------------------------- 1 | 0: R0: 0x00 2 | 1: R1: 0x01 3 | 2: R2: 0x02 4 | 3: R3: 0x03 5 | 4: R4: 0x04 6 | 5: R5: 0x05 7 | 6: R6: 0x06 8 | 7: R7: 0x07 9 | 8: R8: 0x08 10 | 9: R9: 0x09 11 | 10: R10: 0x0a 12 | 11: R11: 0x0b 13 | 12: R12: 0x0c 14 | 13: R13: 0x0d 15 | 14: R14: 0x0e 16 | 15: R15: 0x0f 17 | 16: XPSR: 0x10 18 | 17: MSP: 0x11 19 | 18: PSP: 0x12 20 | 19: RAZ: 0x13 21 | 20: CFBP: 0x14 22 | 21: APSR: 0x15 23 | 22: EPSR: 0x16 24 | 23: IPSR: 0x17 25 | 24: PRIMASK: 0x18 26 | 25: BASEPRI: 0x19 27 | 26: FAULTMASK: 0x1a 28 | 27: CONTROL: 0x1b 29 | 28: BASEPRI_MAX: 0x1c 30 | 29: IAPSR: 0x1d 31 | 30: EAPSR: 0x1e 32 | 31: IEPSR: 0x1f 33 | -------------------------------------------------------------------------------- /out/main.lnp: -------------------------------------------------------------------------------- 1 | --cpu Cortex-M3 2 | ".\lib\STM32_lib_3.0.lib" 3 | ".\out\core_cm3.o" 4 | ".\out\system_stm32f10x.o" 5 | ".\out\startup_stm32f10x_hd.o" 6 | ".\out\main.o" 7 | ".\out\stm32f10x_it.o" 8 | ".\out\gpio.o" 9 | ".\out\usart.o" 10 | ".\out\delay.o" 11 | ".\out\eeprom.o" 12 | ".\out\tim.o" 13 | ".\out\pwm.o" 14 | ".\out\coolant_control.o" 15 | ".\out\gcode.o" 16 | ".\out\limits.o" 17 | ".\out\motion_control.o" 18 | ".\out\nuts_bolts.o" 19 | ".\out\planner.o" 20 | ".\out\print.o" 21 | ".\out\protocol.o" 22 | ".\out\report.o" 23 | ".\out\serial.o" 24 | ".\out\settings.o" 25 | ".\out\spindle_control.o" 26 | ".\out\stepper.o" 27 | ".\out\eepromavr.o" 28 | --library_type=microlib --strict --scatter ".\out\main.sct" 29 | --summary_stderr --info summarysizes --map --xref --callgraph --symbols 30 | --info sizes --info totals --info unused --info veneers 31 | --list ".\out\main.map" -o .\out\main.axf -------------------------------------------------------------------------------- /out/tim.d: -------------------------------------------------------------------------------- 1 | .\out\tim.o: user\tim\tim.c 2 | .\out\tim.o: .\sys\stm32f10x.h 3 | .\out\tim.o: .\sys\core_cm3.h 4 | .\out\tim.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h 5 | .\out\tim.o: .\sys\system_stm32f10x.h 6 | .\out\tim.o: .\user\stm32f10x_conf.h 7 | .\out\tim.o: .\lib\stm32f10x_adc.h 8 | .\out\tim.o: .\sys\stm32f10x.h 9 | .\out\tim.o: .\lib\stm32f10x_dac.h 10 | .\out\tim.o: .\lib\stm32f10x_dma.h 11 | .\out\tim.o: .\lib\stm32f10x_exti.h 12 | .\out\tim.o: .\lib\stm32f10x_flash.h 13 | .\out\tim.o: .\lib\stm32f10x_fsmc.h 14 | .\out\tim.o: .\lib\stm32f10x_gpio.h 15 | .\out\tim.o: .\lib\stm32f10x_i2c.h 16 | .\out\tim.o: .\lib\stm32f10x_iwdg.h 17 | .\out\tim.o: .\lib\stm32f10x_rcc.h 18 | .\out\tim.o: .\lib\stm32f10x_sdio.h 19 | .\out\tim.o: .\lib\stm32f10x_spi.h 20 | .\out\tim.o: .\lib\stm32f10x_tim.h 21 | .\out\tim.o: .\lib\stm32f10x_usart.h 22 | .\out\tim.o: .\lib\misc.h 23 | .\out\tim.o: user\tim\tim.h 24 | -------------------------------------------------------------------------------- /out/gpio.d: -------------------------------------------------------------------------------- 1 | .\out\gpio.o: user\gpio.c 2 | .\out\gpio.o: user\gpio.h 3 | .\out\gpio.o: .\sys\stm32f10x.h 4 | .\out\gpio.o: .\sys\core_cm3.h 5 | .\out\gpio.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h 6 | .\out\gpio.o: .\sys\system_stm32f10x.h 7 | .\out\gpio.o: .\user\stm32f10x_conf.h 8 | .\out\gpio.o: .\lib\stm32f10x_adc.h 9 | .\out\gpio.o: .\sys\stm32f10x.h 10 | .\out\gpio.o: .\lib\stm32f10x_dac.h 11 | .\out\gpio.o: .\lib\stm32f10x_dma.h 12 | .\out\gpio.o: .\lib\stm32f10x_exti.h 13 | .\out\gpio.o: .\lib\stm32f10x_flash.h 14 | .\out\gpio.o: .\lib\stm32f10x_fsmc.h 15 | .\out\gpio.o: .\lib\stm32f10x_gpio.h 16 | .\out\gpio.o: .\lib\stm32f10x_i2c.h 17 | .\out\gpio.o: .\lib\stm32f10x_iwdg.h 18 | .\out\gpio.o: .\lib\stm32f10x_rcc.h 19 | .\out\gpio.o: .\lib\stm32f10x_sdio.h 20 | .\out\gpio.o: .\lib\stm32f10x_spi.h 21 | .\out\gpio.o: .\lib\stm32f10x_tim.h 22 | .\out\gpio.o: .\lib\stm32f10x_usart.h 23 | .\out\gpio.o: .\lib\misc.h 24 | -------------------------------------------------------------------------------- /out/delay.d: -------------------------------------------------------------------------------- 1 | .\out\delay.o: user\delay.c 2 | .\out\delay.o: .\sys\stm32f10x.h 3 | .\out\delay.o: .\sys\core_cm3.h 4 | .\out\delay.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h 5 | .\out\delay.o: .\sys\system_stm32f10x.h 6 | .\out\delay.o: .\user\stm32f10x_conf.h 7 | .\out\delay.o: .\lib\stm32f10x_adc.h 8 | .\out\delay.o: .\sys\stm32f10x.h 9 | .\out\delay.o: .\lib\stm32f10x_dac.h 10 | .\out\delay.o: .\lib\stm32f10x_dma.h 11 | .\out\delay.o: .\lib\stm32f10x_exti.h 12 | .\out\delay.o: .\lib\stm32f10x_flash.h 13 | .\out\delay.o: .\lib\stm32f10x_fsmc.h 14 | .\out\delay.o: .\lib\stm32f10x_gpio.h 15 | .\out\delay.o: .\lib\stm32f10x_i2c.h 16 | .\out\delay.o: .\lib\stm32f10x_iwdg.h 17 | .\out\delay.o: .\lib\stm32f10x_rcc.h 18 | .\out\delay.o: .\lib\stm32f10x_sdio.h 19 | .\out\delay.o: .\lib\stm32f10x_spi.h 20 | .\out\delay.o: .\lib\stm32f10x_tim.h 21 | .\out\delay.o: .\lib\stm32f10x_usart.h 22 | .\out\delay.o: .\lib\misc.h 23 | .\out\delay.o: user\delay.h 24 | -------------------------------------------------------------------------------- /out/pwm.d: -------------------------------------------------------------------------------- 1 | .\out\pwm.o: user\pwm\pwm.c 2 | .\out\pwm.o: user\pwm\PWM.h 3 | .\out\pwm.o: .\sys\stm32f10x.h 4 | .\out\pwm.o: .\sys\core_cm3.h 5 | .\out\pwm.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h 6 | .\out\pwm.o: .\sys\system_stm32f10x.h 7 | .\out\pwm.o: .\user\stm32f10x_conf.h 8 | .\out\pwm.o: .\lib\stm32f10x_adc.h 9 | .\out\pwm.o: .\sys\stm32f10x.h 10 | .\out\pwm.o: .\lib\stm32f10x_dac.h 11 | .\out\pwm.o: .\lib\stm32f10x_dma.h 12 | .\out\pwm.o: .\lib\stm32f10x_exti.h 13 | .\out\pwm.o: .\lib\stm32f10x_flash.h 14 | .\out\pwm.o: .\lib\stm32f10x_fsmc.h 15 | .\out\pwm.o: .\lib\stm32f10x_gpio.h 16 | .\out\pwm.o: .\lib\stm32f10x_i2c.h 17 | .\out\pwm.o: .\lib\stm32f10x_iwdg.h 18 | .\out\pwm.o: .\lib\stm32f10x_rcc.h 19 | .\out\pwm.o: .\lib\stm32f10x_sdio.h 20 | .\out\pwm.o: .\lib\stm32f10x_spi.h 21 | .\out\pwm.o: .\lib\stm32f10x_tim.h 22 | .\out\pwm.o: .\lib\stm32f10x_usart.h 23 | .\out\pwm.o: .\lib\misc.h 24 | .\out\pwm.o: user\pwm\complementary_pwm.h 25 | -------------------------------------------------------------------------------- /out/eepromavr.d: -------------------------------------------------------------------------------- 1 | .\out\eepromavr.o: user\cnc\eepromavr.c 2 | .\out\eepromavr.o: .\sys\stm32f10x.h 3 | .\out\eepromavr.o: .\sys\core_cm3.h 4 | .\out\eepromavr.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h 5 | .\out\eepromavr.o: .\sys\system_stm32f10x.h 6 | .\out\eepromavr.o: .\user\stm32f10x_conf.h 7 | .\out\eepromavr.o: .\lib\stm32f10x_adc.h 8 | .\out\eepromavr.o: .\sys\stm32f10x.h 9 | .\out\eepromavr.o: .\lib\stm32f10x_dac.h 10 | .\out\eepromavr.o: .\lib\stm32f10x_dma.h 11 | .\out\eepromavr.o: .\lib\stm32f10x_exti.h 12 | .\out\eepromavr.o: .\lib\stm32f10x_flash.h 13 | .\out\eepromavr.o: .\lib\stm32f10x_fsmc.h 14 | .\out\eepromavr.o: .\lib\stm32f10x_gpio.h 15 | .\out\eepromavr.o: .\lib\stm32f10x_i2c.h 16 | .\out\eepromavr.o: .\lib\stm32f10x_iwdg.h 17 | .\out\eepromavr.o: .\lib\stm32f10x_rcc.h 18 | .\out\eepromavr.o: .\lib\stm32f10x_sdio.h 19 | .\out\eepromavr.o: .\lib\stm32f10x_spi.h 20 | .\out\eepromavr.o: .\lib\stm32f10x_tim.h 21 | .\out\eepromavr.o: .\lib\stm32f10x_usart.h 22 | .\out\eepromavr.o: .\lib\misc.h 23 | -------------------------------------------------------------------------------- /out/usart.d: -------------------------------------------------------------------------------- 1 | .\out\usart.o: user\usart.c 2 | .\out\usart.o: .\sys\stm32f10x.h 3 | .\out\usart.o: .\sys\core_cm3.h 4 | .\out\usart.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h 5 | .\out\usart.o: .\sys\system_stm32f10x.h 6 | .\out\usart.o: .\user\stm32f10x_conf.h 7 | .\out\usart.o: .\lib\stm32f10x_adc.h 8 | .\out\usart.o: .\sys\stm32f10x.h 9 | .\out\usart.o: .\lib\stm32f10x_dac.h 10 | .\out\usart.o: .\lib\stm32f10x_dma.h 11 | .\out\usart.o: .\lib\stm32f10x_exti.h 12 | .\out\usart.o: .\lib\stm32f10x_flash.h 13 | .\out\usart.o: .\lib\stm32f10x_fsmc.h 14 | .\out\usart.o: .\lib\stm32f10x_gpio.h 15 | .\out\usart.o: .\lib\stm32f10x_i2c.h 16 | .\out\usart.o: .\lib\stm32f10x_iwdg.h 17 | .\out\usart.o: .\lib\stm32f10x_rcc.h 18 | .\out\usart.o: .\lib\stm32f10x_sdio.h 19 | .\out\usart.o: .\lib\stm32f10x_spi.h 20 | .\out\usart.o: .\lib\stm32f10x_tim.h 21 | .\out\usart.o: .\lib\stm32f10x_usart.h 22 | .\out\usart.o: .\lib\misc.h 23 | .\out\usart.o: user\usart.h 24 | .\out\usart.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdio.h 25 | -------------------------------------------------------------------------------- /out/eeprom.d: -------------------------------------------------------------------------------- 1 | .\out\eeprom.o: user\eeprom.c 2 | .\out\eeprom.o: user\eeprom.h 3 | .\out\eeprom.o: .\sys\stm32f10x.h 4 | .\out\eeprom.o: .\sys\core_cm3.h 5 | .\out\eeprom.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h 6 | .\out\eeprom.o: .\sys\system_stm32f10x.h 7 | .\out\eeprom.o: .\user\stm32f10x_conf.h 8 | .\out\eeprom.o: .\lib\stm32f10x_adc.h 9 | .\out\eeprom.o: .\sys\stm32f10x.h 10 | .\out\eeprom.o: .\lib\stm32f10x_dac.h 11 | .\out\eeprom.o: .\lib\stm32f10x_dma.h 12 | .\out\eeprom.o: .\lib\stm32f10x_exti.h 13 | .\out\eeprom.o: .\lib\stm32f10x_flash.h 14 | .\out\eeprom.o: .\lib\stm32f10x_fsmc.h 15 | .\out\eeprom.o: .\lib\stm32f10x_gpio.h 16 | .\out\eeprom.o: .\lib\stm32f10x_i2c.h 17 | .\out\eeprom.o: .\lib\stm32f10x_iwdg.h 18 | .\out\eeprom.o: .\lib\stm32f10x_rcc.h 19 | .\out\eeprom.o: .\lib\stm32f10x_sdio.h 20 | .\out\eeprom.o: .\lib\stm32f10x_spi.h 21 | .\out\eeprom.o: .\lib\stm32f10x_tim.h 22 | .\out\eeprom.o: .\lib\stm32f10x_usart.h 23 | .\out\eeprom.o: .\lib\misc.h 24 | .\out\eeprom.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\string.h 25 | -------------------------------------------------------------------------------- /out/system_stm32f10x.d: -------------------------------------------------------------------------------- 1 | .\out\system_stm32f10x.o: sys\system_stm32f10x.c 2 | .\out\system_stm32f10x.o: sys\stm32f10x.h 3 | .\out\system_stm32f10x.o: sys\core_cm3.h 4 | .\out\system_stm32f10x.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h 5 | .\out\system_stm32f10x.o: sys\system_stm32f10x.h 6 | .\out\system_stm32f10x.o: .\user\stm32f10x_conf.h 7 | .\out\system_stm32f10x.o: .\lib\stm32f10x_adc.h 8 | .\out\system_stm32f10x.o: .\sys\stm32f10x.h 9 | .\out\system_stm32f10x.o: .\lib\stm32f10x_dac.h 10 | .\out\system_stm32f10x.o: .\lib\stm32f10x_dma.h 11 | .\out\system_stm32f10x.o: .\lib\stm32f10x_exti.h 12 | .\out\system_stm32f10x.o: .\lib\stm32f10x_flash.h 13 | .\out\system_stm32f10x.o: .\lib\stm32f10x_fsmc.h 14 | .\out\system_stm32f10x.o: .\lib\stm32f10x_gpio.h 15 | .\out\system_stm32f10x.o: .\lib\stm32f10x_i2c.h 16 | .\out\system_stm32f10x.o: .\lib\stm32f10x_iwdg.h 17 | .\out\system_stm32f10x.o: .\lib\stm32f10x_rcc.h 18 | .\out\system_stm32f10x.o: .\lib\stm32f10x_sdio.h 19 | .\out\system_stm32f10x.o: .\lib\stm32f10x_spi.h 20 | .\out\system_stm32f10x.o: .\lib\stm32f10x_tim.h 21 | .\out\system_stm32f10x.o: .\lib\stm32f10x_usart.h 22 | .\out\system_stm32f10x.o: .\lib\misc.h 23 | -------------------------------------------------------------------------------- /out/stm32f10x_it.d: -------------------------------------------------------------------------------- 1 | .\out\stm32f10x_it.o: user\stm32f10x_it.c 2 | .\out\stm32f10x_it.o: user\stm32f10x_it.h 3 | .\out\stm32f10x_it.o: .\sys\stm32f10x.h 4 | .\out\stm32f10x_it.o: .\sys\core_cm3.h 5 | .\out\stm32f10x_it.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h 6 | .\out\stm32f10x_it.o: .\sys\system_stm32f10x.h 7 | .\out\stm32f10x_it.o: .\user\stm32f10x_conf.h 8 | .\out\stm32f10x_it.o: .\lib\stm32f10x_adc.h 9 | .\out\stm32f10x_it.o: .\sys\stm32f10x.h 10 | .\out\stm32f10x_it.o: .\lib\stm32f10x_dac.h 11 | .\out\stm32f10x_it.o: .\lib\stm32f10x_dma.h 12 | .\out\stm32f10x_it.o: .\lib\stm32f10x_exti.h 13 | .\out\stm32f10x_it.o: .\lib\stm32f10x_flash.h 14 | .\out\stm32f10x_it.o: .\lib\stm32f10x_fsmc.h 15 | .\out\stm32f10x_it.o: .\lib\stm32f10x_gpio.h 16 | .\out\stm32f10x_it.o: .\lib\stm32f10x_i2c.h 17 | .\out\stm32f10x_it.o: .\lib\stm32f10x_iwdg.h 18 | .\out\stm32f10x_it.o: .\lib\stm32f10x_rcc.h 19 | .\out\stm32f10x_it.o: .\lib\stm32f10x_sdio.h 20 | .\out\stm32f10x_it.o: .\lib\stm32f10x_spi.h 21 | .\out\stm32f10x_it.o: .\lib\stm32f10x_tim.h 22 | .\out\stm32f10x_it.o: .\lib\stm32f10x_usart.h 23 | .\out\stm32f10x_it.o: .\lib\misc.h 24 | .\out\stm32f10x_it.o: user\gpio.h 25 | .\out\stm32f10x_it.o: user\delay.h 26 | .\out\stm32f10x_it.o: user\usart.h 27 | .\out\stm32f10x_it.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdio.h 28 | -------------------------------------------------------------------------------- /user/gpio.c: -------------------------------------------------------------------------------- 1 | /***************************************************************/ 2 | #include "gpio.h" 3 | 4 | /***************************************************************/ 5 | 6 | void My_GPIO_Init(GPIO_TypeDef* GPIOx,u16 pin,u8 mode) 7 | { 8 | GPIO_InitTypeDef GPIO_InitStructure; 9 | 10 | if(GPIOx==GPIOA)RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE); 11 | else if(GPIOx==GPIOB)RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE); 12 | else if(GPIOx==GPIOC)RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC, ENABLE); 13 | else if(GPIOx==GPIOD)RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOD, ENABLE); 14 | else if(GPIOx==GPIOE)RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOE, ENABLE); 15 | else if(GPIOx==GPIOF)RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOF, ENABLE); 16 | else if(GPIOx==GPIOG)RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOG, ENABLE); 17 | else {} 18 | 19 | if(mode==1) 20 | { 21 | 22 | GPIO_InitStructure.GPIO_Pin = pin; 23 | GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; 24 | GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP; 25 | GPIO_Init(GPIOx, &GPIO_InitStructure); 26 | } 27 | else if(mode==0) 28 | { 29 | GPIO_InitStructure.GPIO_Pin = pin; 30 | GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU; 31 | GPIO_Init(GPIOx, &GPIO_InitStructure); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /out/print.d: -------------------------------------------------------------------------------- 1 | .\out\print.o: user\cnc\print.c 2 | .\out\print.o: .\sys\stm32f10x.h 3 | .\out\print.o: .\sys\core_cm3.h 4 | .\out\print.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h 5 | .\out\print.o: .\sys\system_stm32f10x.h 6 | .\out\print.o: .\user\stm32f10x_conf.h 7 | .\out\print.o: .\lib\stm32f10x_adc.h 8 | .\out\print.o: .\sys\stm32f10x.h 9 | .\out\print.o: .\lib\stm32f10x_dac.h 10 | .\out\print.o: .\lib\stm32f10x_dma.h 11 | .\out\print.o: .\lib\stm32f10x_exti.h 12 | .\out\print.o: .\lib\stm32f10x_flash.h 13 | .\out\print.o: .\lib\stm32f10x_fsmc.h 14 | .\out\print.o: .\lib\stm32f10x_gpio.h 15 | .\out\print.o: .\lib\stm32f10x_i2c.h 16 | .\out\print.o: .\lib\stm32f10x_iwdg.h 17 | .\out\print.o: .\lib\stm32f10x_rcc.h 18 | .\out\print.o: .\lib\stm32f10x_sdio.h 19 | .\out\print.o: .\lib\stm32f10x_spi.h 20 | .\out\print.o: .\lib\stm32f10x_tim.h 21 | .\out\print.o: .\lib\stm32f10x_usart.h 22 | .\out\print.o: .\lib\misc.h 23 | .\out\print.o: user\cnc\config.h 24 | .\out\print.o: user\cnc\serial.h 25 | .\out\print.o: user\cnc\nuts_bolts.h 26 | .\out\print.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\string.h 27 | .\out\print.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdbool.h 28 | .\out\print.o: user\cnc\defaults.h 29 | .\out\print.o: user\cnc\pin_map.h 30 | .\out\print.o: user\cnc\coolant_control.h 31 | .\out\print.o: .\user\gpio.h 32 | .\out\print.o: user\cnc\settings.h 33 | .\out\print.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\math.h 34 | -------------------------------------------------------------------------------- /out/serial.d: -------------------------------------------------------------------------------- 1 | .\out\serial.o: user\cnc\serial.c 2 | .\out\serial.o: .\sys\stm32f10x.h 3 | .\out\serial.o: .\sys\core_cm3.h 4 | .\out\serial.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h 5 | .\out\serial.o: .\sys\system_stm32f10x.h 6 | .\out\serial.o: .\user\stm32f10x_conf.h 7 | .\out\serial.o: .\lib\stm32f10x_adc.h 8 | .\out\serial.o: .\sys\stm32f10x.h 9 | .\out\serial.o: .\lib\stm32f10x_dac.h 10 | .\out\serial.o: .\lib\stm32f10x_dma.h 11 | .\out\serial.o: .\lib\stm32f10x_exti.h 12 | .\out\serial.o: .\lib\stm32f10x_flash.h 13 | .\out\serial.o: .\lib\stm32f10x_fsmc.h 14 | .\out\serial.o: .\lib\stm32f10x_gpio.h 15 | .\out\serial.o: .\lib\stm32f10x_i2c.h 16 | .\out\serial.o: .\lib\stm32f10x_iwdg.h 17 | .\out\serial.o: .\lib\stm32f10x_rcc.h 18 | .\out\serial.o: .\lib\stm32f10x_sdio.h 19 | .\out\serial.o: .\lib\stm32f10x_spi.h 20 | .\out\serial.o: .\lib\stm32f10x_tim.h 21 | .\out\serial.o: .\lib\stm32f10x_usart.h 22 | .\out\serial.o: .\lib\misc.h 23 | .\out\serial.o: user\cnc\serial.h 24 | .\out\serial.o: user\cnc\nuts_bolts.h 25 | .\out\serial.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\string.h 26 | .\out\serial.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdbool.h 27 | .\out\serial.o: user\cnc\config.h 28 | .\out\serial.o: user\cnc\defaults.h 29 | .\out\serial.o: user\cnc\pin_map.h 30 | .\out\serial.o: user\cnc\coolant_control.h 31 | .\out\serial.o: .\user\gpio.h 32 | .\out\serial.o: user\cnc\motion_control.h 33 | .\out\serial.o: user\cnc\planner.h 34 | .\out\serial.o: user\cnc\protocol.h 35 | .\out\serial.o: .\user\delay.h 36 | -------------------------------------------------------------------------------- /out/nuts_bolts.d: -------------------------------------------------------------------------------- 1 | .\out\nuts_bolts.o: user\cnc\nuts_bolts.c 2 | .\out\nuts_bolts.o: .\sys\stm32f10x.h 3 | .\out\nuts_bolts.o: .\sys\core_cm3.h 4 | .\out\nuts_bolts.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h 5 | .\out\nuts_bolts.o: .\sys\system_stm32f10x.h 6 | .\out\nuts_bolts.o: .\user\stm32f10x_conf.h 7 | .\out\nuts_bolts.o: .\lib\stm32f10x_adc.h 8 | .\out\nuts_bolts.o: .\sys\stm32f10x.h 9 | .\out\nuts_bolts.o: .\lib\stm32f10x_dac.h 10 | .\out\nuts_bolts.o: .\lib\stm32f10x_dma.h 11 | .\out\nuts_bolts.o: .\lib\stm32f10x_exti.h 12 | .\out\nuts_bolts.o: .\lib\stm32f10x_flash.h 13 | .\out\nuts_bolts.o: .\lib\stm32f10x_fsmc.h 14 | .\out\nuts_bolts.o: .\lib\stm32f10x_gpio.h 15 | .\out\nuts_bolts.o: .\lib\stm32f10x_i2c.h 16 | .\out\nuts_bolts.o: .\lib\stm32f10x_iwdg.h 17 | .\out\nuts_bolts.o: .\lib\stm32f10x_rcc.h 18 | .\out\nuts_bolts.o: .\lib\stm32f10x_sdio.h 19 | .\out\nuts_bolts.o: .\lib\stm32f10x_spi.h 20 | .\out\nuts_bolts.o: .\lib\stm32f10x_tim.h 21 | .\out\nuts_bolts.o: .\lib\stm32f10x_usart.h 22 | .\out\nuts_bolts.o: .\lib\misc.h 23 | .\out\nuts_bolts.o: user\cnc\nuts_bolts.h 24 | .\out\nuts_bolts.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\string.h 25 | .\out\nuts_bolts.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdbool.h 26 | .\out\nuts_bolts.o: user\cnc\config.h 27 | .\out\nuts_bolts.o: user\cnc\defaults.h 28 | .\out\nuts_bolts.o: user\cnc\pin_map.h 29 | .\out\nuts_bolts.o: user\cnc\coolant_control.h 30 | .\out\nuts_bolts.o: .\user\gpio.h 31 | .\out\nuts_bolts.o: user\cnc\gcode.h 32 | .\out\nuts_bolts.o: user\cnc\planner.h 33 | .\out\nuts_bolts.o: .\user\usart.h 34 | .\out\nuts_bolts.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdio.h 35 | -------------------------------------------------------------------------------- /user/cnc/limits.h: -------------------------------------------------------------------------------- 1 | /* 2 | limits.h - code pertaining to limit-switches and performing the homing cycle 3 | Part of Grbl 4 | 5 | The MIT License (MIT) 6 | 7 | GRBL(tm) - Embedded CNC g-code interpreter and motion-controller 8 | Copyright (c) 2009-2011 Simen Svale Skogsrud 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining a copy 11 | of this software and associated documentation files (the "Software"), to deal 12 | in the Software without restriction, including without limitation the rights 13 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the Software is 15 | furnished to do so, subject to the following conditions: 16 | 17 | The above copyright notice and this permission notice shall be included in 18 | all copies or substantial portions of the Software. 19 | 20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 26 | THE SOFTWARE. 27 | */ 28 | 29 | #ifndef limits_h 30 | #define limits_h 31 | #include "stm32f10x.h" 32 | 33 | // initialize the limits module 34 | void limits_init(void); 35 | 36 | // perform the homing cycle 37 | void limits_go_home(void); 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /out/report.d: -------------------------------------------------------------------------------- 1 | .\out\report.o: user\cnc\report.c 2 | .\out\report.o: .\sys\stm32f10x.h 3 | .\out\report.o: .\sys\core_cm3.h 4 | .\out\report.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h 5 | .\out\report.o: .\sys\system_stm32f10x.h 6 | .\out\report.o: .\user\stm32f10x_conf.h 7 | .\out\report.o: .\lib\stm32f10x_adc.h 8 | .\out\report.o: .\sys\stm32f10x.h 9 | .\out\report.o: .\lib\stm32f10x_dac.h 10 | .\out\report.o: .\lib\stm32f10x_dma.h 11 | .\out\report.o: .\lib\stm32f10x_exti.h 12 | .\out\report.o: .\lib\stm32f10x_flash.h 13 | .\out\report.o: .\lib\stm32f10x_fsmc.h 14 | .\out\report.o: .\lib\stm32f10x_gpio.h 15 | .\out\report.o: .\lib\stm32f10x_i2c.h 16 | .\out\report.o: .\lib\stm32f10x_iwdg.h 17 | .\out\report.o: .\lib\stm32f10x_rcc.h 18 | .\out\report.o: .\lib\stm32f10x_sdio.h 19 | .\out\report.o: .\lib\stm32f10x_spi.h 20 | .\out\report.o: .\lib\stm32f10x_tim.h 21 | .\out\report.o: .\lib\stm32f10x_usart.h 22 | .\out\report.o: .\lib\misc.h 23 | .\out\report.o: user\cnc\report.h 24 | .\out\report.o: user\cnc\print.h 25 | .\out\report.o: user\cnc\settings.h 26 | .\out\report.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\math.h 27 | .\out\report.o: user\cnc\nuts_bolts.h 28 | .\out\report.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\string.h 29 | .\out\report.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdbool.h 30 | .\out\report.o: user\cnc\config.h 31 | .\out\report.o: user\cnc\defaults.h 32 | .\out\report.o: user\cnc\pin_map.h 33 | .\out\report.o: user\cnc\coolant_control.h 34 | .\out\report.o: .\user\gpio.h 35 | .\out\report.o: user\cnc\gcode.h 36 | .\out\report.o: .\user\usart.h 37 | .\out\report.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdio.h 38 | .\out\report.o: .\user\delay.h 39 | -------------------------------------------------------------------------------- /out/gcode.d: -------------------------------------------------------------------------------- 1 | .\out\gcode.o: user\cnc\gcode.c 2 | .\out\gcode.o: .\sys\stm32f10x.h 3 | .\out\gcode.o: .\sys\core_cm3.h 4 | .\out\gcode.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h 5 | .\out\gcode.o: .\sys\system_stm32f10x.h 6 | .\out\gcode.o: .\user\stm32f10x_conf.h 7 | .\out\gcode.o: .\lib\stm32f10x_adc.h 8 | .\out\gcode.o: .\sys\stm32f10x.h 9 | .\out\gcode.o: .\lib\stm32f10x_dac.h 10 | .\out\gcode.o: .\lib\stm32f10x_dma.h 11 | .\out\gcode.o: .\lib\stm32f10x_exti.h 12 | .\out\gcode.o: .\lib\stm32f10x_flash.h 13 | .\out\gcode.o: .\lib\stm32f10x_fsmc.h 14 | .\out\gcode.o: .\lib\stm32f10x_gpio.h 15 | .\out\gcode.o: .\lib\stm32f10x_i2c.h 16 | .\out\gcode.o: .\lib\stm32f10x_iwdg.h 17 | .\out\gcode.o: .\lib\stm32f10x_rcc.h 18 | .\out\gcode.o: .\lib\stm32f10x_sdio.h 19 | .\out\gcode.o: .\lib\stm32f10x_spi.h 20 | .\out\gcode.o: .\lib\stm32f10x_tim.h 21 | .\out\gcode.o: .\lib\stm32f10x_usart.h 22 | .\out\gcode.o: .\lib\misc.h 23 | .\out\gcode.o: user\cnc\gcode.h 24 | .\out\gcode.o: user\cnc\nuts_bolts.h 25 | .\out\gcode.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\string.h 26 | .\out\gcode.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdbool.h 27 | .\out\gcode.o: user\cnc\config.h 28 | .\out\gcode.o: user\cnc\defaults.h 29 | .\out\gcode.o: user\cnc\pin_map.h 30 | .\out\gcode.o: user\cnc\coolant_control.h 31 | .\out\gcode.o: .\user\gpio.h 32 | .\out\gcode.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\math.h 33 | .\out\gcode.o: user\cnc\settings.h 34 | .\out\gcode.o: user\cnc\motion_control.h 35 | .\out\gcode.o: user\cnc\planner.h 36 | .\out\gcode.o: user\cnc\spindle_control.h 37 | .\out\gcode.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\errno.h 38 | .\out\gcode.o: user\cnc\protocol.h 39 | .\out\gcode.o: user\cnc\report.h 40 | -------------------------------------------------------------------------------- /user/cnc/spindle_control.h: -------------------------------------------------------------------------------- 1 | /* 2 | spindle_control.h - spindle control methods 3 | Part of Grbl 4 | 5 | The MIT License (MIT) 6 | 7 | GRBL(tm) - Embedded CNC g-code interpreter and motion-controller 8 | Copyright (c) 2009-2011 Simen Svale Skogsrud 9 | Copyright (c) 2012 Sungeun K. Jeon 10 | 11 | Permission is hereby granted, free of charge, to any person obtaining a copy 12 | of this software and associated documentation files (the "Software"), to deal 13 | in the Software without restriction, including without limitation the rights 14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15 | copies of the Software, and to permit persons to whom the Software is 16 | furnished to do so, subject to the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be included in 19 | all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 27 | THE SOFTWARE. 28 | */ 29 | #ifndef spindle_control_h 30 | #define spindle_control_h 31 | 32 | //#include 33 | #include "stdint.h" 34 | 35 | void spindle_init(void); 36 | void spindle_run(int8_t direction); //, uint16_t rpm); 37 | void spindle_stop(void); 38 | 39 | #endif 40 | -------------------------------------------------------------------------------- /user/cnc/print.h: -------------------------------------------------------------------------------- 1 | /* 2 | print.h - Functions for formatting output strings 3 | Part of Grbl 4 | 5 | The MIT License (MIT) 6 | 7 | GRBL(tm) - Embedded CNC g-code interpreter and motion-controller 8 | Copyright (c) 2009-2011 Simen Svale Skogsrud 9 | Copyright (c) 2011-2012 Sungeun K. Jeon 10 | 11 | Permission is hereby granted, free of charge, to any person obtaining a copy 12 | of this software and associated documentation files (the "Software"), to deal 13 | in the Software without restriction, including without limitation the rights 14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15 | copies of the Software, and to permit persons to whom the Software is 16 | furnished to do so, subject to the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be included in 19 | all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 27 | THE SOFTWARE. 28 | */ 29 | 30 | #ifndef print_h 31 | #define print_h 32 | 33 | #include "stdint.h" 34 | 35 | void printString(const char *s); 36 | 37 | void printPgmString(const char *s); 38 | 39 | void printInteger(long n); 40 | 41 | void print_uint8_base2(uint8_t n); 42 | 43 | void printFloat(float n); 44 | 45 | #endif 46 | -------------------------------------------------------------------------------- /out/planner.d: -------------------------------------------------------------------------------- 1 | .\out\planner.o: user\cnc\planner.c 2 | .\out\planner.o: .\sys\stm32f10x.h 3 | .\out\planner.o: .\sys\core_cm3.h 4 | .\out\planner.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h 5 | .\out\planner.o: .\sys\system_stm32f10x.h 6 | .\out\planner.o: .\user\stm32f10x_conf.h 7 | .\out\planner.o: .\lib\stm32f10x_adc.h 8 | .\out\planner.o: .\sys\stm32f10x.h 9 | .\out\planner.o: .\lib\stm32f10x_dac.h 10 | .\out\planner.o: .\lib\stm32f10x_dma.h 11 | .\out\planner.o: .\lib\stm32f10x_exti.h 12 | .\out\planner.o: .\lib\stm32f10x_flash.h 13 | .\out\planner.o: .\lib\stm32f10x_fsmc.h 14 | .\out\planner.o: .\lib\stm32f10x_gpio.h 15 | .\out\planner.o: .\lib\stm32f10x_i2c.h 16 | .\out\planner.o: .\lib\stm32f10x_iwdg.h 17 | .\out\planner.o: .\lib\stm32f10x_rcc.h 18 | .\out\planner.o: .\lib\stm32f10x_sdio.h 19 | .\out\planner.o: .\lib\stm32f10x_spi.h 20 | .\out\planner.o: .\lib\stm32f10x_tim.h 21 | .\out\planner.o: .\lib\stm32f10x_usart.h 22 | .\out\planner.o: .\lib\misc.h 23 | .\out\planner.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\inttypes.h 24 | .\out\planner.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdlib.h 25 | .\out\planner.o: user\cnc\planner.h 26 | .\out\planner.o: user\cnc\nuts_bolts.h 27 | .\out\planner.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\string.h 28 | .\out\planner.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdbool.h 29 | .\out\planner.o: user\cnc\config.h 30 | .\out\planner.o: user\cnc\defaults.h 31 | .\out\planner.o: user\cnc\pin_map.h 32 | .\out\planner.o: user\cnc\coolant_control.h 33 | .\out\planner.o: .\user\gpio.h 34 | .\out\planner.o: user\cnc\stepper.h 35 | .\out\planner.o: .\user\gpio.h 36 | .\out\planner.o: user\cnc\settings.h 37 | .\out\planner.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\math.h 38 | .\out\planner.o: user\cnc\protocol.h 39 | -------------------------------------------------------------------------------- /user/cnc/eepromavr.h: -------------------------------------------------------------------------------- 1 | /* 2 | eeprom.h - EEPROM methods 3 | Part of Grbl 4 | 5 | The MIT License (MIT) 6 | 7 | GRBL(tm) - Embedded CNC g-code interpreter and motion-controller 8 | Copyright (c) 2009-2011 Simen Svale Skogsrud 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining a copy 11 | of this software and associated documentation files (the "Software"), to deal 12 | in the Software without restriction, including without limitation the rights 13 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the Software is 15 | furnished to do so, subject to the following conditions: 16 | 17 | The above copyright notice and this permission notice shall be included in 18 | all copies or substantial portions of the Software. 19 | 20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 26 | THE SOFTWARE. 27 | */ 28 | 29 | #ifndef eepromavr_h 30 | #define eepromavr_h 31 | 32 | char eeprom_get_char(unsigned int addr); 33 | void eeprom_put_char( unsigned int addr, unsigned char new_value ); 34 | void memcpy_to_eeprom_with_checksum(unsigned int destination, char *source, unsigned int size); 35 | int memcpy_from_eeprom_with_checksum(char *destination, unsigned int source, unsigned int size); 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /out/coolant_control.d: -------------------------------------------------------------------------------- 1 | .\out\coolant_control.o: user\cnc\coolant_control.c 2 | .\out\coolant_control.o: .\sys\stm32f10x.h 3 | .\out\coolant_control.o: .\sys\core_cm3.h 4 | .\out\coolant_control.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h 5 | .\out\coolant_control.o: .\sys\system_stm32f10x.h 6 | .\out\coolant_control.o: .\user\stm32f10x_conf.h 7 | .\out\coolant_control.o: .\lib\stm32f10x_adc.h 8 | .\out\coolant_control.o: .\sys\stm32f10x.h 9 | .\out\coolant_control.o: .\lib\stm32f10x_dac.h 10 | .\out\coolant_control.o: .\lib\stm32f10x_dma.h 11 | .\out\coolant_control.o: .\lib\stm32f10x_exti.h 12 | .\out\coolant_control.o: .\lib\stm32f10x_flash.h 13 | .\out\coolant_control.o: .\lib\stm32f10x_fsmc.h 14 | .\out\coolant_control.o: .\lib\stm32f10x_gpio.h 15 | .\out\coolant_control.o: .\lib\stm32f10x_i2c.h 16 | .\out\coolant_control.o: .\lib\stm32f10x_iwdg.h 17 | .\out\coolant_control.o: .\lib\stm32f10x_rcc.h 18 | .\out\coolant_control.o: .\lib\stm32f10x_sdio.h 19 | .\out\coolant_control.o: .\lib\stm32f10x_spi.h 20 | .\out\coolant_control.o: .\lib\stm32f10x_tim.h 21 | .\out\coolant_control.o: .\lib\stm32f10x_usart.h 22 | .\out\coolant_control.o: .\lib\misc.h 23 | .\out\coolant_control.o: user\cnc\coolant_control.h 24 | .\out\coolant_control.o: .\user\gpio.h 25 | .\out\coolant_control.o: user\cnc\settings.h 26 | .\out\coolant_control.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\math.h 27 | .\out\coolant_control.o: user\cnc\nuts_bolts.h 28 | .\out\coolant_control.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\string.h 29 | .\out\coolant_control.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdbool.h 30 | .\out\coolant_control.o: user\cnc\config.h 31 | .\out\coolant_control.o: user\cnc\defaults.h 32 | .\out\coolant_control.o: user\cnc\pin_map.h 33 | .\out\coolant_control.o: user\cnc\planner.h 34 | -------------------------------------------------------------------------------- /out/settings.d: -------------------------------------------------------------------------------- 1 | .\out\settings.o: user\cnc\settings.c 2 | .\out\settings.o: .\sys\stm32f10x.h 3 | .\out\settings.o: .\sys\core_cm3.h 4 | .\out\settings.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h 5 | .\out\settings.o: .\sys\system_stm32f10x.h 6 | .\out\settings.o: .\user\stm32f10x_conf.h 7 | .\out\settings.o: .\lib\stm32f10x_adc.h 8 | .\out\settings.o: .\sys\stm32f10x.h 9 | .\out\settings.o: .\lib\stm32f10x_dac.h 10 | .\out\settings.o: .\lib\stm32f10x_dma.h 11 | .\out\settings.o: .\lib\stm32f10x_exti.h 12 | .\out\settings.o: .\lib\stm32f10x_flash.h 13 | .\out\settings.o: .\lib\stm32f10x_fsmc.h 14 | .\out\settings.o: .\lib\stm32f10x_gpio.h 15 | .\out\settings.o: .\lib\stm32f10x_i2c.h 16 | .\out\settings.o: .\lib\stm32f10x_iwdg.h 17 | .\out\settings.o: .\lib\stm32f10x_rcc.h 18 | .\out\settings.o: .\lib\stm32f10x_sdio.h 19 | .\out\settings.o: .\lib\stm32f10x_spi.h 20 | .\out\settings.o: .\lib\stm32f10x_tim.h 21 | .\out\settings.o: .\lib\stm32f10x_usart.h 22 | .\out\settings.o: .\lib\misc.h 23 | .\out\settings.o: user\cnc\protocol.h 24 | .\out\settings.o: user\cnc\report.h 25 | .\out\settings.o: user\cnc\stepper.h 26 | .\out\settings.o: .\user\gpio.h 27 | .\out\settings.o: user\cnc\nuts_bolts.h 28 | .\out\settings.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\string.h 29 | .\out\settings.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdbool.h 30 | .\out\settings.o: user\cnc\config.h 31 | .\out\settings.o: user\cnc\defaults.h 32 | .\out\settings.o: user\cnc\pin_map.h 33 | .\out\settings.o: user\cnc\coolant_control.h 34 | .\out\settings.o: .\user\gpio.h 35 | .\out\settings.o: user\cnc\settings.h 36 | .\out\settings.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\math.h 37 | .\out\settings.o: user\cnc\eepromavr.h 38 | .\out\settings.o: .\user\eeprom.h 39 | .\out\settings.o: user\cnc\limits.h 40 | -------------------------------------------------------------------------------- /out/stepper.d: -------------------------------------------------------------------------------- 1 | .\out\stepper.o: user\cnc\stepper.c 2 | .\out\stepper.o: .\sys\stm32f10x.h 3 | .\out\stepper.o: .\sys\core_cm3.h 4 | .\out\stepper.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h 5 | .\out\stepper.o: .\sys\system_stm32f10x.h 6 | .\out\stepper.o: .\user\stm32f10x_conf.h 7 | .\out\stepper.o: .\lib\stm32f10x_adc.h 8 | .\out\stepper.o: .\sys\stm32f10x.h 9 | .\out\stepper.o: .\lib\stm32f10x_dac.h 10 | .\out\stepper.o: .\lib\stm32f10x_dma.h 11 | .\out\stepper.o: .\lib\stm32f10x_exti.h 12 | .\out\stepper.o: .\lib\stm32f10x_flash.h 13 | .\out\stepper.o: .\lib\stm32f10x_fsmc.h 14 | .\out\stepper.o: .\lib\stm32f10x_gpio.h 15 | .\out\stepper.o: .\lib\stm32f10x_i2c.h 16 | .\out\stepper.o: .\lib\stm32f10x_iwdg.h 17 | .\out\stepper.o: .\lib\stm32f10x_rcc.h 18 | .\out\stepper.o: .\lib\stm32f10x_sdio.h 19 | .\out\stepper.o: .\lib\stm32f10x_spi.h 20 | .\out\stepper.o: .\lib\stm32f10x_tim.h 21 | .\out\stepper.o: .\lib\stm32f10x_usart.h 22 | .\out\stepper.o: .\lib\misc.h 23 | .\out\stepper.o: user\cnc\stepper.h 24 | .\out\stepper.o: .\user\gpio.h 25 | .\out\stepper.o: user\cnc\config.h 26 | .\out\stepper.o: user\cnc\settings.h 27 | .\out\stepper.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\math.h 28 | .\out\stepper.o: user\cnc\nuts_bolts.h 29 | .\out\stepper.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\string.h 30 | .\out\stepper.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdbool.h 31 | .\out\stepper.o: user\cnc\defaults.h 32 | .\out\stepper.o: user\cnc\pin_map.h 33 | .\out\stepper.o: user\cnc\coolant_control.h 34 | .\out\stepper.o: .\user\gpio.h 35 | .\out\stepper.o: user\cnc\planner.h 36 | .\out\stepper.o: .\user\delay.h 37 | .\out\stepper.o: .\user\gpio.h 38 | .\out\stepper.o: .\user\gpio.h 39 | .\out\stepper.o: .\user\usart.h 40 | .\out\stepper.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdio.h 41 | -------------------------------------------------------------------------------- /out/limits.d: -------------------------------------------------------------------------------- 1 | .\out\limits.o: user\cnc\limits.c 2 | .\out\limits.o: .\sys\stm32f10x.h 3 | .\out\limits.o: .\sys\core_cm3.h 4 | .\out\limits.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h 5 | .\out\limits.o: .\sys\system_stm32f10x.h 6 | .\out\limits.o: .\user\stm32f10x_conf.h 7 | .\out\limits.o: .\lib\stm32f10x_adc.h 8 | .\out\limits.o: .\sys\stm32f10x.h 9 | .\out\limits.o: .\lib\stm32f10x_dac.h 10 | .\out\limits.o: .\lib\stm32f10x_dma.h 11 | .\out\limits.o: .\lib\stm32f10x_exti.h 12 | .\out\limits.o: .\lib\stm32f10x_flash.h 13 | .\out\limits.o: .\lib\stm32f10x_fsmc.h 14 | .\out\limits.o: .\lib\stm32f10x_gpio.h 15 | .\out\limits.o: .\lib\stm32f10x_i2c.h 16 | .\out\limits.o: .\lib\stm32f10x_iwdg.h 17 | .\out\limits.o: .\lib\stm32f10x_rcc.h 18 | .\out\limits.o: .\lib\stm32f10x_sdio.h 19 | .\out\limits.o: .\lib\stm32f10x_spi.h 20 | .\out\limits.o: .\lib\stm32f10x_tim.h 21 | .\out\limits.o: .\lib\stm32f10x_usart.h 22 | .\out\limits.o: .\lib\misc.h 23 | .\out\limits.o: user\cnc\stepper.h 24 | .\out\limits.o: .\user\gpio.h 25 | .\out\limits.o: user\cnc\settings.h 26 | .\out\limits.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\math.h 27 | .\out\limits.o: user\cnc\nuts_bolts.h 28 | .\out\limits.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\string.h 29 | .\out\limits.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdbool.h 30 | .\out\limits.o: user\cnc\config.h 31 | .\out\limits.o: user\cnc\defaults.h 32 | .\out\limits.o: user\cnc\pin_map.h 33 | .\out\limits.o: user\cnc\coolant_control.h 34 | .\out\limits.o: .\user\gpio.h 35 | .\out\limits.o: user\cnc\spindle_control.h 36 | .\out\limits.o: user\cnc\motion_control.h 37 | .\out\limits.o: user\cnc\planner.h 38 | .\out\limits.o: user\cnc\protocol.h 39 | .\out\limits.o: user\cnc\limits.h 40 | .\out\limits.o: user\cnc\report.h 41 | .\out\limits.o: .\user\delay.h 42 | -------------------------------------------------------------------------------- /user/cnc/coolant_control.h: -------------------------------------------------------------------------------- 1 | /* 2 | coolant_control.h - spindle control methods 3 | Part of Grbl 4 | 5 | The MIT License (MIT) 6 | 7 | GRBL(tm) - Embedded CNC g-code interpreter and motion-controller 8 | Copyright (c) 2012 Sungeun K. Jeon 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining a copy 11 | of this software and associated documentation files (the "Software"), to deal 12 | in the Software without restriction, including without limitation the rights 13 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the Software is 15 | furnished to do so, subject to the following conditions: 16 | 17 | The above copyright notice and this permission notice shall be included in 18 | all copies or substantial portions of the Software. 19 | 20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 26 | THE SOFTWARE. 27 | */ 28 | 29 | #ifndef coolant_control_h 30 | #define coolant_control_h 31 | #include "gpio.h" 32 | //#include 33 | 34 | #define COOLANT_MIST_ENABLE 2 35 | #define COOLANT_FLOOD_ENABLE 1 36 | #define COOLANT_DISABLE 0 // Must be zero. 37 | 38 | void coolant_init(void); 39 | void coolant_stop(void); 40 | void coolant_run(uint8_t mode); 41 | 42 | extern char DDRD,DDRB,DDRA,DDRC,PORTA,PORTB,PORTC,PORTD,PINB; 43 | 44 | #endif 45 | 46 | -------------------------------------------------------------------------------- /out/protocol.d: -------------------------------------------------------------------------------- 1 | .\out\protocol.o: user\cnc\protocol.c 2 | .\out\protocol.o: .\sys\stm32f10x.h 3 | .\out\protocol.o: .\sys\core_cm3.h 4 | .\out\protocol.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h 5 | .\out\protocol.o: .\sys\system_stm32f10x.h 6 | .\out\protocol.o: .\user\stm32f10x_conf.h 7 | .\out\protocol.o: .\lib\stm32f10x_adc.h 8 | .\out\protocol.o: .\sys\stm32f10x.h 9 | .\out\protocol.o: .\lib\stm32f10x_dac.h 10 | .\out\protocol.o: .\lib\stm32f10x_dma.h 11 | .\out\protocol.o: .\lib\stm32f10x_exti.h 12 | .\out\protocol.o: .\lib\stm32f10x_flash.h 13 | .\out\protocol.o: .\lib\stm32f10x_fsmc.h 14 | .\out\protocol.o: .\lib\stm32f10x_gpio.h 15 | .\out\protocol.o: .\lib\stm32f10x_i2c.h 16 | .\out\protocol.o: .\lib\stm32f10x_iwdg.h 17 | .\out\protocol.o: .\lib\stm32f10x_rcc.h 18 | .\out\protocol.o: .\lib\stm32f10x_sdio.h 19 | .\out\protocol.o: .\lib\stm32f10x_spi.h 20 | .\out\protocol.o: .\lib\stm32f10x_tim.h 21 | .\out\protocol.o: .\lib\stm32f10x_usart.h 22 | .\out\protocol.o: .\lib\misc.h 23 | .\out\protocol.o: user\cnc\protocol.h 24 | .\out\protocol.o: user\cnc\gcode.h 25 | .\out\protocol.o: user\cnc\nuts_bolts.h 26 | .\out\protocol.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\string.h 27 | .\out\protocol.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdbool.h 28 | .\out\protocol.o: user\cnc\config.h 29 | .\out\protocol.o: user\cnc\defaults.h 30 | .\out\protocol.o: user\cnc\pin_map.h 31 | .\out\protocol.o: user\cnc\coolant_control.h 32 | .\out\protocol.o: .\user\gpio.h 33 | .\out\protocol.o: user\cnc\serial.h 34 | .\out\protocol.o: user\cnc\print.h 35 | .\out\protocol.o: user\cnc\settings.h 36 | .\out\protocol.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\math.h 37 | .\out\protocol.o: user\cnc\stepper.h 38 | .\out\protocol.o: .\user\gpio.h 39 | .\out\protocol.o: user\cnc\report.h 40 | .\out\protocol.o: user\cnc\motion_control.h 41 | .\out\protocol.o: user\cnc\planner.h 42 | -------------------------------------------------------------------------------- /out/spindle_control.d: -------------------------------------------------------------------------------- 1 | .\out\spindle_control.o: user\cnc\spindle_control.c 2 | .\out\spindle_control.o: .\sys\stm32f10x.h 3 | .\out\spindle_control.o: .\sys\core_cm3.h 4 | .\out\spindle_control.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h 5 | .\out\spindle_control.o: .\sys\system_stm32f10x.h 6 | .\out\spindle_control.o: .\user\stm32f10x_conf.h 7 | .\out\spindle_control.o: .\lib\stm32f10x_adc.h 8 | .\out\spindle_control.o: .\sys\stm32f10x.h 9 | .\out\spindle_control.o: .\lib\stm32f10x_dac.h 10 | .\out\spindle_control.o: .\lib\stm32f10x_dma.h 11 | .\out\spindle_control.o: .\lib\stm32f10x_exti.h 12 | .\out\spindle_control.o: .\lib\stm32f10x_flash.h 13 | .\out\spindle_control.o: .\lib\stm32f10x_fsmc.h 14 | .\out\spindle_control.o: .\lib\stm32f10x_gpio.h 15 | .\out\spindle_control.o: .\lib\stm32f10x_i2c.h 16 | .\out\spindle_control.o: .\lib\stm32f10x_iwdg.h 17 | .\out\spindle_control.o: .\lib\stm32f10x_rcc.h 18 | .\out\spindle_control.o: .\lib\stm32f10x_sdio.h 19 | .\out\spindle_control.o: .\lib\stm32f10x_spi.h 20 | .\out\spindle_control.o: .\lib\stm32f10x_tim.h 21 | .\out\spindle_control.o: .\lib\stm32f10x_usart.h 22 | .\out\spindle_control.o: .\lib\misc.h 23 | .\out\spindle_control.o: user\cnc\settings.h 24 | .\out\spindle_control.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\math.h 25 | .\out\spindle_control.o: user\cnc\nuts_bolts.h 26 | .\out\spindle_control.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\string.h 27 | .\out\spindle_control.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdbool.h 28 | .\out\spindle_control.o: user\cnc\config.h 29 | .\out\spindle_control.o: user\cnc\defaults.h 30 | .\out\spindle_control.o: user\cnc\pin_map.h 31 | .\out\spindle_control.o: user\cnc\coolant_control.h 32 | .\out\spindle_control.o: .\user\gpio.h 33 | .\out\spindle_control.o: user\cnc\spindle_control.h 34 | .\out\spindle_control.o: user\cnc\planner.h 35 | .\out\spindle_control.o: .\user\gpio.h 36 | -------------------------------------------------------------------------------- /out/main.d: -------------------------------------------------------------------------------- 1 | .\out\main.o: user\main.c 2 | .\out\main.o: .\sys\stm32f10x.h 3 | .\out\main.o: .\sys\core_cm3.h 4 | .\out\main.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h 5 | .\out\main.o: .\sys\system_stm32f10x.h 6 | .\out\main.o: .\user\stm32f10x_conf.h 7 | .\out\main.o: .\lib\stm32f10x_adc.h 8 | .\out\main.o: .\sys\stm32f10x.h 9 | .\out\main.o: .\lib\stm32f10x_dac.h 10 | .\out\main.o: .\lib\stm32f10x_dma.h 11 | .\out\main.o: .\lib\stm32f10x_exti.h 12 | .\out\main.o: .\lib\stm32f10x_flash.h 13 | .\out\main.o: .\lib\stm32f10x_fsmc.h 14 | .\out\main.o: .\lib\stm32f10x_gpio.h 15 | .\out\main.o: .\lib\stm32f10x_i2c.h 16 | .\out\main.o: .\lib\stm32f10x_iwdg.h 17 | .\out\main.o: .\lib\stm32f10x_rcc.h 18 | .\out\main.o: .\lib\stm32f10x_sdio.h 19 | .\out\main.o: .\lib\stm32f10x_spi.h 20 | .\out\main.o: .\lib\stm32f10x_tim.h 21 | .\out\main.o: .\lib\stm32f10x_usart.h 22 | .\out\main.o: .\lib\misc.h 23 | .\out\main.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdio.h 24 | .\out\main.o: user\gpio.h 25 | .\out\main.o: user\usart.h 26 | .\out\main.o: user\delay.h 27 | .\out\main.o: .\user\tim\tim.h 28 | .\out\main.o: user\eeprom.h 29 | .\out\main.o: .\user\pwm\pwm.h 30 | .\out\main.o: .\user\pwm\complementary_pwm.h 31 | .\out\main.o: .\user\cnc\config.h 32 | .\out\main.o: .\user\cnc\planner.h 33 | .\out\main.o: .\user\cnc\nuts_bolts.h 34 | .\out\main.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\string.h 35 | .\out\main.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdbool.h 36 | .\out\main.o: .\user\cnc\defaults.h 37 | .\out\main.o: .\user\cnc\pin_map.h 38 | .\out\main.o: .\user\cnc\coolant_control.h 39 | .\out\main.o: .\user\gpio.h 40 | .\out\main.o: .\user\cnc\stepper.h 41 | .\out\main.o: .\user\gpio.h 42 | .\out\main.o: .\user\cnc\spindle_control.h 43 | .\out\main.o: .\user\cnc\motion_control.h 44 | .\out\main.o: .\user\cnc\gcode.h 45 | .\out\main.o: .\user\cnc\protocol.h 46 | .\out\main.o: .\user\cnc\limits.h 47 | .\out\main.o: .\user\cnc\report.h 48 | .\out\main.o: .\user\cnc\settings.h 49 | .\out\main.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\math.h 50 | .\out\main.o: .\user\cnc\serial.h 51 | -------------------------------------------------------------------------------- /out/motion_control.d: -------------------------------------------------------------------------------- 1 | .\out\motion_control.o: user\cnc\motion_control.c 2 | .\out\motion_control.o: .\sys\stm32f10x.h 3 | .\out\motion_control.o: .\sys\core_cm3.h 4 | .\out\motion_control.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdint.h 5 | .\out\motion_control.o: .\sys\system_stm32f10x.h 6 | .\out\motion_control.o: .\user\stm32f10x_conf.h 7 | .\out\motion_control.o: .\lib\stm32f10x_adc.h 8 | .\out\motion_control.o: .\sys\stm32f10x.h 9 | .\out\motion_control.o: .\lib\stm32f10x_dac.h 10 | .\out\motion_control.o: .\lib\stm32f10x_dma.h 11 | .\out\motion_control.o: .\lib\stm32f10x_exti.h 12 | .\out\motion_control.o: .\lib\stm32f10x_flash.h 13 | .\out\motion_control.o: .\lib\stm32f10x_fsmc.h 14 | .\out\motion_control.o: .\lib\stm32f10x_gpio.h 15 | .\out\motion_control.o: .\lib\stm32f10x_i2c.h 16 | .\out\motion_control.o: .\lib\stm32f10x_iwdg.h 17 | .\out\motion_control.o: .\lib\stm32f10x_rcc.h 18 | .\out\motion_control.o: .\lib\stm32f10x_sdio.h 19 | .\out\motion_control.o: .\lib\stm32f10x_spi.h 20 | .\out\motion_control.o: .\lib\stm32f10x_tim.h 21 | .\out\motion_control.o: .\lib\stm32f10x_usart.h 22 | .\out\motion_control.o: .\lib\misc.h 23 | .\out\motion_control.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\math.h 24 | .\out\motion_control.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdlib.h 25 | .\out\motion_control.o: user\cnc\settings.h 26 | .\out\motion_control.o: user\cnc\nuts_bolts.h 27 | .\out\motion_control.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\string.h 28 | .\out\motion_control.o: C:\Keil_v5\ARM\ARMCC\Bin\..\include\stdbool.h 29 | .\out\motion_control.o: user\cnc\config.h 30 | .\out\motion_control.o: user\cnc\defaults.h 31 | .\out\motion_control.o: user\cnc\pin_map.h 32 | .\out\motion_control.o: user\cnc\coolant_control.h 33 | .\out\motion_control.o: .\user\gpio.h 34 | .\out\motion_control.o: user\cnc\gcode.h 35 | .\out\motion_control.o: user\cnc\motion_control.h 36 | .\out\motion_control.o: user\cnc\planner.h 37 | .\out\motion_control.o: user\cnc\spindle_control.h 38 | .\out\motion_control.o: user\cnc\stepper.h 39 | .\out\motion_control.o: .\user\gpio.h 40 | .\out\motion_control.o: user\cnc\limits.h 41 | .\out\motion_control.o: user\cnc\protocol.h 42 | .\out\motion_control.o: .\user\delay.h 43 | -------------------------------------------------------------------------------- /lib/stm32f10x_crc.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_crc.h 4 | * @author MCD Application Team 5 | * @version V3.0.0 6 | * @date 04/06/2009 7 | * @brief This file contains all the functions prototypes for the CRC firmware 8 | * library. 9 | ****************************************************************************** 10 | * @copy 11 | * 12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 18 | * 19 | *

© COPYRIGHT 2009 STMicroelectronics

20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __STM32F10x_CRC_H 24 | #define __STM32F10x_CRC_H 25 | 26 | /* Includes ------------------------------------------------------------------*/ 27 | #include "stm32f10x.h" 28 | 29 | /** @addtogroup StdPeriph_Driver 30 | * @{ 31 | */ 32 | 33 | /** @addtogroup CRC 34 | * @{ 35 | */ 36 | 37 | /** @defgroup CRC_Exported_Types 38 | * @{ 39 | */ 40 | 41 | /** 42 | * @} 43 | */ 44 | 45 | /** @defgroup CRC_Exported_Constants 46 | * @{ 47 | */ 48 | 49 | /** 50 | * @} 51 | */ 52 | 53 | /** @defgroup CRC_Exported_Macros 54 | * @{ 55 | */ 56 | 57 | /** 58 | * @} 59 | */ 60 | 61 | /** @defgroup CRC_Exported_Functions 62 | * @{ 63 | */ 64 | 65 | void CRC_ResetDR(void); 66 | uint32_t CRC_CalcCRC(uint32_t Data); 67 | uint32_t CRC_CalcBlockCRC(uint32_t pBuffer[], uint32_t BufferLength); 68 | uint32_t CRC_GetCRC(void); 69 | void CRC_SetIDRegister(uint8_t IDValue); 70 | uint8_t CRC_GetIDRegister(void); 71 | 72 | #endif /* __STM32F10x_CRC_H */ 73 | /** 74 | * @} 75 | */ 76 | 77 | /** 78 | * @} 79 | */ 80 | 81 | /** 82 | * @} 83 | */ 84 | 85 | /******************* (C) COPYRIGHT 2009 STMicroelectronics *****END OF FILE****/ 86 | -------------------------------------------------------------------------------- /user/cnc/serial.h: -------------------------------------------------------------------------------- 1 | /* 2 | serial.c - Low level functions for sending and recieving bytes via the serial port 3 | Part of Grbl 4 | 5 | The MIT License (MIT) 6 | 7 | GRBL(tm) - Embedded CNC g-code interpreter and motion-controller 8 | Copyright (c) 2009-2011 Simen Svale Skogsrud 9 | Copyright (c) 2011-2012 Sungeun K. Jeon 10 | 11 | Permission is hereby granted, free of charge, to any person obtaining a copy 12 | of this software and associated documentation files (the "Software"), to deal 13 | in the Software without restriction, including without limitation the rights 14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15 | copies of the Software, and to permit persons to whom the Software is 16 | furnished to do so, subject to the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be included in 19 | all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 27 | THE SOFTWARE. 28 | */ 29 | 30 | #ifndef serial_h 31 | #define serial_h 32 | 33 | #include "nuts_bolts.h" 34 | 35 | #ifndef RX_BUFFER_SIZE 36 | #define RX_BUFFER_SIZE 256 37 | #endif 38 | #ifndef TX_BUFFER_SIZE 39 | #define TX_BUFFER_SIZE 64 40 | #endif 41 | 42 | #define SERIAL_NO_DATA 0xff 43 | 44 | #ifdef ENABLE_XONXOFF 45 | #define RX_BUFFER_FULL 96 // XOFF high watermark 46 | #define RX_BUFFER_LOW 64 // XON low watermark 47 | #define SEND_XOFF 1 48 | #define SEND_XON 2 49 | #define XOFF_SENT 3 50 | #define XON_SENT 4 51 | #define XOFF_CHAR 0x13 52 | #define XON_CHAR 0x11 53 | #endif 54 | 55 | void serial_init(void); 56 | 57 | void serial_write(uint8_t data); 58 | 59 | uint8_t serial_read(void); 60 | 61 | // Reset and empty data in read buffer. Used by e-stop and reset. 62 | void serial_reset_read_buffer(void); 63 | 64 | #endif 65 | -------------------------------------------------------------------------------- /user/stm32f10x_conf.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __STM32F10x_CONF_H 3 | #define __STM32F10x_CONF_H 4 | 5 | /* Includes ------------------------------------------------------------------*/ 6 | /* Uncomment the line below to enable peripheral header file inclusion */ 7 | #include "stm32f10x_adc.h" 8 | /* #include "stm32f10x_bkp.h" */ 9 | /* #include "stm32f10x_can.h" */ 10 | /* #include "stm32f10x_crc.h" */ 11 | #include "stm32f10x_dac.h" 12 | /* #include "stm32f10x_dbgmcu.h" */ 13 | #include "stm32f10x_dma.h" 14 | #include "stm32f10x_exti.h" 15 | #include "stm32f10x_flash.h" 16 | #include "stm32f10x_fsmc.h" 17 | #include "stm32f10x_gpio.h" 18 | #include "stm32f10x_i2c.h" 19 | #include "stm32f10x_iwdg.h" 20 | /* #include "stm32f10x_pwr.h" */ 21 | #include "stm32f10x_rcc.h" 22 | /* #include "stm32f10x_rtc.h" */ 23 | #include "stm32f10x_sdio.h" 24 | #include "stm32f10x_spi.h" 25 | #include "stm32f10x_tim.h" 26 | #include "stm32f10x_usart.h" 27 | /* #include "stm32f10x_wwdg.h" */ 28 | #include "misc.h" /* High level functions for NVIC and SysTick (add-on to CMSIS functions) */ 29 | 30 | /* Exported types ------------------------------------------------------------*/ 31 | /* Exported constants --------------------------------------------------------*/ 32 | /* Uncomment the line below to expanse the "assert_param" macro in the 33 | Standard Peripheral Library drivers code */ 34 | /* #define USE_FULL_ASSERT 1 */ 35 | 36 | /* Exported macro ------------------------------------------------------------*/ 37 | #ifdef USE_FULL_ASSERT 38 | 39 | /** 40 | * @brief The assert_param macro is used for function's parameters check. 41 | * @param expr: If expr is false, it calls assert_failed function 42 | * which reports the name of the source file and the source 43 | * line number of the call that failed. 44 | * If expr is true, it returns no value. 45 | * @retval : None 46 | */ 47 | #define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__)) 48 | /* Exported functions ------------------------------------------------------- */ 49 | void assert_failed(uint8_t* file, uint32_t line); 50 | #else 51 | #define assert_param(expr) ((void)0) 52 | #endif /* USE_FULL_ASSERT */ 53 | 54 | #endif /* __STM32F10x_CONF_H */ 55 | 56 | /******************* (C) COPYRIGHT 2009 STMicroelectronics *****END OF FILE****/ 57 | -------------------------------------------------------------------------------- /sys/system_stm32f10x.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file system_stm32f10x.h 4 | * @brief CMSIS Cortex-M3 Device Peripheral Access Layer System Header File. 5 | * @author STMicroelectronics - MCD Application Team 6 | * @version V3.0.0 7 | * @date 04/06/2009 8 | ****************************************************************************** 9 | * 10 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 11 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 12 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 13 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 14 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 15 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 16 | * 17 | *

© COPYRIGHT 2009 STMicroelectronics

18 | ****************************************************************************** 19 | */ 20 | 21 | /** 22 | * @brief Define to prevent recursive inclusion 23 | */ 24 | #ifndef __SYSTEM_STM32F10X_H 25 | #define __SYSTEM_STM32F10X_H 26 | 27 | /** @addtogroup Includes 28 | * @{ 29 | */ 30 | 31 | /** 32 | * @} 33 | */ 34 | 35 | 36 | /** @addtogroup Exported_types 37 | * @{ 38 | */ 39 | 40 | extern const uint32_t SystemFrequency; /*!< System Clock Frequency (Core Clock) */ 41 | extern const uint32_t SystemFrequency_SysClk; /*!< System clock */ 42 | extern const uint32_t SystemFrequency_AHBClk; /*!< AHB System bus speed */ 43 | extern const uint32_t SystemFrequency_APB1Clk; /*!< APB Peripheral Bus 1 (low) speed */ 44 | extern const uint32_t SystemFrequency_APB2Clk; /*!< APB Peripheral Bus 2 (high) speed */ 45 | 46 | /** 47 | * @} 48 | */ 49 | 50 | /** @addtogroup Exported_Constants 51 | * @{ 52 | */ 53 | 54 | /** 55 | * @} 56 | */ 57 | 58 | /** @addtogroup Exported_Macros 59 | * @{ 60 | */ 61 | 62 | /** 63 | * @} 64 | */ 65 | 66 | /** @addtogroup Exported_Functions 67 | * @{ 68 | */ 69 | 70 | extern void SystemInit(void); 71 | /** 72 | * @} 73 | */ 74 | 75 | #endif /*__SYSTEM_STM32F10X_H */ 76 | 77 | /******************* (C) COPYRIGHT 2009 STMicroelectronics *****END OF FILE****/ 78 | -------------------------------------------------------------------------------- /user/cnc/coolant_control.c: -------------------------------------------------------------------------------- 1 | /* 2 | coolant_control.c - coolant control methods 3 | Part of Grbl 4 | 5 | The MIT License (MIT) 6 | 7 | GRBL(tm) - Embedded CNC g-code interpreter and motion-controller 8 | Copyright (c) 2012 Sungeun K. Jeon 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining a copy 11 | of this software and associated documentation files (the "Software"), to deal 12 | in the Software without restriction, including without limitation the rights 13 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the Software is 15 | furnished to do so, subject to the following conditions: 16 | 17 | The above copyright notice and this permission notice shall be included in 18 | all copies or substantial portions of the Software. 19 | 20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 26 | THE SOFTWARE. 27 | */ 28 | #include "stm32f10x.h" 29 | #include "coolant_control.h" 30 | #include "settings.h" 31 | #include "config.h" 32 | #include "planner.h" 33 | 34 | 35 | //#include 36 | char DDRD,DDRB,DDRA,DDRC,PORTA,PORTB,PORTC,PORTD,PINB; 37 | 38 | static uint8_t current_coolant_mode; 39 | 40 | void coolant_init(void) 41 | { 42 | current_coolant_mode = COOLANT_DISABLE; 43 | #if ENABLE_M7 44 | COOLANT_MIST_DDR |= (1 << COOLANT_MIST_BIT); 45 | #endif 46 | COOLANT_FLOOD_DDR |= (1 << COOLANT_FLOOD_BIT); 47 | coolant_stop(); 48 | } 49 | 50 | void coolant_stop(void) 51 | { 52 | #ifdef ENABLE_M7 53 | COOLANT_MIST_PORT &= ~(1 << COOLANT_MIST_BIT); 54 | #endif 55 | COOLANT_FLOOD_PORT &= ~(1 << COOLANT_FLOOD_BIT); 56 | } 57 | 58 | 59 | void coolant_run(uint8_t mode) 60 | { 61 | if (mode != current_coolant_mode) 62 | { 63 | plan_synchronize(); // Ensure coolant turns on when specified in program. 64 | if (mode == COOLANT_FLOOD_ENABLE) { 65 | COOLANT_FLOOD_PORT |= (1 << COOLANT_FLOOD_BIT); 66 | #ifdef ENABLE_M7 67 | } else if (mode == COOLANT_MIST_ENABLE) { 68 | COOLANT_MIST_PORT |= (1 << COOLANT_MIST_BIT); 69 | #endif 70 | } else { 71 | coolant_stop(); 72 | } 73 | current_coolant_mode = mode; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /user/cnc/protocol.h: -------------------------------------------------------------------------------- 1 | /* 2 | protocol.h - the serial protocol master control unit 3 | Part of Grbl 4 | 5 | The MIT License (MIT) 6 | 7 | GRBL(tm) - Embedded CNC g-code interpreter and motion-controller 8 | Copyright (c) 2009-2011 Simen Svale Skogsrud 9 | Copyright (c) 2011-2012 Sungeun K. Jeon 10 | 11 | Permission is hereby granted, free of charge, to any person obtaining a copy 12 | of this software and associated documentation files (the "Software"), to deal 13 | in the Software without restriction, including without limitation the rights 14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15 | copies of the Software, and to permit persons to whom the Software is 16 | furnished to do so, subject to the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be included in 19 | all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 27 | THE SOFTWARE. 28 | */ 29 | #ifndef protocol_h 30 | #define protocol_h 31 | 32 | #include 33 | //#include 34 | 35 | // Line buffer size from the serial input stream to be executed. 36 | // NOTE: Not a problem except for extreme cases, but the line buffer size can be too small 37 | // and g-code blocks can get truncated. Officially, the g-code standards support up to 256 38 | // characters. In future versions, this will be increased, when we know how much extra 39 | // memory space we can invest into here or we re-write the g-code parser not to have his 40 | // buffer. 41 | #ifndef LINE_BUFFER_SIZE 42 | #define LINE_BUFFER_SIZE 70 43 | #endif 44 | 45 | // Initialize the serial protocol 46 | void protocol_init(void); 47 | 48 | // Read command lines from the serial port and execute them as they 49 | // come in. Blocks until the serial buffer is emptied. 50 | void protocol_process(void); 51 | 52 | // Executes one line of input according to protocol 53 | uint8_t protocol_execute_line(char *line); 54 | 55 | // Checks and executes a runtime command at various stop points in main program 56 | void protocol_execute_runtime(void); 57 | 58 | // Execute the startup script lines stored in EEPROM upon initialization 59 | void protocol_execute_startup(void); 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /user/cnc/motion_control.h: -------------------------------------------------------------------------------- 1 | /* 2 | motion_control.h - high level interface for issuing motion commands 3 | Part of Grbl 4 | 5 | The MIT License (MIT) 6 | 7 | GRBL(tm) - Embedded CNC g-code interpreter and motion-controller 8 | Copyright (c) 2009-2011 Simen Svale Skogsrud 9 | Copyright (c) 2011-2012 Sungeun K. Jeon 10 | 11 | Permission is hereby granted, free of charge, to any person obtaining a copy 12 | of this software and associated documentation files (the "Software"), to deal 13 | in the Software without restriction, including without limitation the rights 14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15 | copies of the Software, and to permit persons to whom the Software is 16 | furnished to do so, subject to the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be included in 19 | all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 27 | THE SOFTWARE. 28 | */ 29 | 30 | #ifndef motion_control_h 31 | #define motion_control_h 32 | 33 | //#include 34 | #include "planner.h" 35 | 36 | // Execute linear motion in absolute millimeter coordinates. Feed rate given in millimeters/second 37 | // unless invert_feed_rate is true. Then the feed_rate means that the motion should be completed in 38 | // (1 minute)/feed_rate time. 39 | void mc_line(float x, float y, float z, float feed_rate, uint8_t invert_feed_rate); 40 | 41 | // Execute an arc in offset mode format. position == current xyz, target == target xyz, 42 | // offset == offset from current xyz, axis_XXX defines circle plane in tool space, axis_linear is 43 | // the direction of helical travel, radius == circle radius, isclockwise boolean. Used 44 | // for vector transformation direction. 45 | void mc_arc(float *position, float *target, float *offset, uint8_t axis_0, uint8_t axis_1, 46 | uint8_t axis_linear, float feed_rate, uint8_t invert_feed_rate, float radius, uint8_t isclockwise); 47 | 48 | // Dwell for a specific number of seconds 49 | void mc_dwell(float seconds); 50 | 51 | // Perform homing cycle to locate machine zero. Requires limit switches. 52 | void mc_go_home(void); 53 | 54 | // Performs system reset. If in motion state, kills all motion and sets system alarm. 55 | void mc_reset(void); 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /lib/stm32f10x_wwdg.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_wwdg.h 4 | * @author MCD Application Team 5 | * @version V3.0.0 6 | * @date 04/06/2009 7 | * @brief This file contains all the functions prototypes for the WWDG 8 | * firmware library. 9 | ****************************************************************************** 10 | * @copy 11 | * 12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 18 | * 19 | *

© COPYRIGHT 2009 STMicroelectronics

20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __STM32F10x_WWDG_H 24 | #define __STM32F10x_WWDG_H 25 | 26 | /* Includes ------------------------------------------------------------------*/ 27 | #include "stm32f10x.h" 28 | 29 | /** @addtogroup StdPeriph_Driver 30 | * @{ 31 | */ 32 | 33 | /** @addtogroup WWDG 34 | * @{ 35 | */ 36 | 37 | /** @defgroup WWDG_Exported_Types 38 | * @{ 39 | */ 40 | 41 | /** 42 | * @} 43 | */ 44 | 45 | /** @defgroup WWDG_Exported_Constants 46 | * @{ 47 | */ 48 | 49 | /** @defgroup WWDG_Prescaler 50 | * @{ 51 | */ 52 | 53 | #define WWDG_Prescaler_1 ((uint32_t)0x00000000) 54 | #define WWDG_Prescaler_2 ((uint32_t)0x00000080) 55 | #define WWDG_Prescaler_4 ((uint32_t)0x00000100) 56 | #define WWDG_Prescaler_8 ((uint32_t)0x00000180) 57 | #define IS_WWDG_PRESCALER(PRESCALER) (((PRESCALER) == WWDG_Prescaler_1) || \ 58 | ((PRESCALER) == WWDG_Prescaler_2) || \ 59 | ((PRESCALER) == WWDG_Prescaler_4) || \ 60 | ((PRESCALER) == WWDG_Prescaler_8)) 61 | #define IS_WWDG_WINDOW_VALUE(VALUE) ((VALUE) <= 0x7F) 62 | #define IS_WWDG_COUNTER(COUNTER) (((COUNTER) >= 0x40) && ((COUNTER) <= 0x7F)) 63 | 64 | /** 65 | * @} 66 | */ 67 | 68 | /** 69 | * @} 70 | */ 71 | 72 | /** @defgroup WWDG_Exported_Macros 73 | * @{ 74 | */ 75 | /** 76 | * @} 77 | */ 78 | 79 | /** @defgroup WWDG_Exported_Functions 80 | * @{ 81 | */ 82 | 83 | void WWDG_DeInit(void); 84 | void WWDG_SetPrescaler(uint32_t WWDG_Prescaler); 85 | void WWDG_SetWindowValue(uint8_t WindowValue); 86 | void WWDG_EnableIT(void); 87 | void WWDG_SetCounter(uint8_t Counter); 88 | void WWDG_Enable(uint8_t Counter); 89 | FlagStatus WWDG_GetFlagStatus(void); 90 | void WWDG_ClearFlag(void); 91 | 92 | #endif /* __STM32F10x_WWDG_H */ 93 | 94 | /** 95 | * @} 96 | */ 97 | 98 | /** 99 | * @} 100 | */ 101 | 102 | /** 103 | * @} 104 | */ 105 | 106 | /******************* (C) COPYRIGHT 2009 STMicroelectronics *****END OF FILE****/ 107 | -------------------------------------------------------------------------------- /user/cnc/report.h: -------------------------------------------------------------------------------- 1 | /* 2 | report.h - reporting and messaging methods 3 | Part of Grbl 4 | 5 | The MIT License (MIT) 6 | 7 | GRBL(tm) - Embedded CNC g-code interpreter and motion-controller 8 | Copyright (c) 2012 Sungeun K. Jeon 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining a copy 11 | of this software and associated documentation files (the "Software"), to deal 12 | in the Software without restriction, including without limitation the rights 13 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the Software is 15 | furnished to do so, subject to the following conditions: 16 | 17 | The above copyright notice and this permission notice shall be included in 18 | all copies or substantial portions of the Software. 19 | 20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 26 | THE SOFTWARE. 27 | */ 28 | 29 | #ifndef report_h 30 | #define report_h 31 | 32 | #include "stdint.h" 33 | 34 | // Define Grbl status codes. 35 | #define STATUS_OK 0 36 | #define STATUS_BAD_NUMBER_FORMAT 1 37 | #define STATUS_EXPECTED_COMMAND_LETTER 2 38 | #define STATUS_UNSUPPORTED_STATEMENT 3 39 | #define STATUS_ARC_RADIUS_ERROR 4 40 | #define STATUS_MODAL_GROUP_VIOLATION 5 41 | #define STATUS_INVALID_STATEMENT 6 42 | #define STATUS_SETTING_DISABLED 7 43 | #define STATUS_SETTING_VALUE_NEG 8 44 | #define STATUS_SETTING_STEP_PULSE_MIN 9 45 | #define STATUS_SETTING_READ_FAIL 10 46 | #define STATUS_IDLE_ERROR 11 47 | #define STATUS_ALARM_LOCK 12 48 | #define STATUS_OVERFLOW 13 49 | 50 | // Define Grbl alarm codes. Less than zero to distinguish alarm error from status error. 51 | #define ALARM_HARD_LIMIT -1 52 | #define ALARM_ABORT_CYCLE -2 53 | 54 | // Define Grbl feedback message codes. 55 | #define MESSAGE_CRITICAL_EVENT 1 56 | #define MESSAGE_ALARM_LOCK 2 57 | #define MESSAGE_ALARM_UNLOCK 3 58 | #define MESSAGE_ENABLED 4 59 | #define MESSAGE_DISABLED 5 60 | 61 | // Prints system status messages. 62 | void report_status_message(uint8_t status_code); 63 | 64 | // Prints system alarm messages. 65 | void report_alarm_message(int8_t alarm_code); 66 | 67 | // Prints miscellaneous feedback messages. 68 | void report_feedback_message(uint8_t message_code); 69 | 70 | // Prints welcome message 71 | void report_init_message(void); 72 | 73 | // Prints Grbl help and current global settings 74 | void report_grbl_help(void); 75 | 76 | // Prints Grbl global settings 77 | void report_grbl_settings(void); 78 | 79 | // Prints realtime status report 80 | void report_realtime_status(void); 81 | 82 | // Prints Grbl persistent coordinate parameters 83 | void report_gcode_parameters(void); 84 | 85 | // Prints current g-code parser mode state 86 | void report_gcode_modes(void); 87 | 88 | // Prints startup line 89 | void report_startup_line(uint8_t n, char *line); 90 | 91 | #endif 92 | -------------------------------------------------------------------------------- /lib/stm32f10x_dbgmcu.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_dbgmcu.h 4 | * @author MCD Application Team 5 | * @version V3.0.0 6 | * @date 04/06/2009 7 | * @brief This file contains all the functions prototypes for the DBGMCU 8 | * firmware library. 9 | ****************************************************************************** 10 | * @copy 11 | * 12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 18 | * 19 | *

© COPYRIGHT 2009 STMicroelectronics

20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __STM32F10x_DBGMCU_H 24 | #define __STM32F10x_DBGMCU_H 25 | 26 | /* Includes ------------------------------------------------------------------*/ 27 | #include "stm32f10x.h" 28 | 29 | /** @addtogroup StdPeriph_Driver 30 | * @{ 31 | */ 32 | 33 | /** @addtogroup DBGMCU 34 | * @{ 35 | */ 36 | 37 | /** @defgroup DBGMCU_Exported_Types 38 | * @{ 39 | */ 40 | 41 | /** 42 | * @} 43 | */ 44 | 45 | /** @defgroup DBGMCU_Exported_Constants 46 | * @{ 47 | */ 48 | 49 | #define DBGMCU_SLEEP ((uint32_t)0x00000001) 50 | #define DBGMCU_STOP ((uint32_t)0x00000002) 51 | #define DBGMCU_STANDBY ((uint32_t)0x00000004) 52 | #define DBGMCU_IWDG_STOP ((uint32_t)0x00000100) 53 | #define DBGMCU_WWDG_STOP ((uint32_t)0x00000200) 54 | #define DBGMCU_TIM1_STOP ((uint32_t)0x00000400) 55 | #define DBGMCU_TIM2_STOP ((uint32_t)0x00000800) 56 | #define DBGMCU_TIM3_STOP ((uint32_t)0x00001000) 57 | #define DBGMCU_TIM4_STOP ((uint32_t)0x00002000) 58 | #define DBGMCU_CAN1_STOP ((uint32_t)0x00004000) 59 | #define DBGMCU_I2C1_SMBUS_TIMEOUT ((uint32_t)0x00008000) 60 | #define DBGMCU_I2C2_SMBUS_TIMEOUT ((uint32_t)0x00010000) 61 | #define DBGMCU_TIM8_STOP ((uint32_t)0x00020000) 62 | #define DBGMCU_TIM5_STOP ((uint32_t)0x00040000) 63 | #define DBGMCU_TIM6_STOP ((uint32_t)0x00080000) 64 | #define DBGMCU_TIM7_STOP ((uint32_t)0x00100000) 65 | 66 | #define IS_DBGMCU_PERIPH(PERIPH) ((((PERIPH) & 0xFFE000F8) == 0x00) && ((PERIPH) != 0x00)) 67 | /** 68 | * @} 69 | */ 70 | 71 | /** @defgroup DBGMCU_Exported_Macros 72 | * @{ 73 | */ 74 | 75 | /** 76 | * @} 77 | */ 78 | 79 | /** @defgroup DBGMCU_Exported_Functions 80 | * @{ 81 | */ 82 | 83 | uint32_t DBGMCU_GetREVID(void); 84 | uint32_t DBGMCU_GetDEVID(void); 85 | void DBGMCU_Config(uint32_t DBGMCU_Periph, FunctionalState NewState); 86 | 87 | #endif /* __STM32F10x_DBGMCU_H */ 88 | /** 89 | * @} 90 | */ 91 | 92 | /** 93 | * @} 94 | */ 95 | 96 | /** 97 | * @} 98 | */ 99 | 100 | /******************* (C) COPYRIGHT 2009 STMicroelectronics *****END OF FILE****/ 101 | -------------------------------------------------------------------------------- /user/eeprom.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file EEPROM_Emulation/inc/eeprom.h 4 | * @author MCD Application Team 5 | * @version V3.1.0 6 | * @date 07/27/2009 7 | * @brief This file contains all the functions prototypes for the EEPROM 8 | * emulation firmware library. 9 | ****************************************************************************** 10 | * @copy 11 | * 12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 18 | * 19 | *

© COPYRIGHT 2009 STMicroelectronics

20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __EEPROM_H 24 | #define __EEPROM_H 25 | 26 | /* Includes ------------------------------------------------------------------*/ 27 | #include "stm32f10x.h" 28 | 29 | /* Exported constants --------------------------------------------------------*/ 30 | /* Define the STM32F10Xxx Flash page size depending on the used STM32 device */ 31 | #if defined (STM32F10X_LD) || defined (STM32F10X_MD) 32 | #define PAGE_SIZE (uint16_t)0x400 /* Page size = 1KByte */ 33 | #elif defined (STM32F10X_HD) || defined (STM32F10X_CL) 34 | #define PAGE_SIZE (uint16_t)0x800 /* Page size = 2KByte */ 35 | #endif 36 | 37 | /* EEPROM start address in Flash */ 38 | #define EEPROM_START_ADDRESS ((uint32_t)0x08040000) /* EEPROM emulation start address: 39 | after 256KByte of used Flash memory */ 40 | 41 | /* Pages 0 and 1 base and end addresses */ 42 | #define PAGE0_BASE_ADDRESS ((uint32_t)(EEPROM_START_ADDRESS + 0x000)) 43 | #define PAGE0_END_ADDRESS ((uint32_t)(EEPROM_START_ADDRESS + (PAGE_SIZE - 1))) 44 | 45 | #define PAGE1_BASE_ADDRESS ((uint32_t)(EEPROM_START_ADDRESS + PAGE_SIZE)) 46 | #define PAGE1_END_ADDRESS ((uint32_t)(EEPROM_START_ADDRESS + (2 * PAGE_SIZE - 1))) 47 | 48 | /* Used Flash pages for EEPROM emulation */ 49 | #define PAGE0 ((uint16_t)0x0000) 50 | #define PAGE1 ((uint16_t)0x0001) 51 | 52 | /* No valid page define */ 53 | #define NO_VALID_PAGE ((uint16_t)0x00AB) 54 | 55 | /* Page status definitions */ 56 | #define ERASED ((uint16_t)0xFFFF) /* PAGE is empty */ 57 | #define RECEIVE_DATA ((uint16_t)0xEEEE) /* PAGE is marked to receive data */ 58 | #define VALID_PAGE ((uint16_t)0x0000) /* PAGE containing valid data */ 59 | 60 | /* Valid pages in read and write defines */ 61 | #define READ_FROM_VALID_PAGE ((uint8_t)0x00) 62 | #define WRITE_IN_VALID_PAGE ((uint8_t)0x01) 63 | 64 | /* Page full define */ 65 | #define PAGE_FULL ((uint8_t)0x80) 66 | 67 | /* Variables' number */ 68 | #define NumbOfVar ((uint8_t)0x03) 69 | 70 | /* Exported types ------------------------------------------------------------*/ 71 | /* Exported macro ------------------------------------------------------------*/ 72 | /* Exported functions ------------------------------------------------------- */ 73 | uint16_t EE_Init(void); 74 | uint16_t EE_ReadVariable(uint16_t VirtAddress, uint16_t* Data); 75 | uint16_t EE_WriteVariable(uint16_t VirtAddress, uint16_t Data); 76 | char EE_ReadBuffer(void *data, uint16_t length, uint16_t addr); 77 | char EE_WriteBuffer(void *data, uint16_t length, uint16_t addr); 78 | #endif /* __EEPROM_H */ 79 | 80 | /******************* (C) COPYRIGHT 2009 STMicroelectronics *****END OF FILE****/ 81 | -------------------------------------------------------------------------------- /lib/stm32f10x_rtc.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_rtc.h 4 | * @author MCD Application Team 5 | * @version V3.0.0 6 | * @date 04/06/2009 7 | * @brief This file contains all the functions prototypes for the RTC firmware 8 | * library. 9 | ****************************************************************************** 10 | * @copy 11 | * 12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 18 | * 19 | *

© COPYRIGHT 2009 STMicroelectronics

20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __STM32F10x_RTC_H 24 | #define __STM32F10x_RTC_H 25 | 26 | /* Includes ------------------------------------------------------------------*/ 27 | #include "stm32f10x.h" 28 | 29 | /** @addtogroup StdPeriph_Driver 30 | * @{ 31 | */ 32 | 33 | /** @addtogroup RTC 34 | * @{ 35 | */ 36 | 37 | /** @defgroup RTC_Exported_Types 38 | * @{ 39 | */ 40 | 41 | /** 42 | * @} 43 | */ 44 | 45 | /** @defgroup RTC_Exported_Constants 46 | * @{ 47 | */ 48 | 49 | /** @defgroup RTC_interrupts_define 50 | * @{ 51 | */ 52 | 53 | #define RTC_IT_OW ((uint16_t)0x0004) /* Overflow interrupt */ 54 | #define RTC_IT_ALR ((uint16_t)0x0002) /* Alarm interrupt */ 55 | #define RTC_IT_SEC ((uint16_t)0x0001) /* Second interrupt */ 56 | #define IS_RTC_IT(IT) ((((IT) & (uint16_t)0xFFF8) == 0x00) && ((IT) != 0x00)) 57 | #define IS_RTC_GET_IT(IT) (((IT) == RTC_IT_OW) || ((IT) == RTC_IT_ALR) || \ 58 | ((IT) == RTC_IT_SEC)) 59 | /** 60 | * @} 61 | */ 62 | 63 | /** @defgroup RTC_interrupts_flags 64 | * @{ 65 | */ 66 | 67 | #define RTC_FLAG_RTOFF ((uint16_t)0x0020) /* RTC Operation OFF flag */ 68 | #define RTC_FLAG_RSF ((uint16_t)0x0008) /* Registers Synchronized flag */ 69 | #define RTC_FLAG_OW ((uint16_t)0x0004) /* Overflow flag */ 70 | #define RTC_FLAG_ALR ((uint16_t)0x0002) /* Alarm flag */ 71 | #define RTC_FLAG_SEC ((uint16_t)0x0001) /* Second flag */ 72 | #define IS_RTC_CLEAR_FLAG(FLAG) ((((FLAG) & (uint16_t)0xFFF0) == 0x00) && ((FLAG) != 0x00)) 73 | #define IS_RTC_GET_FLAG(FLAG) (((FLAG) == RTC_FLAG_RTOFF) || ((FLAG) == RTC_FLAG_RSF) || \ 74 | ((FLAG) == RTC_FLAG_OW) || ((FLAG) == RTC_FLAG_ALR) || \ 75 | ((FLAG) == RTC_FLAG_SEC)) 76 | #define IS_RTC_PRESCALER(PRESCALER) ((PRESCALER) <= 0xFFFFF) 77 | 78 | /** 79 | * @} 80 | */ 81 | 82 | /** 83 | * @} 84 | */ 85 | 86 | /** @defgroup RTC_Exported_Macros 87 | * @{ 88 | */ 89 | 90 | /** 91 | * @} 92 | */ 93 | 94 | /** @defgroup RTC_Exported_Functions 95 | * @{ 96 | */ 97 | 98 | void RTC_ITConfig(uint16_t RTC_IT, FunctionalState NewState); 99 | void RTC_EnterConfigMode(void); 100 | void RTC_ExitConfigMode(void); 101 | uint32_t RTC_GetCounter(void); 102 | void RTC_SetCounter(uint32_t CounterValue); 103 | void RTC_SetPrescaler(uint32_t PrescalerValue); 104 | void RTC_SetAlarm(uint32_t AlarmValue); 105 | uint32_t RTC_GetDivider(void); 106 | void RTC_WaitForLastTask(void); 107 | void RTC_WaitForSynchro(void); 108 | FlagStatus RTC_GetFlagStatus(uint16_t RTC_FLAG); 109 | void RTC_ClearFlag(uint16_t RTC_FLAG); 110 | ITStatus RTC_GetITStatus(uint16_t RTC_IT); 111 | void RTC_ClearITPendingBit(uint16_t RTC_IT); 112 | 113 | #endif /* __STM32F10x_RTC_H */ 114 | /** 115 | * @} 116 | */ 117 | 118 | /** 119 | * @} 120 | */ 121 | 122 | /** 123 | * @} 124 | */ 125 | 126 | /******************* (C) COPYRIGHT 2009 STMicroelectronics *****END OF FILE****/ 127 | -------------------------------------------------------------------------------- /lib/stm32f10x_iwdg.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_iwdg.h 4 | * @author MCD Application Team 5 | * @version V3.0.0 6 | * @date 04/06/2009 7 | * @brief This file contains all the functions prototypes for the IWDG 8 | * firmware library. 9 | ****************************************************************************** 10 | * @copy 11 | * 12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 18 | * 19 | *

© COPYRIGHT 2009 STMicroelectronics

20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __STM32F10x_IWDG_H 24 | #define __STM32F10x_IWDG_H 25 | 26 | /* Includes ------------------------------------------------------------------*/ 27 | #include "stm32f10x.h" 28 | void IWDG_Configuration(u8 prer,u16 rlr) ; 29 | void IWDG_Feed(void); 30 | /** @addtogroup StdPeriph_Driver 31 | * @{ 32 | */ 33 | 34 | /** @addtogroup IWDG 35 | * @{ 36 | */ 37 | 38 | /** @defgroup IWDG_Exported_Types 39 | * @{ 40 | */ 41 | 42 | /** 43 | * @} 44 | */ 45 | 46 | /** @defgroup IWDG_Exported_Constants 47 | * @{ 48 | */ 49 | 50 | /** @defgroup Write_access_to_IWDG_PR_and_IWDG_RLR_registers 51 | * @{ 52 | */ 53 | 54 | #define IWDG_WriteAccess_Enable ((uint16_t)0x5555) 55 | #define IWDG_WriteAccess_Disable ((uint16_t)0x0000) 56 | #define IS_IWDG_WRITE_ACCESS(ACCESS) (((ACCESS) == IWDG_WriteAccess_Enable) || \ 57 | ((ACCESS) == IWDG_WriteAccess_Disable)) 58 | /** 59 | * @} 60 | */ 61 | 62 | /** @defgroup IWDG_prescaler 63 | * @{ 64 | */ 65 | 66 | #define IWDG_Prescaler_4 ((uint8_t)0x00) 67 | #define IWDG_Prescaler_8 ((uint8_t)0x01) 68 | #define IWDG_Prescaler_16 ((uint8_t)0x02) 69 | #define IWDG_Prescaler_32 ((uint8_t)0x03) 70 | #define IWDG_Prescaler_64 ((uint8_t)0x04) 71 | #define IWDG_Prescaler_128 ((uint8_t)0x05) 72 | #define IWDG_Prescaler_256 ((uint8_t)0x06) 73 | #define IS_IWDG_PRESCALER(PRESCALER) (((PRESCALER) == IWDG_Prescaler_4) || \ 74 | ((PRESCALER) == IWDG_Prescaler_8) || \ 75 | ((PRESCALER) == IWDG_Prescaler_16) || \ 76 | ((PRESCALER) == IWDG_Prescaler_32) || \ 77 | ((PRESCALER) == IWDG_Prescaler_64) || \ 78 | ((PRESCALER) == IWDG_Prescaler_128)|| \ 79 | ((PRESCALER) == IWDG_Prescaler_256)) 80 | /** 81 | * @} 82 | */ 83 | 84 | /** @defgroup IWDG_Flag 85 | * @{ 86 | */ 87 | 88 | #define IWDG_FLAG_PVU ((uint16_t)0x0001) 89 | #define IWDG_FLAG_RVU ((uint16_t)0x0002) 90 | #define IS_IWDG_FLAG(FLAG) (((FLAG) == IWDG_FLAG_PVU) || ((FLAG) == IWDG_FLAG_RVU)) 91 | #define IS_IWDG_RELOAD(RELOAD) ((RELOAD) <= 0xFFF) 92 | /** 93 | * @} 94 | */ 95 | 96 | /** 97 | * @} 98 | */ 99 | 100 | /** @defgroup IWDG_Exported_Macros 101 | * @{ 102 | */ 103 | 104 | /** 105 | * @} 106 | */ 107 | 108 | /** @defgroup IWDG_Exported_Functions 109 | * @{ 110 | */ 111 | 112 | void IWDG_WriteAccessCmd(uint16_t IWDG_WriteAccess); 113 | void IWDG_SetPrescaler(uint8_t IWDG_Prescaler); 114 | void IWDG_SetReload(uint16_t Reload); 115 | void IWDG_ReloadCounter(void); 116 | void IWDG_Enable(void); 117 | FlagStatus IWDG_GetFlagStatus(uint16_t IWDG_FLAG); 118 | 119 | #endif /* __STM32F10x_IWDG_H */ 120 | /** 121 | * @} 122 | */ 123 | 124 | /** 125 | * @} 126 | */ 127 | 128 | /** 129 | * @} 130 | */ 131 | 132 | /******************* (C) COPYRIGHT 2009 STMicroelectronics *****END OF FILE****/ 133 | -------------------------------------------------------------------------------- /lib/stm32f10x_pwr.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_pwr.h 4 | * @author MCD Application Team 5 | * @version V3.0.0 6 | * @date 04/06/2009 7 | * @brief This file contains all the functions prototypes for the PWR firmware 8 | * library. 9 | ****************************************************************************** 10 | * @copy 11 | * 12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 18 | * 19 | *

© COPYRIGHT 2009 STMicroelectronics

20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __STM32F10x_PWR_H 24 | #define __STM32F10x_PWR_H 25 | 26 | /* Includes ------------------------------------------------------------------*/ 27 | #include "stm32f10x.h" 28 | 29 | /** @addtogroup StdPeriph_Driver 30 | * @{ 31 | */ 32 | 33 | /** @addtogroup PWR 34 | * @{ 35 | */ 36 | 37 | /** @defgroup PWR_Exported_Types 38 | * @{ 39 | */ 40 | 41 | /** 42 | * @} 43 | */ 44 | 45 | /** @defgroup PWR_Exported_Constants 46 | * @{ 47 | */ 48 | 49 | /** @defgroup PVD_detection_level 50 | * @{ 51 | */ 52 | 53 | #define PWR_PVDLevel_2V2 ((uint32_t)0x00000000) 54 | #define PWR_PVDLevel_2V3 ((uint32_t)0x00000020) 55 | #define PWR_PVDLevel_2V4 ((uint32_t)0x00000040) 56 | #define PWR_PVDLevel_2V5 ((uint32_t)0x00000060) 57 | #define PWR_PVDLevel_2V6 ((uint32_t)0x00000080) 58 | #define PWR_PVDLevel_2V7 ((uint32_t)0x000000A0) 59 | #define PWR_PVDLevel_2V8 ((uint32_t)0x000000C0) 60 | #define PWR_PVDLevel_2V9 ((uint32_t)0x000000E0) 61 | #define IS_PWR_PVD_LEVEL(LEVEL) (((LEVEL) == PWR_PVDLevel_2V2) || ((LEVEL) == PWR_PVDLevel_2V3)|| \ 62 | ((LEVEL) == PWR_PVDLevel_2V4) || ((LEVEL) == PWR_PVDLevel_2V5)|| \ 63 | ((LEVEL) == PWR_PVDLevel_2V6) || ((LEVEL) == PWR_PVDLevel_2V7)|| \ 64 | ((LEVEL) == PWR_PVDLevel_2V8) || ((LEVEL) == PWR_PVDLevel_2V9)) 65 | /** 66 | * @} 67 | */ 68 | 69 | /** @defgroup Regulator_state_is_STOP_mode 70 | * @{ 71 | */ 72 | 73 | #define PWR_Regulator_ON ((uint32_t)0x00000000) 74 | #define PWR_Regulator_LowPower ((uint32_t)0x00000001) 75 | #define IS_PWR_REGULATOR(REGULATOR) (((REGULATOR) == PWR_Regulator_ON) || \ 76 | ((REGULATOR) == PWR_Regulator_LowPower)) 77 | /** 78 | * @} 79 | */ 80 | 81 | /** @defgroup STOP_mode_entry 82 | * @{ 83 | */ 84 | 85 | #define PWR_STOPEntry_WFI ((uint8_t)0x01) 86 | #define PWR_STOPEntry_WFE ((uint8_t)0x02) 87 | #define IS_PWR_STOP_ENTRY(ENTRY) (((ENTRY) == PWR_STOPEntry_WFI) || ((ENTRY) == PWR_STOPEntry_WFE)) 88 | 89 | /** 90 | * @} 91 | */ 92 | 93 | /** @defgroup PWR_Flag 94 | * @{ 95 | */ 96 | 97 | #define PWR_FLAG_WU ((uint32_t)0x00000001) 98 | #define PWR_FLAG_SB ((uint32_t)0x00000002) 99 | #define PWR_FLAG_PVDO ((uint32_t)0x00000004) 100 | #define IS_PWR_GET_FLAG(FLAG) (((FLAG) == PWR_FLAG_WU) || ((FLAG) == PWR_FLAG_SB) || \ 101 | ((FLAG) == PWR_FLAG_PVDO)) 102 | 103 | #define IS_PWR_CLEAR_FLAG(FLAG) (((FLAG) == PWR_FLAG_WU) || ((FLAG) == PWR_FLAG_SB)) 104 | /** 105 | * @} 106 | */ 107 | 108 | /** 109 | * @} 110 | */ 111 | 112 | /** @defgroup PWR_Exported_Macros 113 | * @{ 114 | */ 115 | 116 | /** 117 | * @} 118 | */ 119 | 120 | /** @defgroup PWR_Exported_Functions 121 | * @{ 122 | */ 123 | 124 | void PWR_DeInit(void); 125 | void PWR_BackupAccessCmd(FunctionalState NewState); 126 | void PWR_PVDCmd(FunctionalState NewState); 127 | void PWR_PVDLevelConfig(uint32_t PWR_PVDLevel); 128 | void PWR_WakeUpPinCmd(FunctionalState NewState); 129 | void PWR_EnterSTOPMode(uint32_t PWR_Regulator, uint8_t PWR_STOPEntry); 130 | void PWR_EnterSTANDBYMode(void); 131 | FlagStatus PWR_GetFlagStatus(uint32_t PWR_FLAG); 132 | void PWR_ClearFlag(uint32_t PWR_FLAG); 133 | 134 | #endif /* __STM32F10x_PWR_H */ 135 | /** 136 | * @} 137 | */ 138 | 139 | /** 140 | * @} 141 | */ 142 | 143 | /** 144 | * @} 145 | */ 146 | 147 | /******************* (C) COPYRIGHT 2009 STMicroelectronics *****END OF FILE****/ 148 | -------------------------------------------------------------------------------- /user/cnc/settings.h: -------------------------------------------------------------------------------- 1 | /* 2 | settings.h - eeprom configuration handling 3 | Part of Grbl 4 | 5 | The MIT License (MIT) 6 | 7 | GRBL(tm) - Embedded CNC g-code interpreter and motion-controller 8 | Copyright (c) 2009-2011 Simen Svale Skogsrud 9 | Copyright (c) 2011-2012 Sungeun K. Jeon 10 | 11 | Permission is hereby granted, free of charge, to any person obtaining a copy 12 | of this software and associated documentation files (the "Software"), to deal 13 | in the Software without restriction, including without limitation the rights 14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15 | copies of the Software, and to permit persons to whom the Software is 16 | furnished to do so, subject to the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be included in 19 | all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 27 | THE SOFTWARE. 28 | */ 29 | 30 | #ifndef settings_h 31 | #define settings_h 32 | 33 | #include 34 | #include "nuts_bolts.h" 35 | 36 | #define GRBL_VERSION "0.8c" 37 | 38 | // Version of the EEPROM data. Will be used to migrate existing data from older versions of Grbl 39 | // when firmware is upgraded. Always stored in byte 0 of eeprom 40 | #define SETTINGS_VERSION 5 41 | 42 | // Define bit flag masks for the boolean settings in settings.flag. 43 | #define BITFLAG_REPORT_INCHES bit(0) 44 | #define BITFLAG_AUTO_START bit(1) 45 | #define BITFLAG_INVERT_ST_ENABLE bit(2) 46 | #define BITFLAG_HARD_LIMIT_ENABLE bit(3) 47 | #define BITFLAG_HOMING_ENABLE bit(4) 48 | 49 | // Define EEPROM memory address location values for Grbl settings and parameters 50 | // NOTE: The Atmega328p has 1KB EEPROM. The upper half is reserved for parameters and 51 | // the startup script. The lower half contains the global settings and space for future 52 | // developments. 53 | #define EEPROM_ADDR_GLOBAL 1 54 | #define EEPROM_ADDR_PARAMETERS 512 55 | #define EEPROM_ADDR_STARTUP_BLOCK 768 56 | 57 | // Define EEPROM address indexing for coordinate parameters 58 | #define N_COORDINATE_SYSTEM 6 // Number of supported work coordinate systems (from index 1) 59 | #define SETTING_INDEX_NCOORD N_COORDINATE_SYSTEM+1 // Total number of system stored (from index 0) 60 | // NOTE: Work coordinate indices are (0=G54, 1=G55, ... , 6=G59) 61 | #define SETTING_INDEX_G28 N_COORDINATE_SYSTEM // Home position 1 62 | #define SETTING_INDEX_G30 N_COORDINATE_SYSTEM+1 // Home position 2 63 | // #define SETTING_INDEX_G92 N_COORDINATE_SYSTEM+2 // Coordinate offset (G92.2,G92.3 not supported) 64 | 65 | // Global persistent settings (Stored from byte EEPROM_ADDR_GLOBAL onwards) 66 | typedef struct { 67 | float steps_per_mm[3]; 68 | uint8_t microsteps; 69 | uint8_t pulse_microseconds; 70 | float default_feed_rate; 71 | float default_seek_rate; 72 | uint8_t invert_mask; 73 | float mm_per_arc_segment; 74 | float acceleration; 75 | float junction_deviation; 76 | uint8_t flags; // Contains default boolean settings 77 | uint8_t homing_dir_mask; 78 | float homing_feed_rate; 79 | float homing_seek_rate; 80 | uint16_t homing_debounce_delay; 81 | float homing_pulloff; 82 | uint8_t stepper_idle_lock_time; // If max value 255, steppers do not disable. 83 | uint8_t decimal_places; 84 | uint8_t n_arc_correction; 85 | // uint8_t status_report_mask; // Mask to indicate desired report data. 86 | } settings_t; 87 | extern settings_t settings; 88 | 89 | // Initialize the configuration subsystem (load settings from EEPROM) 90 | void settings_init(void); 91 | 92 | // A helper method to set new settings from command line 93 | uint8_t settings_store_global_setting(int parameter, float value); 94 | 95 | // Stores the protocol line variable as a startup line in EEPROM 96 | void settings_store_startup_line(uint8_t n, char *line); 97 | 98 | // Reads an EEPROM startup line to the protocol line variable 99 | uint8_t settings_read_startup_line(uint8_t n, char *line); 100 | 101 | // Writes selected coordinate data to EEPROM 102 | void settings_write_coord_data(uint8_t coord_select, float *coord_data); 103 | 104 | // Reads selected coordinate data from EEPROM 105 | uint8_t settings_read_coord_data(uint8_t coord_select, float *coord_data); 106 | 107 | void settings_reset(bool reset_all); 108 | #endif 109 | -------------------------------------------------------------------------------- /user/cnc/planner.h: -------------------------------------------------------------------------------- 1 | /* 2 | planner.h - buffers movement commands and manages the acceleration profile plan 3 | Part of Grbl 4 | 5 | The MIT License (MIT) 6 | 7 | GRBL(tm) - Embedded CNC g-code interpreter and motion-controller 8 | Copyright (c) 2009-2011 Simen Svale Skogsrud 9 | Copyright (c) 2011-2012 Sungeun K. Jeon 10 | 11 | Permission is hereby granted, free of charge, to any person obtaining a copy 12 | of this software and associated documentation files (the "Software"), to deal 13 | in the Software without restriction, including without limitation the rights 14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15 | copies of the Software, and to permit persons to whom the Software is 16 | furnished to do so, subject to the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be included in 19 | all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 27 | THE SOFTWARE. 28 | */ 29 | 30 | #ifndef planner_h 31 | #define planner_h 32 | 33 | // The number of linear motions that can be in the plan at any give time 34 | #ifndef BLOCK_BUFFER_SIZE 35 | #define BLOCK_BUFFER_SIZE 18 36 | #endif 37 | 38 | #include "stdint.h" 39 | 40 | // This struct is used when buffering the setup for each linear movement "nominal" values are as specified in 41 | // the source g-code and may never actually be reached if acceleration management is active. 42 | typedef struct { 43 | 44 | // Fields used by the bresenham algorithm for tracing the line 45 | uint8_t direction_bits; // The direction bit set for this block (refers to *_DIRECTION_BIT in config.h) 46 | uint32_t steps_x, steps_y, steps_z; // Step count along each axis 47 | int32_t step_event_count; // The number of step events required to complete this block 48 | 49 | // Fields used by the motion planner to manage acceleration 50 | float nominal_speed; // The nominal speed for this block in mm/min 51 | float entry_speed; // Entry speed at previous-current block junction in mm/min 52 | float max_entry_speed; // Maximum allowable junction entry speed in mm/min 53 | float millimeters; // The total travel of this block in mm 54 | uint8_t recalculate_flag; // Planner flag to recalculate trapezoids on entry junction 55 | uint8_t nominal_length_flag; // Planner flag for nominal speed always reached 56 | 57 | // Settings for the trapezoid generator 58 | uint32_t initial_rate; // The step rate at start of block 59 | uint32_t final_rate; // The step rate at end of block 60 | int32_t rate_delta; // The steps/minute to add or subtract when changing speed (must be positive) 61 | uint32_t accelerate_until; // The index of the step event on which to stop acceleration 62 | uint32_t decelerate_after; // The index of the step event on which to start decelerating 63 | uint32_t nominal_rate; // The nominal step rate for this block in step_events/minute 64 | 65 | } block_t; 66 | 67 | // Initialize the motion plan subsystem 68 | void plan_init(void); 69 | 70 | // Add a new linear movement to the buffer. x, y and z is the signed, absolute target position in 71 | // millimaters. Feed rate specifies the speed of the motion. If feed rate is inverted, the feed 72 | // rate is taken to mean "frequency" and would complete the operation in 1/feed_rate minutes. 73 | void plan_buffer_line(float x, float y, float z, float feed_rate, uint8_t invert_feed_rate); 74 | 75 | // Called when the current block is no longer needed. Discards the block and makes the memory 76 | // availible for new blocks. 77 | void plan_discard_current_block(void); 78 | 79 | // Gets the current block. Returns NULL if buffer empty 80 | block_t *plan_get_current_block(void); 81 | 82 | // Reset the planner position vector (in steps) 83 | void plan_set_current_position(int32_t x, int32_t y, int32_t z); 84 | 85 | // Reinitialize plan with a partially completed block 86 | void plan_cycle_reinitialize(int32_t step_events_remaining); 87 | 88 | // Reset buffer 89 | void plan_reset_buffer(void); 90 | 91 | // Returns the status of the block ring buffer. True, if buffer is full. 92 | uint8_t plan_check_full_buffer(void); 93 | 94 | // Block until all buffered steps are executed 95 | void plan_synchronize(void); 96 | 97 | #endif 98 | -------------------------------------------------------------------------------- /user/cnc/print.c: -------------------------------------------------------------------------------- 1 | /* 2 | print.c - Functions for formatting output strings 3 | Part of Grbl 4 | 5 | The MIT License (MIT) 6 | 7 | GRBL(tm) - Embedded CNC g-code interpreter and motion-controller 8 | Copyright (c) 2009-2011 Simen Svale Skogsrud 9 | Copyright (c) 2011-2012 Sungeun K. Jeon 10 | 11 | Permission is hereby granted, free of charge, to any person obtaining a copy 12 | of this software and associated documentation files (the "Software"), to deal 13 | in the Software without restriction, including without limitation the rights 14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15 | copies of the Software, and to permit persons to whom the Software is 16 | furnished to do so, subject to the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be included in 19 | all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 27 | THE SOFTWARE. 28 | */ 29 | #include "stm32f10x.h" 30 | //#include 31 | #include "config.h" 32 | #include "serial.h" 33 | #include "settings.h" 34 | 35 | void printString(const char *s) 36 | { 37 | while (*s) 38 | serial_write(*s++); 39 | } 40 | 41 | // Print a string stored in PGM-memory 42 | void printPgmString(const char *s) 43 | { 44 | // char c; 45 | // while ((c = pgm_read_byte_near(s++))) 46 | // serial_write(c); 47 | } 48 | 49 | // void printIntegerInBase(unsigned long n, unsigned long base) 50 | // { 51 | // unsigned char buf[8 * sizeof(long)]; // Assumes 8-bit chars. 52 | // unsigned long i = 0; 53 | // 54 | // if (n == 0) { 55 | // serial_write('0'); 56 | // return; 57 | // } 58 | // 59 | // while (n > 0) { 60 | // buf[i++] = n % base; 61 | // n /= base; 62 | // } 63 | // 64 | // for (; i > 0; i--) 65 | // serial_write(buf[i - 1] < 10 ? 66 | // '0' + buf[i - 1] : 67 | // 'A' + buf[i - 1] - 10); 68 | // } 69 | 70 | void print_uint8_base2(uint8_t n) 71 | { 72 | unsigned char buf[8]; 73 | uint8_t i = 0; 74 | 75 | for (; i < 8; i++) { 76 | buf[i] = n & 1; 77 | n >>= 1; 78 | } 79 | 80 | for (; i > 0; i--) 81 | serial_write('0' + buf[i - 1]); 82 | } 83 | 84 | static void print_uint32_base10(unsigned long n) 85 | { 86 | unsigned char buf[10]; 87 | uint8_t i = 0; 88 | 89 | if (n == 0) { 90 | serial_write('0'); 91 | return; 92 | } 93 | 94 | while (n > 0) { 95 | buf[i++] = n % 10 + '0'; 96 | n /= 10; 97 | } 98 | 99 | for (; i > 0; i--) 100 | serial_write(buf[i-1]); 101 | } 102 | 103 | void printInteger(long n) 104 | { 105 | if (n < 0) { 106 | serial_write('-'); 107 | n = -n; 108 | } 109 | print_uint32_base10(n); 110 | } 111 | 112 | // Convert float to string by immediately converting to a long integer, which contains 113 | // more digits than a float. Number of decimal places, which are tracked by a counter, 114 | // may be set by the user. The integer is then efficiently converted to a string. 115 | // NOTE: AVR '%' and '/' integer operations are very efficient. Bitshifting speed-up 116 | // techniques are actually just slightly slower. Found this out the hard way. 117 | void printFloat(float n) 118 | { 119 | if (n < 0) { 120 | serial_write('-'); 121 | n = -n; 122 | } 123 | 124 | uint8_t decimals = settings.decimal_places; 125 | while (decimals >= 2) { // Quickly convert values expected to be E0 to E-4. 126 | n *= 100; 127 | decimals -= 2; 128 | } 129 | if (decimals) { n *= 10; } 130 | n += 0.5; // Add rounding factor. Ensures carryover through entire value. 131 | 132 | // Generate digits backwards and store in string. 133 | unsigned char buf[10]; 134 | uint8_t i = 0; 135 | uint32_t a = (long)n; 136 | buf[settings.decimal_places] = '.'; // Place decimal point, even if decimal places are zero. 137 | while(a > 0) { 138 | if (i == settings.decimal_places) { i++; } // Skip decimal point location 139 | buf[i++] = (a % 10) + '0'; // Get digit 140 | a /= 10; 141 | } 142 | while (i < settings.decimal_places) { 143 | buf[i++] = '0'; // Fill in zeros to decimal point for (n < 1) 144 | } 145 | if (i == settings.decimal_places) { // Fill in leading zero, if needed. 146 | i++; 147 | buf[i++] = '0'; 148 | } 149 | 150 | // Print the generated string. 151 | for (; i > 0; i--) 152 | serial_write(buf[i-1]); 153 | } 154 | -------------------------------------------------------------------------------- /user/cnc/gcode.h: -------------------------------------------------------------------------------- 1 | /* 2 | gcode.h - rs274/ngc parser. 3 | Part of Grbl 4 | 5 | The MIT License (MIT) 6 | 7 | GRBL(tm) - Embedded CNC g-code interpreter and motion-controller 8 | Copyright (c) 2009-2011 Simen Svale Skogsrud 9 | Copyright (c) 2011-2012 Sungeun K. Jeon 10 | 11 | Permission is hereby granted, free of charge, to any person obtaining a copy 12 | of this software and associated documentation files (the "Software"), to deal 13 | in the Software without restriction, including without limitation the rights 14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15 | copies of the Software, and to permit persons to whom the Software is 16 | furnished to do so, subject to the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be included in 19 | all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 27 | THE SOFTWARE. 28 | */ 29 | 30 | #ifndef gcode_h 31 | #define gcode_h 32 | //#include 33 | #include "nuts_bolts.h" 34 | 35 | // Define modal group internal numbers for checking multiple command violations and tracking the 36 | // type of command that is called in the block. A modal group is a group of g-code commands that are 37 | // mutually exclusive, or cannot exist on the same line, because they each toggle a state or execute 38 | // a unique motion. These are defined in the NIST RS274-NGC v3 g-code standard, available online, 39 | // and are similar/identical to other g-code interpreters by manufacturers (Haas,Fanuc,Mazak,etc). 40 | #define MODAL_GROUP_NONE 0 41 | #define MODAL_GROUP_0 1 // [G4,G10,G28,G30,G53,G92,G92.1] Non-modal 42 | #define MODAL_GROUP_1 2 // [G0,G1,G2,G3,G80] Motion 43 | #define MODAL_GROUP_2 3 // [G17,G18,G19] Plane selection 44 | #define MODAL_GROUP_3 4 // [G90,G91] Distance mode 45 | #define MODAL_GROUP_4 5 // [M0,M1,M2,M30] Stopping 46 | #define MODAL_GROUP_5 6 // [G93,G94] Feed rate mode 47 | #define MODAL_GROUP_6 7 // [G20,G21] Units 48 | #define MODAL_GROUP_7 8 // [M3,M4,M5] Spindle turning 49 | #define MODAL_GROUP_12 9 // [G54,G55,G56,G57,G58,G59] Coordinate system selection 50 | 51 | // Define command actions for within execution-type modal groups (motion, stopping, non-modal). Used 52 | // internally by the parser to know which command to execute. 53 | #define MOTION_MODE_SEEK 0 // G0 54 | #define MOTION_MODE_LINEAR 1 // G1 55 | #define MOTION_MODE_CW_ARC 2 // G2 56 | #define MOTION_MODE_CCW_ARC 3 // G3 57 | #define MOTION_MODE_CANCEL 4 // G80 58 | 59 | #define PROGRAM_FLOW_RUNNING 0 60 | #define PROGRAM_FLOW_PAUSED 1 // M0, M1 61 | #define PROGRAM_FLOW_COMPLETED 2 // M2, M30 62 | 63 | #define NON_MODAL_NONE 0 64 | #define NON_MODAL_DWELL 1 // G4 65 | #define NON_MODAL_SET_COORDINATE_DATA 2 // G10 66 | #define NON_MODAL_GO_HOME_0 3 // G28 67 | #define NON_MODAL_SET_HOME_0 4 // G28.1 68 | #define NON_MODAL_GO_HOME_1 5 // G30 69 | #define NON_MODAL_SET_HOME_1 6 // G30.1 70 | #define NON_MODAL_SET_COORDINATE_OFFSET 7 // G92 71 | #define NON_MODAL_RESET_COORDINATE_OFFSET 8 //G92.1 72 | 73 | typedef struct { 74 | uint8_t status_code; // Parser status for current block 75 | uint8_t motion_mode; // {G0, G1, G2, G3, G80} 76 | uint8_t inverse_feed_rate_mode; // {G93, G94} 77 | uint8_t inches_mode; // 0 = millimeter mode, 1 = inches mode {G20, G21} 78 | uint8_t absolute_mode; // 0 = relative motion, 1 = absolute motion {G90, G91} 79 | uint8_t program_flow; // {M0, M1, M2, M30} 80 | int8_t spindle_direction; // 1 = CW, -1 = CCW, 0 = Stop {M3, M4, M5} 81 | uint8_t coolant_mode; // 0 = Disable, 1 = Flood Enable {M8, M9} 82 | float feed_rate; // Millimeters/min 83 | // float seek_rate; // Millimeters/min. Will be used in v0.9 when axis independence is installed 84 | float position[3]; // Where the interpreter considers the tool to be at this point in the code 85 | uint8_t tool; 86 | // uint16_t spindle_speed; // RPM/100 87 | uint8_t plane_axis_0, 88 | plane_axis_1, 89 | plane_axis_2; // The axes of the selected plane 90 | uint8_t coord_select; // Active work coordinate system number. Default: 0=G54. 91 | float coord_system[N_AXIS]; // Current work coordinate system (G54+). Stores offset from absolute machine 92 | // position in mm. Loaded from EEPROM when called. 93 | float coord_offset[N_AXIS]; // Retains the G92 coordinate offset (work coordinates) relative to 94 | // machine zero in mm. Non-persistent. Cleared upon reset and boot. 95 | } parser_state_t; 96 | extern parser_state_t gc; 97 | 98 | // Initialize the parser 99 | void gc_init(void); 100 | 101 | // Execute one block of rs275/ngc/g-code 102 | uint8_t gc_execute_line(char *line); 103 | 104 | // Set g-code parser position. Input in steps. 105 | void gc_set_current_position(int32_t x, int32_t y, int32_t z); 106 | 107 | #endif 108 | -------------------------------------------------------------------------------- /lib/misc.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file misc.h 4 | * @author MCD Application Team 5 | * @version V3.0.0 6 | * @date 04/06/2009 7 | * @brief This file contains all the functions prototypes for the 8 | * miscellaneous firmware library functions. 9 | ****************************************************************************** 10 | * @copy 11 | * 12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 18 | * 19 | *

© COPYRIGHT 2009 STMicroelectronics

20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __MISC_H 24 | #define __MISC_H 25 | 26 | /* Includes ------------------------------------------------------------------*/ 27 | #include "stm32f10x.h" 28 | 29 | /** @addtogroup StdPeriph_Driver 30 | * @{ 31 | */ 32 | 33 | /** @addtogroup MISC 34 | * @{ 35 | */ 36 | 37 | /** @defgroup MISC_Exported_Types 38 | * @{ 39 | */ 40 | 41 | /** 42 | * @brief NVIC Init Structure definition 43 | */ 44 | 45 | typedef struct 46 | { 47 | uint8_t NVIC_IRQChannel; 48 | uint8_t NVIC_IRQChannelPreemptionPriority; 49 | uint8_t NVIC_IRQChannelSubPriority; 50 | FunctionalState NVIC_IRQChannelCmd; 51 | } NVIC_InitTypeDef; 52 | 53 | /** 54 | * @} 55 | */ 56 | 57 | /** @defgroup MISC_Exported_Constants 58 | * @{ 59 | */ 60 | 61 | /** @defgroup Vector_Table_Base 62 | * @{ 63 | */ 64 | 65 | #define NVIC_VectTab_RAM ((uint32_t)0x20000000) 66 | #define NVIC_VectTab_FLASH ((uint32_t)0x08000000) 67 | #define IS_NVIC_VECTTAB(VECTTAB) (((VECTTAB) == NVIC_VectTab_RAM) || \ 68 | ((VECTTAB) == NVIC_VectTab_FLASH)) 69 | /** 70 | * @} 71 | */ 72 | 73 | /** @defgroup System_Low_Power 74 | * @{ 75 | */ 76 | 77 | #define NVIC_LP_SEVONPEND ((uint8_t)0x10) 78 | #define NVIC_LP_SLEEPDEEP ((uint8_t)0x04) 79 | #define NVIC_LP_SLEEPONEXIT ((uint8_t)0x02) 80 | #define IS_NVIC_LP(LP) (((LP) == NVIC_LP_SEVONPEND) || \ 81 | ((LP) == NVIC_LP_SLEEPDEEP) || \ 82 | ((LP) == NVIC_LP_SLEEPONEXIT)) 83 | /** 84 | * @} 85 | */ 86 | 87 | /** @defgroup Preemption_Priority_Group 88 | * @{ 89 | */ 90 | 91 | #define NVIC_PriorityGroup_0 ((uint32_t)0x700) /* 0 bits for pre-emption priority 92 | 4 bits for subpriority */ 93 | #define NVIC_PriorityGroup_1 ((uint32_t)0x600) /* 1 bits for pre-emption priority 94 | 3 bits for subpriority */ 95 | #define NVIC_PriorityGroup_2 ((uint32_t)0x500) /* 2 bits for pre-emption priority 96 | 2 bits for subpriority */ 97 | #define NVIC_PriorityGroup_3 ((uint32_t)0x400) /* 3 bits for pre-emption priority 98 | 1 bits for subpriority */ 99 | #define NVIC_PriorityGroup_4 ((uint32_t)0x300) /* 4 bits for pre-emption priority 100 | 0 bits for subpriority */ 101 | 102 | #define IS_NVIC_PRIORITY_GROUP(GROUP) (((GROUP) == NVIC_PriorityGroup_0) || \ 103 | ((GROUP) == NVIC_PriorityGroup_1) || \ 104 | ((GROUP) == NVIC_PriorityGroup_2) || \ 105 | ((GROUP) == NVIC_PriorityGroup_3) || \ 106 | ((GROUP) == NVIC_PriorityGroup_4)) 107 | 108 | #define IS_NVIC_PREEMPTION_PRIORITY(PRIORITY) ((PRIORITY) < 0x10) 109 | 110 | #define IS_NVIC_SUB_PRIORITY(PRIORITY) ((PRIORITY) < 0x10) 111 | 112 | #define IS_NVIC_OFFSET(OFFSET) ((OFFSET) < 0x0007FFFF) 113 | 114 | /** 115 | * @} 116 | */ 117 | 118 | /** @defgroup SysTick_clock_source 119 | * @{ 120 | */ 121 | 122 | #define SysTick_CLKSource_HCLK_Div8 ((uint32_t)0xFFFFFFFB) 123 | #define SysTick_CLKSource_HCLK ((uint32_t)0x00000004) 124 | #define IS_SYSTICK_CLK_SOURCE(SOURCE) (((SOURCE) == SysTick_CLKSource_HCLK) || \ 125 | ((SOURCE) == SysTick_CLKSource_HCLK_Div8)) 126 | /** 127 | * @} 128 | */ 129 | 130 | /** 131 | * @} 132 | */ 133 | 134 | /** @defgroup MISC_Exported_Macros 135 | * @{ 136 | */ 137 | 138 | /** 139 | * @} 140 | */ 141 | 142 | /** @defgroup MISC_Exported_Functions 143 | * @{ 144 | */ 145 | 146 | void NVIC_PriorityGroupConfig(uint32_t NVIC_PriorityGroup); 147 | void NVIC_Init(NVIC_InitTypeDef* NVIC_InitStruct); 148 | void NVIC_SetVectorTable(uint32_t NVIC_VectTab, uint32_t Offset); 149 | void NVIC_SystemLPConfig(uint8_t LowPowerMode, FunctionalState NewState); 150 | void SysTick_CLKSourceConfig(uint32_t SysTick_CLKSource); 151 | 152 | #endif /* __MISC_H */ 153 | 154 | /** 155 | * @} 156 | */ 157 | 158 | /** 159 | * @} 160 | */ 161 | 162 | /** 163 | * @} 164 | */ 165 | 166 | /******************* (C) COPYRIGHT 2009 STMicroelectronics *****END OF FILE****/ 167 | -------------------------------------------------------------------------------- /user/cnc/stepper.h: -------------------------------------------------------------------------------- 1 | /* 2 | stepper.h - stepper motor driver: executes motion plans of planner.c using the stepper motors 3 | Part of Grbl 4 | 5 | The MIT License (MIT) 6 | 7 | GRBL(tm) - Embedded CNC g-code interpreter and motion-controller 8 | Copyright (c) 2009-2011 Simen Svale Skogsrud 9 | Copyright (c) 2011 Sungeun K. Jeon 10 | 11 | Permission is hereby granted, free of charge, to any person obtaining a copy 12 | of this software and associated documentation files (the "Software"), to deal 13 | in the Software without restriction, including without limitation the rights 14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15 | copies of the Software, and to permit persons to whom the Software is 16 | furnished to do so, subject to the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be included in 19 | all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 27 | THE SOFTWARE. 28 | */ 29 | 30 | #ifndef stepper_h 31 | #define stepper_h 32 | 33 | //#include 34 | #include "stm32f10x.h" 35 | #include "gpio.h" 36 | // Initialize and setup the stepper motor subsystem 37 | void st_init(void); 38 | void Motors_Set_GPIO(void); 39 | void MotorsEnable(char motors); 40 | // Enable steppers, but cycle does not start unless called by motion control or runtime command. 41 | void st_wake_up(void); 42 | 43 | // Immediately disables steppers 44 | void st_go_idle(void); 45 | 46 | // Reset the stepper subsystem variables 47 | void st_reset(void); 48 | 49 | // Notify the stepper subsystem to start executing the g-code program in buffer. 50 | void st_cycle_start(void); 51 | 52 | // Reinitializes the buffer after a feed hold for a resume. 53 | void st_cycle_reinitialize(void); 54 | 55 | // Initiates a feed hold of the running program 56 | void st_feed_hold(void); 57 | 58 | 59 | //#define MOTOR1_ENABLE Clr_E9 60 | //#define MOTOR1_DISABLE Set_E9 61 | //#define MOTOR2_ENABLE Clr_E15 62 | //#define MOTOR2_DISABLE Set_E15 63 | //#define MOTOR3_ENABLE Clr_E9 64 | //#define MOTOR3_DISABLE Set_E9 65 | 66 | //#define MOTOR1_LEFT Clr_E7 67 | //#define MOTOR1_RIGHT Set_E7 68 | //#define MOTOR2_LEFT Clr_E13 69 | //#define MOTOR2_RIGHT Set_E13 70 | //#define MOTOR3_UP Clr_E1 71 | //#define MOTOR3_DOWN Set_E1 72 | 73 | //#define MOTOR1 GPIOB 74 | //#define MOTOR1_PIN (1 << 1) 75 | //#define MOTOR2 GPIOE 76 | //#define MOTOR2_PIN (1 << 11) 77 | //#define MOTOR3 GPIOE 78 | //#define MOTOR3_PIN (1 << 2) 79 | 80 | 81 | 82 | #define PIN1_PIN (1 << 1) 83 | #define PIN1_PORT GPIOA 84 | #define PIN2_PIN (1 << 2) 85 | #define PIN2_PORT GPIOA 86 | #define PIN3_PIN (1 << 0) 87 | #define PIN3_PORT GPIOA 88 | #define PIN4_PIN (1 << 4) 89 | #define PIN4_PORT GPIOA 90 | #define PIN5_PIN (1 << 5) 91 | #define PIN5_PORT GPIOA 92 | #define PIN6_PIN (1 << 3) 93 | #define PIN6_PORT GPIOA 94 | #define PIN7_PIN (1 << 9) 95 | #define PIN7_PORT GPIOD 96 | #define PIN8_PIN (1 << 11) 97 | #define PIN8_PORT GPIOD 98 | #define PIN9_PIN (1 << 13) 99 | #define PIN9_PORT GPIOD 100 | #define PIN10_PIN (1 << 1) 101 | #define PIN10_PORT GPIOD 102 | #define PIN11_PIN (1 << 3) 103 | #define PIN11_PORT GPIOD 104 | #define PIN12_PIN (1 << 5) 105 | #define PIN12_PORT GPIOD 106 | #define PIN14_PIN (1 << 14) 107 | #define PIN14_PORT GPIOD 108 | #define PIN15_PIN (1 << 12) 109 | #define PIN15_PORT GPIOD 110 | #define PIN16_PIN (1 << 10) 111 | #define PIN16_PORT GPIOD 112 | #define PIN17_PIN (1 << 8) 113 | #define PIN17_PORT GPIOD 114 | #define PIN18_PIN (1 << 10) 115 | #define PIN18_PORT GPIOB 116 | #define PIN19_PIN (1 << 14) 117 | #define PIN19_PORT GPIOE 118 | #define PIN20_PIN (1 << 12) 119 | #define PIN20_PORT GPIOE 120 | #define PIN21_PIN (1 << 10) 121 | #define PIN21_PORT GPIOE 122 | #define PIN22_PIN (1 << 8) 123 | #define PIN22_PORT GPIOE 124 | #define PIN23_PIN (1 << 2) 125 | #define PIN23_PORT GPIOB 126 | #define PIN24_PIN (1 << 2) 127 | #define PIN24_PORT GPIOA 128 | #define PIN25_PIN (1 << 0) 129 | #define PIN25_PORT GPIOA 130 | 131 | 132 | #define MOTOR1_ENABLE PIN3_PORT->BSRR = PIN3_PIN 133 | #define MOTOR1_DISABLE PIN3_PORT->BRR = PIN3_PIN 134 | #define MOTOR2_ENABLE PIN6_PORT->BSRR = PIN6_PIN 135 | #define MOTOR2_DISABLE PIN6_PORT->BRR = PIN6_PIN 136 | #define MOTOR3_ENABLE PIN9_PORT->BSRR = PIN9_PIN 137 | #define MOTOR3_DISABLE PIN9_PORT->BRR = PIN9_PIN 138 | 139 | #define MOTOR1_LEFT PIN2_PORT->BSRR = PIN2_PIN 140 | #define MOTOR1_RIGHT PIN2_PORT->BRR = PIN2_PIN 141 | #define MOTOR2_LEFT PIN5_PORT->BSRR = PIN5_PIN 142 | #define MOTOR2_RIGHT PIN5_PORT->BRR = PIN5_PIN 143 | #define MOTOR3_UP PIN8_PORT->BRR = PIN8_PIN 144 | #define MOTOR3_DOWN PIN8_PORT->BSRR = PIN8_PIN 145 | 146 | #define MOTOR1 PIN1_PORT 147 | #define MOTOR1_PIN PIN1_PIN 148 | #define MOTOR2 PIN4_PORT 149 | #define MOTOR2_PIN PIN4_PIN 150 | #define MOTOR3 PIN7_PORT 151 | #define MOTOR3_PIN PIN7_PIN 152 | 153 | 154 | 155 | 156 | #endif 157 | -------------------------------------------------------------------------------- /user/cnc/nuts_bolts.h: -------------------------------------------------------------------------------- 1 | /* 2 | nuts_bolts.h - Header file for shared definitions, variables, and functions 3 | Part of Grbl 4 | 5 | The MIT License (MIT) 6 | 7 | GRBL(tm) - Embedded CNC g-code interpreter and motion-controller 8 | Copyright (c) 2009-2011 Simen Svale Skogsrud 9 | Copyright (c) 2011-2012 Sungeun K. Jeon 10 | 11 | Permission is hereby granted, free of charge, to any person obtaining a copy 12 | of this software and associated documentation files (the "Software"), to deal 13 | in the Software without restriction, including without limitation the rights 14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15 | copies of the Software, and to permit persons to whom the Software is 16 | furnished to do so, subject to the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be included in 19 | all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 27 | THE SOFTWARE. 28 | */ 29 | 30 | #ifndef nuts_bolts_h 31 | #define nuts_bolts_h 32 | 33 | #include 34 | #include 35 | #include 36 | #include "config.h" 37 | #include "defaults.h" 38 | #include "pin_map.h" 39 | 40 | #define false 0 41 | #define true 1 42 | 43 | #define N_AXIS 3 // Number of axes 44 | #define X_AXIS 0 // Axis indexing value 45 | #define Y_AXIS 1 46 | #define Z_AXIS 2 47 | 48 | #define MM_PER_INCH (25.40) 49 | #define INCH_PER_MM (0.0393701) 50 | 51 | // Useful macros 52 | #define clear_vector(a) memset(a, 0, sizeof(a)) 53 | #define clear_vector_float(a) memset(a, 0.0, sizeof(float)*N_AXIS) 54 | #define max(a,b) (((a) > (b)) ? (a) : (b)) 55 | #define min(a,b) (((a) < (b)) ? (a) : (b)) 56 | 57 | // Bit field and masking macros 58 | #define bit(n) (1 << n) 59 | #define bit_true(x,mask) (x |= mask) 60 | #define bit_false(x,mask) (x &= ~mask) 61 | #define bit_toggle(x,mask) (x ^= mask) 62 | #define bit_istrue(x,mask) ((x & mask) != 0) 63 | #define bit_isfalse(x,mask) ((x & mask) == 0) 64 | 65 | // Define system executor bit map. Used internally by runtime protocol as runtime command flags, 66 | // which notifies the main program to execute the specified runtime command asynchronously. 67 | // NOTE: The system executor uses an unsigned 8-bit volatile variable (8 flag limit.) The default 68 | // flags are always false, so the runtime protocol only needs to check for a non-zero value to 69 | // know when there is a runtime command to execute. 70 | #define EXEC_STATUS_REPORT bit(0) // bitmask 00000001 71 | #define EXEC_CYCLE_START bit(1) // bitmask 00000010 72 | #define EXEC_CYCLE_STOP bit(2) // bitmask 00000100 73 | #define EXEC_FEED_HOLD bit(3) // bitmask 00001000 74 | #define EXEC_RESET bit(4) // bitmask 00010000 75 | #define EXEC_ALARM bit(5) // bitmask 00100000 76 | #define EXEC_CRIT_EVENT bit(6) // bitmask 01000000 77 | // #define bit(7) // bitmask 10000000 78 | 79 | // Define system state bit map. The state variable primarily tracks the individual functions 80 | // of Grbl to manage each without overlapping. It is also used as a messaging flag for 81 | // critical events. 82 | #define STATE_IDLE 0 // Must be zero. 83 | #define STATE_INIT 1 // Initial power up state. 84 | #define STATE_QUEUED 2 // Indicates buffered blocks, awaiting cycle start. 85 | #define STATE_CYCLE 3 // Cycle is running 86 | #define STATE_HOLD 4 // Executing feed hold 87 | #define STATE_HOMING 5 // Performing homing cycle 88 | #define STATE_ALARM 6 // In alarm state. Locks out all g-code processes. Allows settings access. 89 | #define STATE_CHECK_MODE 7 // G-code check mode. Locks out planner and motion only. 90 | // #define STATE_JOG 8 // Jogging mode is unique like homing. 91 | 92 | // Define global system variables 93 | typedef struct { 94 | uint8_t abort; // System abort flag. Forces exit back to main loop for reset. 95 | uint8_t state; // Tracks the current state of Grbl. 96 | volatile uint8_t execute; // Global system runtime executor bitflag variable. See EXEC bitmasks. 97 | int32_t position[N_AXIS]; // Real-time machine (aka home) position vector in steps. 98 | // NOTE: This may need to be a volatile variable, if problems arise. 99 | uint8_t auto_start; // Planner auto-start flag. Toggled off during feed hold. Defaulted by settings. 100 | } system_t; 101 | extern system_t sys; 102 | 103 | // Read a floating point value from a string. Line points to the input buffer, char_counter 104 | // is the indexer pointing to the current character of the line, while float_ptr is 105 | // a pointer to the result variable. Returns true when it succeeds 106 | int read_float(char *line, uint8_t *char_counter, float *float_ptr); 107 | 108 | // Delays variable-defined milliseconds. Compiler compatibility fix for _delay_ms(). 109 | //void delay_ms(uint16_t ms); 110 | 111 | // Delays variable-defined microseconds. Compiler compatibility fix for _delay_us(). 112 | //void delay_us(uint32_t us); 113 | 114 | // Syncs Grbl's gcode and planner position variables with the system position. 115 | void sys_sync_current_position(void); 116 | 117 | #endif 118 | -------------------------------------------------------------------------------- /user/cnc/nuts_bolts.c: -------------------------------------------------------------------------------- 1 | /* 2 | nuts_bolts.c - Shared functions 3 | Part of Grbl 4 | 5 | The MIT License (MIT) 6 | 7 | GRBL(tm) - Embedded CNC g-code interpreter and motion-controller 8 | Copyright (c) 2009-2011 Simen Svale Skogsrud 9 | Copyright (c) 2011-2012 Sungeun K. Jeon 10 | 11 | Permission is hereby granted, free of charge, to any person obtaining a copy 12 | of this software and associated documentation files (the "Software"), to deal 13 | in the Software without restriction, including without limitation the rights 14 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 15 | copies of the Software, and to permit persons to whom the Software is 16 | furnished to do so, subject to the following conditions: 17 | 18 | The above copyright notice and this permission notice shall be included in 19 | all copies or substantial portions of the Software. 20 | 21 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 22 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 23 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 24 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 25 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 26 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 27 | THE SOFTWARE. 28 | */ 29 | #include "stm32f10x.h" 30 | //#include "delay.h" 31 | //#include 32 | #include "nuts_bolts.h" 33 | #include "gcode.h" 34 | #include "planner.h" 35 | #include "usart.h" 36 | 37 | #define MAX_INT_DIGITS 32 // Maximum number of digits in int32 (and float) 38 | 39 | // Extracts a floating point value from a string. The following code is based loosely on 40 | // the avr-libc strtod() function by Michael Stumpf and Dmitry Xmelkov and many freely 41 | // available conversion method examples, but has been highly optimized for Grbl. For known 42 | // CNC applications, the typical decimal value is expected to be in the range of E0 to E-4. 43 | // Scientific notation is officially not supported by g-code, and the 'E' character may 44 | // be a g-code word on some CNC systems. So, 'E' notation will not be recognized. 45 | // NOTE: Thanks to Radu-Eosif Mihailescu for identifying the issues with using strtod(). 46 | int read_float(char *line, uint8_t *char_counter, float *float_ptr) 47 | { 48 | char *ptr = line + *char_counter; 49 | unsigned char c; 50 | 51 | // Grab first character and increment pointer. No spaces assumed in line. 52 | c = *ptr++; 53 | 54 | // Capture initial positive/minus character 55 | bool isnegative = false; 56 | if (c == '-') { 57 | isnegative = true; 58 | c = *ptr++; 59 | } else if (c == '+') { 60 | c = *ptr++; 61 | } 62 | 63 | // Extract number into fast integer. Track decimal in terms of exponent value. 64 | uint32_t intval = 0; 65 | int8_t exp = 0; 66 | uint8_t ndigit = 0; 67 | bool isdecimal = false; 68 | while(1) { 69 | //printf("c=%c\r\n",c); 70 | c -= '0'; 71 | if (c <= 9) { 72 | ndigit++; 73 | if (ndigit <= MAX_INT_DIGITS) { 74 | if (isdecimal) { exp--; } 75 | intval = (((intval << 2) + intval) << 1) + c; // intval*10 + c 76 | } else { 77 | if (!(isdecimal)) { exp++; } // Drop overflow digits 78 | } 79 | } else if (c == (('.'-'0') & 0xff) && !(isdecimal)) { 80 | isdecimal = true; 81 | } else { 82 | break; 83 | } 84 | c = *ptr++; 85 | } 86 | 87 | // Return if no digits have been read. 88 | if (!ndigit) { return(false); }; 89 | 90 | // Convert integer into floating point. 91 | float fval; 92 | fval = (float)intval; 93 | 94 | // Apply decimal. Should perform no more than two floating point multiplications for the 95 | // expected range of E0 to E-4. 96 | if (fval != 0) { 97 | while (exp <= -2) { 98 | fval *= 0.01; 99 | exp += 2; 100 | } 101 | if (exp < 0) { 102 | fval *= 0.1; 103 | } else if (exp > 0) { 104 | do { 105 | fval *= 10.0; 106 | } while (--exp > 0); 107 | } 108 | } 109 | 110 | // Assign floating point value with correct sign. 111 | if (isnegative) { 112 | *float_ptr = -fval; 113 | } else { 114 | *float_ptr = fval; 115 | } 116 | 117 | *char_counter = ptr - line - 1; // Set char_counter to next statement 118 | 119 | return(true); 120 | } 121 | 122 | 123 | // Delays variable defined milliseconds. Compiler compatibility fix for _delay_ms(), 124 | // which only accepts constants in future compiler releases. 125 | //void delay_ms(uint16_t ms) 126 | //{ 127 | // while ( ms-- ) { delay_ms(1); } 128 | //} 129 | 130 | 131 | // Delays variable defined microseconds. Compiler compatibility fix for _delay_us(), 132 | // which only accepts constants in future compiler releases. Written to perform more 133 | // efficiently with larger delays, as the counter adds parasitic time in each iteration. 134 | //void delay_us(uint32_t us) 135 | //{ 136 | // while (us) { 137 | // if (us < 10) { 138 | // delay_us(1); 139 | // us--; 140 | // } else if (us < 100) { 141 | // delay_us(10); 142 | // us -= 10; 143 | // } else if (us < 1000) { 144 | // delay_us(100); 145 | // us -= 100; 146 | // } else { 147 | // delay_ms(1); 148 | // us -= 1000; 149 | // } 150 | // } 151 | //} 152 | 153 | // Syncs all internal position vectors to the current system position. 154 | void sys_sync_current_position(void) 155 | { 156 | plan_set_current_position(sys.position[X_AXIS],sys.position[Y_AXIS],sys.position[Z_AXIS]); 157 | gc_set_current_position(sys.position[X_AXIS],sys.position[Y_AXIS],sys.position[Z_AXIS]); 158 | } 159 | -------------------------------------------------------------------------------- /user/cnc/eepromavr.c: -------------------------------------------------------------------------------- 1 | // This file has been prepared for Doxygen automatic documentation generation. 2 | /*! \file ******************************************************************** 3 | * 4 | * Atmel Corporation 5 | * 6 | * \li File: eeprom.c 7 | * \li Compiler: IAR EWAAVR 3.10c 8 | * \li Support mail: avr@atmel.com 9 | * 10 | * \li Supported devices: All devices with split EEPROM erase/write 11 | * capabilities can be used. 12 | * The example is written for ATmega48. 13 | * 14 | * \li AppNote: AVR103 - Using the EEPROM Programming Modes. 15 | * 16 | * \li Description: Example on how to use the split EEPROM erase/write 17 | * capabilities in e.g. ATmega48. All EEPROM 18 | * programming modes are tested, i.e. Erase+Write, 19 | * Erase-only and Write-only. 20 | * 21 | * $Revision: 1.6 $ 22 | * $Date: Friday, February 11, 2005 07:16:44 UTC $ 23 | ****************************************************************************/ 24 | #include "stm32f10x.h" 25 | //#include 26 | //#include 27 | 28 | /* These EEPROM bits have different names on different devices. */ 29 | #ifndef EEPE 30 | #define EEPE EEWE //!< EEPROM program/write enable. 31 | #define EEMPE EEMWE //!< EEPROM master program/write enable. 32 | #endif 33 | 34 | /* These two are unfortunately not defined in the device include files. */ 35 | #define EEPM1 5 //!< EEPROM Programming Mode Bit 1. 36 | #define EEPM0 4 //!< EEPROM Programming Mode Bit 0. 37 | 38 | /* Define to reduce code size. */ 39 | #define EEPROM_IGNORE_SELFPROG //!< Remove SPM flag polling. 40 | 41 | /*! \brief Read byte from EEPROM. 42 | * 43 | * This function reads one byte from a given EEPROM address. 44 | * 45 | * \note The CPU is halted for 4 clock cycles during EEPROM read. 46 | * 47 | * \param addr EEPROM address to read from. 48 | * \return The byte read from the EEPROM address. 49 | */ 50 | unsigned char eeprom_get_char( unsigned int addr ) 51 | { 52 | // do {} while( EECR & (1< 0; size--) { 135 | checksum = (checksum << 1) || (checksum >> 7); 136 | checksum += *source; 137 | eeprom_put_char(destination++, *(source++)); 138 | } 139 | eeprom_put_char(destination, checksum); 140 | } 141 | 142 | int memcpy_from_eeprom_with_checksum(char *destination, unsigned int source, unsigned int size) { 143 | unsigned char data, checksum = 0; 144 | for(; size > 0; size--) { 145 | data = eeprom_get_char(source++); 146 | checksum = (checksum << 1) || (checksum >> 7); 147 | checksum += data; 148 | *(destination++) = data; 149 | } 150 | return(checksum == eeprom_get_char(source)); 151 | } 152 | 153 | // end of file 154 | -------------------------------------------------------------------------------- /lib/stm32f10x_exti.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_exti.h 4 | * @author MCD Application Team 5 | * @version V3.0.0 6 | * @date 04/06/2009 7 | * @brief This file contains all the functions prototypes for the EXTI 8 | * firmware library. 9 | ****************************************************************************** 10 | * @copy 11 | * 12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 18 | * 19 | *

© COPYRIGHT 2009 STMicroelectronics

20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __STM32F10x_EXTI_H 24 | #define __STM32F10x_EXTI_H 25 | 26 | /* Includes ------------------------------------------------------------------*/ 27 | #include "stm32f10x.h" 28 | 29 | /** @addtogroup StdPeriph_Driver 30 | * @{ 31 | */ 32 | 33 | /** @addtogroup EXTI 34 | * @{ 35 | */ 36 | 37 | /** @defgroup EXTI_Exported_Types 38 | * @{ 39 | */ 40 | 41 | /** 42 | * @brief EXTI mode enumeration 43 | */ 44 | 45 | typedef enum 46 | { 47 | EXTI_Mode_Interrupt = 0x00, 48 | EXTI_Mode_Event = 0x04 49 | }EXTIMode_TypeDef; 50 | 51 | #define IS_EXTI_MODE(MODE) (((MODE) == EXTI_Mode_Interrupt) || ((MODE) == EXTI_Mode_Event)) 52 | 53 | /** 54 | * @brief EXTI Trigger enumeration 55 | */ 56 | 57 | typedef enum 58 | { 59 | EXTI_Trigger_Rising = 0x08, 60 | EXTI_Trigger_Falling = 0x0C, 61 | EXTI_Trigger_Rising_Falling = 0x10 62 | }EXTITrigger_TypeDef; 63 | 64 | #define IS_EXTI_TRIGGER(TRIGGER) (((TRIGGER) == EXTI_Trigger_Rising) || \ 65 | ((TRIGGER) == EXTI_Trigger_Falling) || \ 66 | ((TRIGGER) == EXTI_Trigger_Rising_Falling)) 67 | /** 68 | * @brief EXTI Init Structure definition 69 | */ 70 | 71 | typedef struct 72 | { 73 | uint32_t EXTI_Line; 74 | EXTIMode_TypeDef EXTI_Mode; 75 | EXTITrigger_TypeDef EXTI_Trigger; 76 | FunctionalState EXTI_LineCmd; 77 | }EXTI_InitTypeDef; 78 | 79 | /** 80 | * @} 81 | */ 82 | 83 | /** @defgroup EXTI_Exported_Constants 84 | * @{ 85 | */ 86 | 87 | /** @defgroup EXTI_Lines 88 | * @{ 89 | */ 90 | 91 | #define EXTI_Line0 ((uint32_t)0x00001) /* External interrupt line 0 */ 92 | #define EXTI_Line1 ((uint32_t)0x00002) /* External interrupt line 1 */ 93 | #define EXTI_Line2 ((uint32_t)0x00004) /* External interrupt line 2 */ 94 | #define EXTI_Line3 ((uint32_t)0x00008) /* External interrupt line 3 */ 95 | #define EXTI_Line4 ((uint32_t)0x00010) /* External interrupt line 4 */ 96 | #define EXTI_Line5 ((uint32_t)0x00020) /* External interrupt line 5 */ 97 | #define EXTI_Line6 ((uint32_t)0x00040) /* External interrupt line 6 */ 98 | #define EXTI_Line7 ((uint32_t)0x00080) /* External interrupt line 7 */ 99 | #define EXTI_Line8 ((uint32_t)0x00100) /* External interrupt line 8 */ 100 | #define EXTI_Line9 ((uint32_t)0x00200) /* External interrupt line 9 */ 101 | #define EXTI_Line10 ((uint32_t)0x00400) /* External interrupt line 10 */ 102 | #define EXTI_Line11 ((uint32_t)0x00800) /* External interrupt line 11 */ 103 | #define EXTI_Line12 ((uint32_t)0x01000) /* External interrupt line 12 */ 104 | #define EXTI_Line13 ((uint32_t)0x02000) /* External interrupt line 13 */ 105 | #define EXTI_Line14 ((uint32_t)0x04000) /* External interrupt line 14 */ 106 | #define EXTI_Line15 ((uint32_t)0x08000) /* External interrupt line 15 */ 107 | #define EXTI_Line16 ((uint32_t)0x10000) /* External interrupt line 16 108 | Connected to the PVD Output */ 109 | #define EXTI_Line17 ((uint32_t)0x20000) /* External interrupt line 17 110 | Connected to the RTC Alarm event */ 111 | #define EXTI_Line18 ((uint32_t)0x40000) /* External interrupt line 18 112 | Connected to the USB Wakeup from 113 | suspend event */ 114 | 115 | #define IS_EXTI_LINE(LINE) ((((LINE) & (uint32_t)0xFFF80000) == 0x00) && ((LINE) != (uint16_t)0x00)) 116 | 117 | #define IS_GET_EXTI_LINE(LINE) (((LINE) == EXTI_Line0) || ((LINE) == EXTI_Line1) || \ 118 | ((LINE) == EXTI_Line2) || ((LINE) == EXTI_Line3) || \ 119 | ((LINE) == EXTI_Line4) || ((LINE) == EXTI_Line5) || \ 120 | ((LINE) == EXTI_Line6) || ((LINE) == EXTI_Line7) || \ 121 | ((LINE) == EXTI_Line8) || ((LINE) == EXTI_Line9) || \ 122 | ((LINE) == EXTI_Line10) || ((LINE) == EXTI_Line11) || \ 123 | ((LINE) == EXTI_Line12) || ((LINE) == EXTI_Line13) || \ 124 | ((LINE) == EXTI_Line14) || ((LINE) == EXTI_Line15) || \ 125 | ((LINE) == EXTI_Line16) || ((LINE) == EXTI_Line17) || \ 126 | ((LINE) == EXTI_Line18)) 127 | 128 | /** 129 | * @} 130 | */ 131 | 132 | /** 133 | * @} 134 | */ 135 | 136 | /** @defgroup EXTI_Exported_Macros 137 | * @{ 138 | */ 139 | 140 | /** 141 | * @} 142 | */ 143 | 144 | /** @defgroup EXTI_Exported_Functions 145 | * @{ 146 | */ 147 | 148 | void EXTI_DeInit(void); 149 | void EXTI_Init(EXTI_InitTypeDef* EXTI_InitStruct); 150 | void EXTI_StructInit(EXTI_InitTypeDef* EXTI_InitStruct); 151 | void EXTI_GenerateSWInterrupt(uint32_t EXTI_Line); 152 | FlagStatus EXTI_GetFlagStatus(uint32_t EXTI_Line); 153 | void EXTI_ClearFlag(uint32_t EXTI_Line); 154 | ITStatus EXTI_GetITStatus(uint32_t EXTI_Line); 155 | void EXTI_ClearITPendingBit(uint32_t EXTI_Line); 156 | 157 | #endif /* __STM32F10x_EXTI_H */ 158 | /** 159 | * @} 160 | */ 161 | 162 | /** 163 | * @} 164 | */ 165 | 166 | /** 167 | * @} 168 | */ 169 | 170 | /******************* (C) COPYRIGHT 2009 STMicroelectronics *****END OF FILE****/ 171 | -------------------------------------------------------------------------------- /user/cnc/README.md: -------------------------------------------------------------------------------- 1 | #Grbl - An embedded g-code interpreter and motion-controller for the Arduino/AVR328 microcontroller 2 | ------------ 3 | 4 | Grbl is a no-compromise, high performance, low cost alternative to parallel-port-based motion control for CNC milling. It will run on a vanilla Arduino (Duemillanove/Uno) as long as it sports an Atmega 328. 5 | 6 | The controller is written in highly optimized C utilizing every clever feature of the AVR-chips to achieve precise timing and asynchronous operation. It is able to maintain up to 30kHz of stable, jitter free control pulses. 7 | 8 | It accepts standards-compliant G-code and has been tested with the output of several CAM tools with no problems. Arcs, circles and helical motion are fully supported, as well as, other basic functional g-code commands. Functions and variables are not currently supported, but may be included in future releases in a form of a pre-processor. 9 | 10 | Grbl includes full acceleration management with look ahead. That means the controller will look up to 18 motions into the future and plan its velocities ahead to deliver smooth acceleration and jerk-free cornering. 11 | 12 | * Note on licensing: Grbl has been re-licensed to the MIT software license. Please see the COPYING text for details. 13 | 14 | * For more information and help, check out our **[Wiki pages!](https://github.com/grbl/grbl/wiki)** If you find that the information is out-dated, please to help us keep it updated by editing it or notifying our community! Thanks! 15 | 16 | * Grbl may now be easily compiled and installed directly through the Arduino IDE! See the Wiki to learn how to do it. 17 | 18 | * Lead Developers: Sonny Jeon, Ph.D. (2011-2014) and Simen Svale Skogsrud, a.k.a the O.G. (2009-2011) 19 | 20 | ##Downloads (Right-Click and Save-Link-As): 21 | _**Master Branch:**_ 22 | * [Grbl v0.8c Atmega328p 16mhz 9600baud](http://bit.ly/SSdCJE) (Last updated: 2014-07-03) 23 | - 2014-07-03: G18 reporting fix. 24 | - 2013-12-07: G18 and serial volatile fixes. 25 | - 2013-04-05: Line buffer increased and overflow feedback added. 26 | 27 | _**Edge/Development Branch:**_ 28 | * [Grbl v0.9g Build 2014-08-13](http://bit.ly/1Bfza9D) : Edge Branch 29 | - **BETA!** Bugs may exist. Please let us know of any bugs so we can quickly fix them and push this to master! 30 | - **IMPORTANT:** Baudrate is now 115200 (Up from 9600). Settings WILL be overwritten. Please make sure you have a backup. Also, settings have been renumbered and some have changed how they work. See our Wiki for details. 31 | - New super smooth stepping algorithm and (4x) planner optimizations and speed. 32 | - Stability and robustness updates that allow you now put the pedal to the metal (up to 10x speed.) 33 | - Independent axes settings and dynamic scaling for acceleration, max velocity, and travel. 34 | - Automatic arc segment scaling by tolerance setting, leading to an order of magnitude faster feedrates about them. 35 | - Completely overhauled g-code parser with 100%* g-code compliance and error checking. 36 | - Grbl SIMULATOR: Directly compile a virtual Grbl into an executable that doesn't require an Arduino! 37 | - Other stuff: Soft limits, probing, tool length offsets, status reporting mask and new data, CPU pin mapping, updated homing routine. 38 | - Optional features: Limit pin sharing, variable spindle speed output, line number tracking, real-time feed rate reporting, and more! 39 | 40 | 41 | _**Archives:**_ 42 | * [Grbl v0.8a Atmega328p 16mhz 9600baud](http://bit.ly/TVCTVv) 43 | * [Grbl v0.7d Atmega328p 16mhz 9600baud](http://bit.ly/ZhL15G) 44 | * [Grbl v0.6b Atmega328p 16mhz 9600baud](http://bit.ly/VD04A5) 45 | * [Grbl v0.6b Atmega168 16mhz 9600baud](http://bit.ly/SScWnE) 46 | * [Grbl v0.51 Atmega328p 16mhz 9600baud](http://bit.ly/W75BS1) 47 | * [Grbl v0.51 Atmega168 16mhz 9600baud](http://bit.ly/VXyrYu) 48 | 49 | 50 | ##Changelog for v0.8 from v0.7: 51 | - Major structural overhaul to allow for multi-tasking events and new feature sets. 52 | - Run-time command control: Feed hold (pause), Cycle start (resume), Reset (abort), Status reporting (current position and state). 53 | - Controlled feed hold with deceleration to ensure no skipped steps and loss of location. 54 | - After feed hold, cycle accelerations are re-planned and may be resumed. 55 | - Advanced homing cycle with direction and speed configuration options. (Requires limit switches.) When enabled, homing is required before use to ensure safety. 56 | - Limit pins are held normal high with internal pull-up resistors. Wiring only requires a normally-open switch connected to ground. (For both ends of an axis, simply wire two in parallel into the same pin.) 57 | - Hard limits option and plays nice with homing cycle, so switches can be used for both homing and hard limits. 58 | - A check g-code mode has also been added to allow users to error check their programs. 59 | - Re-factored g-code parser with robust error-checking. 60 | - 6 work coordinate systems (G54-G59), offsets(G92), and machine coordinate system support. Work coordinate systems are stored in EEPROM and persistent. 61 | - G10 L2 and L20 work coordinate settings support. L2 sets one or more axes values. L20 sets the current machine position to the specified work origin. 62 | - G28.1 and G30.1 set home position support. These set the internal EEPROM parameter values to the current machine position. (G28 and G30 no longer perform homing cycle, '$H' does. They move to these stored positions.) 63 | - Program stop(M0,M2,M30) support. 64 | - Coolant control(M7*,M8,M9) support. (M7 is a compile-time option). 65 | - G-code parser state and '#' parameters feedback. 66 | - System reset re-initializes grbl without resetting the Arduino and retains machine/home position and work coordinates. 67 | - Settings overhauled and dozens of new settings and internal commands are now available, when most were compile-time only. 68 | - New startup line setting. Allows users to store a custom g-code block into Grbl's startup routine. Executes immediately upon startup or reset. May be used to set g-code defaults like G20/G21. 69 | - Pin-outs of the cycle-start, feed-hold, and soft-reset runtime commands on pins A0-A2. 70 | - Misc bug fixes and removed deprecated acceleration enabled code. 71 | - Advanced compile-time options: XON/XOFF flow control (limited support), direction and step pulse time delay, up to 5 startup lines, and homing sequence configurability. 72 | 73 | 74 | *Important note for Atmega 168 users:* Going forward, support for Atmega 168 will be dropped due to its limited memory and speed. However, legacy Grbl v0.51 "in the branch called 'v0_51' is still available for use. 75 | 76 | _The project was initially inspired by the Arduino GCode Interpreter by Mike Ellery_ 77 | 78 | ------------- 79 | Grbl is an open-source project and fueled by the free-time of our intrepid administrators and altruistic users. If you'd like to donate, all proceeds will be used to help fund supporting hardware and testing equipment. Thank you! 80 | 81 | [![Donate](https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=EBQWAWQAAT878) 82 | -------------------------------------------------------------------------------- /lib/stm32f10x_bkp.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_bkp.h 4 | * @author MCD Application Team 5 | * @version V3.0.0 6 | * @date 04/06/2009 7 | * @brief This file contains all the functions prototypes for the BKP firmware 8 | * library. 9 | ****************************************************************************** 10 | * @copy 11 | * 12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 18 | * 19 | *

© COPYRIGHT 2009 STMicroelectronics

20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __STM32F10x_BKP_H 24 | #define __STM32F10x_BKP_H 25 | 26 | /* Includes ------------------------------------------------------------------*/ 27 | #include "stm32f10x.h" 28 | 29 | /** @addtogroup StdPeriph_Driver 30 | * @{ 31 | */ 32 | 33 | /** @addtogroup BKP 34 | * @{ 35 | */ 36 | 37 | /** @defgroup BKP_Exported_Types 38 | * @{ 39 | */ 40 | 41 | /** 42 | * @} 43 | */ 44 | 45 | /** @defgroup BKP_Exported_Constants 46 | * @{ 47 | */ 48 | 49 | /** @defgroup Tamper_Pin_active_level 50 | * @{ 51 | */ 52 | 53 | #define BKP_TamperPinLevel_High ((uint16_t)0x0000) 54 | #define BKP_TamperPinLevel_Low ((uint16_t)0x0001) 55 | #define IS_BKP_TAMPER_PIN_LEVEL(LEVEL) (((LEVEL) == BKP_TamperPinLevel_High) || \ 56 | ((LEVEL) == BKP_TamperPinLevel_Low)) 57 | /** 58 | * @} 59 | */ 60 | 61 | /** @defgroup RTC_output_source_to_output_on_the_Tamper_pin 62 | * @{ 63 | */ 64 | 65 | #define BKP_RTCOutputSource_None ((uint16_t)0x0000) 66 | #define BKP_RTCOutputSource_CalibClock ((uint16_t)0x0080) 67 | #define BKP_RTCOutputSource_Alarm ((uint16_t)0x0100) 68 | #define BKP_RTCOutputSource_Second ((uint16_t)0x0300) 69 | #define IS_BKP_RTC_OUTPUT_SOURCE(SOURCE) (((SOURCE) == BKP_RTCOutputSource_None) || \ 70 | ((SOURCE) == BKP_RTCOutputSource_CalibClock) || \ 71 | ((SOURCE) == BKP_RTCOutputSource_Alarm) || \ 72 | ((SOURCE) == BKP_RTCOutputSource_Second)) 73 | /** 74 | * @} 75 | */ 76 | 77 | /** @defgroup Data_Backup_Register 78 | * @{ 79 | */ 80 | 81 | #define BKP_DR1 ((uint16_t)0x0004) 82 | #define BKP_DR2 ((uint16_t)0x0008) 83 | #define BKP_DR3 ((uint16_t)0x000C) 84 | #define BKP_DR4 ((uint16_t)0x0010) 85 | #define BKP_DR5 ((uint16_t)0x0014) 86 | #define BKP_DR6 ((uint16_t)0x0018) 87 | #define BKP_DR7 ((uint16_t)0x001C) 88 | #define BKP_DR8 ((uint16_t)0x0020) 89 | #define BKP_DR9 ((uint16_t)0x0024) 90 | #define BKP_DR10 ((uint16_t)0x0028) 91 | #define BKP_DR11 ((uint16_t)0x0040) 92 | #define BKP_DR12 ((uint16_t)0x0044) 93 | #define BKP_DR13 ((uint16_t)0x0048) 94 | #define BKP_DR14 ((uint16_t)0x004C) 95 | #define BKP_DR15 ((uint16_t)0x0050) 96 | #define BKP_DR16 ((uint16_t)0x0054) 97 | #define BKP_DR17 ((uint16_t)0x0058) 98 | #define BKP_DR18 ((uint16_t)0x005C) 99 | #define BKP_DR19 ((uint16_t)0x0060) 100 | #define BKP_DR20 ((uint16_t)0x0064) 101 | #define BKP_DR21 ((uint16_t)0x0068) 102 | #define BKP_DR22 ((uint16_t)0x006C) 103 | #define BKP_DR23 ((uint16_t)0x0070) 104 | #define BKP_DR24 ((uint16_t)0x0074) 105 | #define BKP_DR25 ((uint16_t)0x0078) 106 | #define BKP_DR26 ((uint16_t)0x007C) 107 | #define BKP_DR27 ((uint16_t)0x0080) 108 | #define BKP_DR28 ((uint16_t)0x0084) 109 | #define BKP_DR29 ((uint16_t)0x0088) 110 | #define BKP_DR30 ((uint16_t)0x008C) 111 | #define BKP_DR31 ((uint16_t)0x0090) 112 | #define BKP_DR32 ((uint16_t)0x0094) 113 | #define BKP_DR33 ((uint16_t)0x0098) 114 | #define BKP_DR34 ((uint16_t)0x009C) 115 | #define BKP_DR35 ((uint16_t)0x00A0) 116 | #define BKP_DR36 ((uint16_t)0x00A4) 117 | #define BKP_DR37 ((uint16_t)0x00A8) 118 | #define BKP_DR38 ((uint16_t)0x00AC) 119 | #define BKP_DR39 ((uint16_t)0x00B0) 120 | #define BKP_DR40 ((uint16_t)0x00B4) 121 | #define BKP_DR41 ((uint16_t)0x00B8) 122 | #define BKP_DR42 ((uint16_t)0x00BC) 123 | 124 | #define IS_BKP_DR(DR) (((DR) == BKP_DR1) || ((DR) == BKP_DR2) || ((DR) == BKP_DR3) || \ 125 | ((DR) == BKP_DR4) || ((DR) == BKP_DR5) || ((DR) == BKP_DR6) || \ 126 | ((DR) == BKP_DR7) || ((DR) == BKP_DR8) || ((DR) == BKP_DR9) || \ 127 | ((DR) == BKP_DR10) || ((DR) == BKP_DR11) || ((DR) == BKP_DR12) || \ 128 | ((DR) == BKP_DR13) || ((DR) == BKP_DR14) || ((DR) == BKP_DR15) || \ 129 | ((DR) == BKP_DR16) || ((DR) == BKP_DR17) || ((DR) == BKP_DR18) || \ 130 | ((DR) == BKP_DR19) || ((DR) == BKP_DR20) || ((DR) == BKP_DR21) || \ 131 | ((DR) == BKP_DR22) || ((DR) == BKP_DR23) || ((DR) == BKP_DR24) || \ 132 | ((DR) == BKP_DR25) || ((DR) == BKP_DR26) || ((DR) == BKP_DR27) || \ 133 | ((DR) == BKP_DR28) || ((DR) == BKP_DR29) || ((DR) == BKP_DR30) || \ 134 | ((DR) == BKP_DR31) || ((DR) == BKP_DR32) || ((DR) == BKP_DR33) || \ 135 | ((DR) == BKP_DR34) || ((DR) == BKP_DR35) || ((DR) == BKP_DR36) || \ 136 | ((DR) == BKP_DR37) || ((DR) == BKP_DR38) || ((DR) == BKP_DR39) || \ 137 | ((DR) == BKP_DR40) || ((DR) == BKP_DR41) || ((DR) == BKP_DR42)) 138 | 139 | #define IS_BKP_CALIBRATION_VALUE(VALUE) ((VALUE) <= 0x7F) 140 | /** 141 | * @} 142 | */ 143 | 144 | /** 145 | * @} 146 | */ 147 | 148 | /** @defgroup BKP_Exported_Macros 149 | * @{ 150 | */ 151 | 152 | /** 153 | * @} 154 | */ 155 | 156 | /** @defgroup BKP_Exported_Functions 157 | * @{ 158 | */ 159 | 160 | void BKP_DeInit(void); 161 | void BKP_TamperPinLevelConfig(uint16_t BKP_TamperPinLevel); 162 | void BKP_TamperPinCmd(FunctionalState NewState); 163 | void BKP_ITConfig(FunctionalState NewState); 164 | void BKP_RTCOutputConfig(uint16_t BKP_RTCOutputSource); 165 | void BKP_SetRTCCalibrationValue(uint8_t CalibrationValue); 166 | void BKP_WriteBackupRegister(uint16_t BKP_DR, uint16_t Data); 167 | uint16_t BKP_ReadBackupRegister(uint16_t BKP_DR); 168 | FlagStatus BKP_GetFlagStatus(void); 169 | void BKP_ClearFlag(void); 170 | ITStatus BKP_GetITStatus(void); 171 | void BKP_ClearITPendingBit(void); 172 | 173 | #endif /* __STM32F10x_BKP_H */ 174 | /** 175 | * @} 176 | */ 177 | 178 | /** 179 | * @} 180 | */ 181 | 182 | /** 183 | * @} 184 | */ 185 | 186 | /******************* (C) COPYRIGHT 2009 STMicroelectronics *****END OF FILE****/ 187 | -------------------------------------------------------------------------------- /user/cnc/pin_map.h: -------------------------------------------------------------------------------- 1 | /* 2 | pin_map.h - Pin mapping configuration file 3 | Part of Grbl 4 | 5 | The MIT License (MIT) 6 | 7 | GRBL(tm) - Embedded CNC g-code interpreter and motion-controller 8 | Copyright (c) 2013 Sungeun K. Jeon 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining a copy 11 | of this software and associated documentation files (the "Software"), to deal 12 | in the Software without restriction, including without limitation the rights 13 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the Software is 15 | furnished to do so, subject to the following conditions: 16 | 17 | The above copyright notice and this permission notice shall be included in 18 | all copies or substantial portions of the Software. 19 | 20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 26 | THE SOFTWARE. 27 | */ 28 | 29 | /* The pin_map.h file serves as a central pin mapping settings file for different processor 30 | types, i.e. AVR 328p or AVR Mega 2560. Grbl officially supports the Arduino Uno, but the 31 | other supplied pin mappings are supplied by users, so your results may vary. */ 32 | 33 | #ifndef pin_map_h 34 | #define pin_map_h 35 | 36 | #include "coolant_control.h" 37 | 38 | #ifdef PIN_MAP_ARDUINO_UNO // AVR 328p, Officially supported by Grbl. 39 | 40 | // Serial port pins 41 | #define SERIAL_RX USART_RX_vect 42 | #define SERIAL_UDRE USART_UDRE_vect 43 | 44 | // NOTE: All step bit and direction pins must be on the same port. 45 | #define STEPPING_DDR DDRD 46 | #define STEPPING_PORT PORTD 47 | #define X_STEP_BIT 2 // Uno Digital Pin 2 48 | #define Y_STEP_BIT 3 // Uno Digital Pin 3 49 | #define Z_STEP_BIT 4 // Uno Digital Pin 4 50 | #define X_DIRECTION_BIT 5 // Uno Digital Pin 5 51 | #define Y_DIRECTION_BIT 6 // Uno Digital Pin 6 52 | #define Z_DIRECTION_BIT 7 // Uno Digital Pin 7 53 | #define STEP_MASK ((1< 31 | #include "protocol.h" 32 | #include "report.h" 33 | #include "stepper.h" 34 | #include "nuts_bolts.h" 35 | #include "settings.h" 36 | #include "eepromavr.h" 37 | #include "eeprom.h" 38 | #include "limits.h" 39 | 40 | settings_t settings; 41 | 42 | // Version 4 outdated settings record 43 | typedef struct { 44 | float steps_per_mm[3]; 45 | uint8_t microsteps; 46 | uint8_t pulse_microseconds; 47 | float default_feed_rate; 48 | float default_seek_rate; 49 | uint8_t invert_mask; 50 | float mm_per_arc_segment; 51 | float acceleration; 52 | float junction_deviation; 53 | } settings_v4_t; 54 | 55 | 56 | 57 | // Method to store startup lines into EEPROM 58 | void settings_store_startup_line(uint8_t n, char *line) 59 | { 60 | uint16_t addr = n*(LINE_BUFFER_SIZE+1)+EEPROM_ADDR_STARTUP_BLOCK; 61 | memcpy_to_eeprom_with_checksum(addr,(char*)line, LINE_BUFFER_SIZE); 62 | } 63 | 64 | // Method to store coord data parameters into EEPROM 65 | void settings_write_coord_data(uint8_t coord_select, float *coord_data) 66 | { 67 | uint16_t addr = coord_select*(sizeof(float)*N_AXIS+1) + EEPROM_ADDR_PARAMETERS; 68 | memcpy_to_eeprom_with_checksum(addr,(char*)coord_data, sizeof(float)*N_AXIS); 69 | } 70 | 71 | // Method to store Grbl global settings struct and version number into EEPROM 72 | void write_global_settings() 73 | { 74 | eeprom_put_char(0, SETTINGS_VERSION); 75 | memcpy_to_eeprom_with_checksum(EEPROM_ADDR_GLOBAL, (char*)&settings, sizeof(settings_t)); 76 | } 77 | 78 | // Method to reset Grbl global settings back to defaults. 79 | void settings_reset(bool reset_all) { 80 | // Reset all settings or only the migration settings to the new version. 81 | if (reset_all) { 82 | settings.steps_per_mm[X_AXIS] = DEFAULT_X_STEPS_PER_MM; 83 | settings.steps_per_mm[Y_AXIS] = DEFAULT_Y_STEPS_PER_MM; 84 | settings.steps_per_mm[Z_AXIS] = DEFAULT_Z_STEPS_PER_MM; 85 | settings.pulse_microseconds = DEFAULT_STEP_PULSE_MICROSECONDS; 86 | settings.default_feed_rate = DEFAULT_FEEDRATE; 87 | settings.default_seek_rate = DEFAULT_RAPID_FEEDRATE; 88 | settings.acceleration = DEFAULT_ACCELERATION; 89 | settings.mm_per_arc_segment = DEFAULT_MM_PER_ARC_SEGMENT; 90 | settings.invert_mask = DEFAULT_STEPPING_INVERT_MASK; 91 | settings.junction_deviation = DEFAULT_JUNCTION_DEVIATION; 92 | } 93 | // New settings since last version 94 | settings.flags = 0; 95 | if (DEFAULT_REPORT_INCHES) { settings.flags |= BITFLAG_REPORT_INCHES; } 96 | if (DEFAULT_AUTO_START) { settings.flags |= BITFLAG_AUTO_START; } 97 | if (DEFAULT_INVERT_ST_ENABLE) { settings.flags |= BITFLAG_INVERT_ST_ENABLE; } 98 | if (DEFAULT_HARD_LIMIT_ENABLE) { settings.flags |= BITFLAG_HARD_LIMIT_ENABLE; } 99 | if (DEFAULT_HOMING_ENABLE) { settings.flags |= BITFLAG_HOMING_ENABLE; } 100 | settings.homing_dir_mask = DEFAULT_HOMING_DIR_MASK; 101 | settings.homing_feed_rate = DEFAULT_HOMING_FEEDRATE; 102 | settings.homing_seek_rate = DEFAULT_HOMING_RAPID_FEEDRATE; 103 | settings.homing_debounce_delay = DEFAULT_HOMING_DEBOUNCE_DELAY; 104 | settings.homing_pulloff = DEFAULT_HOMING_PULLOFF; 105 | settings.stepper_idle_lock_time = DEFAULT_STEPPER_IDLE_LOCK_TIME; 106 | settings.decimal_places = DEFAULT_DECIMAL_PLACES; 107 | settings.n_arc_correction = DEFAULT_N_ARC_CORRECTION; 108 | write_global_settings(); 109 | } 110 | 111 | // Reads startup line from EEPROM. Updated pointed line string data. 112 | uint8_t settings_read_startup_line(uint8_t n, char *line) 113 | { 114 | uint16_t addr = n*(LINE_BUFFER_SIZE+1)+EEPROM_ADDR_STARTUP_BLOCK; 115 | if (!(memcpy_from_eeprom_with_checksum((char*)line, addr, LINE_BUFFER_SIZE))) { 116 | // Reset line with default value 117 | line[0] = 0; 118 | settings_store_startup_line(n, line); 119 | return(false); 120 | } else { 121 | return(true); 122 | } 123 | } 124 | 125 | // Read selected coordinate data from EEPROM. Updates pointed coord_data value. 126 | uint8_t settings_read_coord_data(uint8_t coord_select, float *coord_data) 127 | { 128 | uint16_t addr = coord_select*(sizeof(float)*N_AXIS+1) + EEPROM_ADDR_PARAMETERS; 129 | if (!(memcpy_from_eeprom_with_checksum((char*)coord_data, addr, sizeof(float)*N_AXIS))) { 130 | // Reset with default zero vector 131 | clear_vector_float(coord_data); 132 | settings_write_coord_data(coord_select,coord_data); 133 | return(false); 134 | } else { 135 | return(true); 136 | } 137 | } 138 | 139 | // Reads Grbl global settings struct from EEPROM. 140 | uint8_t read_global_settings() { 141 | // Check version-byte of eeprom 142 | uint8_t version = eeprom_get_char(0); 143 | 144 | if (version == SETTINGS_VERSION) { 145 | // Read settings-record and check checksum 146 | if (!(memcpy_from_eeprom_with_checksum((char*)&settings, EEPROM_ADDR_GLOBAL, sizeof(settings_t)))) { 147 | return(false); 148 | } 149 | } else { 150 | if (version <= 4) { 151 | // Migrate from settings version 4 to current version. 152 | if (!(memcpy_from_eeprom_with_checksum((char*)&settings, 1, sizeof(settings_v4_t)))) { 153 | return(false); 154 | } 155 | settings_reset(false); // Old settings ok. Write new settings only. 156 | } else { 157 | return(false); 158 | } 159 | } 160 | return(true); 161 | } 162 | 163 | 164 | // A helper method to set settings from command line 165 | uint8_t settings_store_global_setting(int parameter, float value) { 166 | switch(parameter) { 167 | case 0: case 1: case 2: 168 | if (value <= 0.0) { return(STATUS_SETTING_VALUE_NEG); } 169 | settings.steps_per_mm[parameter] = value; break; 170 | case 3: 171 | if (value < 3) { return(STATUS_SETTING_STEP_PULSE_MIN); } 172 | settings.pulse_microseconds = round(value); break; 173 | case 4: settings.default_feed_rate = value; break; 174 | case 5: settings.default_seek_rate = value; break; 175 | case 6: settings.invert_mask = trunc(value); break; 176 | case 7: settings.stepper_idle_lock_time = round(value); break; 177 | case 8: settings.acceleration = value*60*60; break; // Convert to mm/min^2 for grbl internal use. 178 | case 9: settings.junction_deviation = fabs(value); break; 179 | case 10: settings.mm_per_arc_segment = value; break; 180 | case 11: settings.n_arc_correction = round(value); break; 181 | case 12: settings.decimal_places = round(value); break; 182 | case 13: 183 | if (value) { settings.flags |= BITFLAG_REPORT_INCHES; } 184 | else { settings.flags &= ~BITFLAG_REPORT_INCHES; } 185 | break; 186 | case 14: // Reset to ensure change. Immediate re-init may cause problems. 187 | if (value) { settings.flags |= BITFLAG_AUTO_START; } 188 | else { settings.flags &= ~BITFLAG_AUTO_START; } 189 | break; 190 | case 15: // Reset to ensure change. Immediate re-init may cause problems. 191 | if (value) { settings.flags |= BITFLAG_INVERT_ST_ENABLE; } 192 | else { settings.flags &= ~BITFLAG_INVERT_ST_ENABLE; } 193 | break; 194 | case 16: 195 | if (value) { settings.flags |= BITFLAG_HARD_LIMIT_ENABLE; } 196 | else { settings.flags &= ~BITFLAG_HARD_LIMIT_ENABLE; } 197 | limits_init(); // Re-init to immediately change. NOTE: Nice to have but could be problematic later. 198 | break; 199 | case 17: 200 | if (value) { settings.flags |= BITFLAG_HOMING_ENABLE; } 201 | else { settings.flags &= ~BITFLAG_HOMING_ENABLE; } 202 | break; 203 | case 18: settings.homing_dir_mask = trunc(value); break; 204 | case 19: settings.homing_feed_rate = value; break; 205 | case 20: settings.homing_seek_rate = value; break; 206 | case 21: settings.homing_debounce_delay = round(value); break; 207 | case 22: settings.homing_pulloff = value; break; 208 | default: 209 | return(STATUS_INVALID_STATEMENT); 210 | } 211 | write_global_settings(); 212 | return(STATUS_OK); 213 | } 214 | 215 | // Initialize the config subsystem 216 | void settings_init() { 217 | if(!read_global_settings()) { 218 | report_status_message(STATUS_SETTING_READ_FAIL); 219 | settings_reset(true); 220 | report_grbl_settings(); 221 | } 222 | // Read all parameter data into a dummy variable. If error, reset to zero, otherwise do nothing. 223 | float coord_data[N_AXIS]; 224 | uint8_t i; 225 | for (i=0; i<=SETTING_INDEX_NCOORD; i++) { 226 | if (!settings_read_coord_data(i, coord_data)) { 227 | report_status_message(STATUS_SETTING_READ_FAIL); 228 | } 229 | } 230 | // NOTE: Startup lines are handled and called by main.c at the end of initialization. 231 | } 232 | -------------------------------------------------------------------------------- /lib/stm32f10x_dac.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f10x_dac.h 4 | * @author MCD Application Team 5 | * @version V3.0.0 6 | * @date 04/06/2009 7 | * @brief This file contains all the functions prototypes for the DAC firmware 8 | * library. 9 | ****************************************************************************** 10 | * @copy 11 | * 12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 18 | * 19 | *

© COPYRIGHT 2009 STMicroelectronics

20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __STM32F10x_DAC_H 24 | #define __STM32F10x_DAC_H 25 | 26 | /* Includes ------------------------------------------------------------------*/ 27 | #include "stm32f10x.h" 28 | 29 | /** @addtogroup StdPeriph_Driver 30 | * @{ 31 | */ 32 | 33 | /** @addtogroup DAC 34 | * @{ 35 | */ 36 | 37 | /** @defgroup DAC_Exported_Types 38 | * @{ 39 | */ 40 | 41 | /** 42 | * @brief DAC Init structure definition 43 | */ 44 | 45 | typedef struct 46 | { 47 | uint32_t DAC_Trigger; 48 | uint32_t DAC_WaveGeneration; 49 | uint32_t DAC_LFSRUnmask_TriangleAmplitude; 50 | uint32_t DAC_OutputBuffer; 51 | }DAC_InitTypeDef; 52 | 53 | /** 54 | * @} 55 | */ 56 | 57 | /** @defgroup DAC_Exported_Constants 58 | * @{ 59 | */ 60 | 61 | /** @defgroup DAC_trigger_selection 62 | * @{ 63 | */ 64 | 65 | #define DAC_Trigger_None ((uint32_t)0x00000000) 66 | #define DAC_Trigger_T6_TRGO ((uint32_t)0x00000004) 67 | #define DAC_Trigger_T8_TRGO ((uint32_t)0x0000000C) 68 | #define DAC_Trigger_T7_TRGO ((uint32_t)0x00000014) 69 | #define DAC_Trigger_T5_TRGO ((uint32_t)0x0000001C) 70 | #define DAC_Trigger_T2_TRGO ((uint32_t)0x00000024) 71 | #define DAC_Trigger_T4_TRGO ((uint32_t)0x0000002C) 72 | #define DAC_Trigger_Ext_IT9 ((uint32_t)0x00000034) 73 | #define DAC_Trigger_Software ((uint32_t)0x0000003C) 74 | 75 | #define IS_DAC_TRIGGER(TRIGGER) (((TRIGGER) == DAC_Trigger_None) || \ 76 | ((TRIGGER) == DAC_Trigger_T6_TRGO) || \ 77 | ((TRIGGER) == DAC_Trigger_T8_TRGO) || \ 78 | ((TRIGGER) == DAC_Trigger_T7_TRGO) || \ 79 | ((TRIGGER) == DAC_Trigger_T5_TRGO) || \ 80 | ((TRIGGER) == DAC_Trigger_T2_TRGO) || \ 81 | ((TRIGGER) == DAC_Trigger_T4_TRGO) || \ 82 | ((TRIGGER) == DAC_Trigger_Ext_IT9) || \ 83 | ((TRIGGER) == DAC_Trigger_Software)) 84 | 85 | /** 86 | * @} 87 | */ 88 | 89 | /** @defgroup DAC_wave_generation 90 | * @{ 91 | */ 92 | 93 | #define DAC_WaveGeneration_None ((uint32_t)0x00000000) 94 | #define DAC_WaveGeneration_Noise ((uint32_t)0x00000040) 95 | #define DAC_WaveGeneration_Triangle ((uint32_t)0x00000080) 96 | #define IS_DAC_GENERATE_WAVE(WAVE) (((WAVE) == DAC_WaveGeneration_None) || \ 97 | ((WAVE) == DAC_WaveGeneration_Noise) || \ 98 | ((WAVE) == DAC_WaveGeneration_Triangle)) 99 | /** 100 | * @} 101 | */ 102 | 103 | /** @defgroup DAC_noise_wave_generation_mask_triangle_wave_generation_max_amplitude 104 | * @{ 105 | */ 106 | 107 | #define DAC_LFSRUnmask_Bit0 ((uint32_t)0x00000000) 108 | #define DAC_LFSRUnmask_Bits1_0 ((uint32_t)0x00000100) 109 | #define DAC_LFSRUnmask_Bits2_0 ((uint32_t)0x00000200) 110 | #define DAC_LFSRUnmask_Bits3_0 ((uint32_t)0x00000300) 111 | #define DAC_LFSRUnmask_Bits4_0 ((uint32_t)0x00000400) 112 | #define DAC_LFSRUnmask_Bits5_0 ((uint32_t)0x00000500) 113 | #define DAC_LFSRUnmask_Bits6_0 ((uint32_t)0x00000600) 114 | #define DAC_LFSRUnmask_Bits7_0 ((uint32_t)0x00000700) 115 | #define DAC_LFSRUnmask_Bits8_0 ((uint32_t)0x00000800) 116 | #define DAC_LFSRUnmask_Bits9_0 ((uint32_t)0x00000900) 117 | #define DAC_LFSRUnmask_Bits10_0 ((uint32_t)0x00000A00) 118 | #define DAC_LFSRUnmask_Bits11_0 ((uint32_t)0x00000B00) 119 | #define DAC_TriangleAmplitude_1 ((uint32_t)0x00000000) 120 | #define DAC_TriangleAmplitude_3 ((uint32_t)0x00000100) 121 | #define DAC_TriangleAmplitude_7 ((uint32_t)0x00000200) 122 | #define DAC_TriangleAmplitude_15 ((uint32_t)0x00000300) 123 | #define DAC_TriangleAmplitude_31 ((uint32_t)0x00000400) 124 | #define DAC_TriangleAmplitude_63 ((uint32_t)0x00000500) 125 | #define DAC_TriangleAmplitude_127 ((uint32_t)0x00000600) 126 | #define DAC_TriangleAmplitude_255 ((uint32_t)0x00000700) 127 | #define DAC_TriangleAmplitude_511 ((uint32_t)0x00000800) 128 | #define DAC_TriangleAmplitude_1023 ((uint32_t)0x00000900) 129 | #define DAC_TriangleAmplitude_2047 ((uint32_t)0x00000A00) 130 | #define DAC_TriangleAmplitude_4095 ((uint32_t)0x00000B00) 131 | 132 | #define IS_DAC_LFSR_UNMASK_TRIANGLE_AMPLITUDE(VALUE) (((VALUE) == DAC_LFSRUnmask_Bit0) || \ 133 | ((VALUE) == DAC_LFSRUnmask_Bits1_0) || \ 134 | ((VALUE) == DAC_LFSRUnmask_Bits2_0) || \ 135 | ((VALUE) == DAC_LFSRUnmask_Bits3_0) || \ 136 | ((VALUE) == DAC_LFSRUnmask_Bits4_0) || \ 137 | ((VALUE) == DAC_LFSRUnmask_Bits5_0) || \ 138 | ((VALUE) == DAC_LFSRUnmask_Bits6_0) || \ 139 | ((VALUE) == DAC_LFSRUnmask_Bits7_0) || \ 140 | ((VALUE) == DAC_LFSRUnmask_Bits8_0) || \ 141 | ((VALUE) == DAC_LFSRUnmask_Bits9_0) || \ 142 | ((VALUE) == DAC_LFSRUnmask_Bits10_0) || \ 143 | ((VALUE) == DAC_LFSRUnmask_Bits11_0) || \ 144 | ((VALUE) == DAC_TriangleAmplitude_1) || \ 145 | ((VALUE) == DAC_TriangleAmplitude_3) || \ 146 | ((VALUE) == DAC_TriangleAmplitude_7) || \ 147 | ((VALUE) == DAC_TriangleAmplitude_15) || \ 148 | ((VALUE) == DAC_TriangleAmplitude_31) || \ 149 | ((VALUE) == DAC_TriangleAmplitude_63) || \ 150 | ((VALUE) == DAC_TriangleAmplitude_127) || \ 151 | ((VALUE) == DAC_TriangleAmplitude_255) || \ 152 | ((VALUE) == DAC_TriangleAmplitude_511) || \ 153 | ((VALUE) == DAC_TriangleAmplitude_1023) || \ 154 | ((VALUE) == DAC_TriangleAmplitude_2047) || \ 155 | ((VALUE) == DAC_TriangleAmplitude_4095)) 156 | /** 157 | * @} 158 | */ 159 | 160 | /** @defgroup DAC_output_buffer 161 | * @{ 162 | */ 163 | 164 | #define DAC_OutputBuffer_Enable ((uint32_t)0x00000000) 165 | #define DAC_OutputBuffer_Disable ((uint32_t)0x00000002) 166 | #define IS_DAC_OUTPUT_BUFFER_STATE(STATE) (((STATE) == DAC_OutputBuffer_Enable) || \ 167 | ((STATE) == DAC_OutputBuffer_Disable)) 168 | /** 169 | * @} 170 | */ 171 | 172 | /** @defgroup DAC_Channel_selection 173 | * @{ 174 | */ 175 | 176 | #define DAC_Channel_1 ((uint32_t)0x00000000) 177 | #define DAC_Channel_2 ((uint32_t)0x00000010) 178 | #define IS_DAC_CHANNEL(CHANNEL) (((CHANNEL) == DAC_Channel_1) || \ 179 | ((CHANNEL) == DAC_Channel_2)) 180 | /** 181 | * @} 182 | */ 183 | 184 | /** @defgroup DAC_data_alignement 185 | * @{ 186 | */ 187 | 188 | #define DAC_Align_12b_R ((uint32_t)0x00000000) 189 | #define DAC_Align_12b_L ((uint32_t)0x00000004) 190 | #define DAC_Align_8b_R ((uint32_t)0x00000008) 191 | #define IS_DAC_ALIGN(ALIGN) (((ALIGN) == DAC_Align_12b_R) || \ 192 | ((ALIGN) == DAC_Align_12b_L) || \ 193 | ((ALIGN) == DAC_Align_8b_R)) 194 | /** 195 | * @} 196 | */ 197 | 198 | /** @defgroup DAC_wave_generation 199 | * @{ 200 | */ 201 | 202 | #define DAC_Wave_Noise ((uint32_t)0x00000040) 203 | #define DAC_Wave_Triangle ((uint32_t)0x00000080) 204 | #define IS_DAC_WAVE(WAVE) (((WAVE) == DAC_Wave_Noise) || \ 205 | ((WAVE) == DAC_Wave_Triangle)) 206 | /** 207 | * @} 208 | */ 209 | 210 | /** @defgroup DAC_data 211 | * @{ 212 | */ 213 | 214 | #define IS_DAC_DATA(DATA) ((DATA) <= 0xFFF0) 215 | /** 216 | * @} 217 | */ 218 | 219 | /** 220 | * @} 221 | */ 222 | 223 | /** @defgroup DAC_Exported_Macros 224 | * @{ 225 | */ 226 | 227 | /** 228 | * @} 229 | */ 230 | 231 | /** @defgroup DAC_Exported_Functions 232 | * @{ 233 | */ 234 | 235 | void DAC_DeInit(void); 236 | void DAC_Init(uint32_t DAC_Channel, DAC_InitTypeDef* DAC_InitStruct); 237 | void DAC_StructInit(DAC_InitTypeDef* DAC_InitStruct); 238 | void DAC_Cmd(uint32_t DAC_Channel, FunctionalState NewState); 239 | void DAC_DMACmd(uint32_t DAC_Channel, FunctionalState NewState); 240 | void DAC_SoftwareTriggerCmd(uint32_t DAC_Channel, FunctionalState NewState); 241 | void DAC_DualSoftwareTriggerCmd(FunctionalState NewState); 242 | void DAC_WaveGenerationCmd(uint32_t DAC_Channel, uint32_t DAC_Wave, FunctionalState NewState); 243 | void DAC_SetChannel1Data(uint32_t DAC_Align, uint16_t Data); 244 | void DAC_SetChannel2Data(uint32_t DAC_Align, uint16_t Data); 245 | void DAC_SetDualChannelData(uint32_t DAC_Align, uint16_t Data2, uint16_t Data1); 246 | uint16_t DAC_GetDataOutputValue(uint32_t DAC_Channel); 247 | 248 | #endif /*__STM32F10x_DAC_H */ 249 | /** 250 | * @} 251 | */ 252 | 253 | /** 254 | * @} 255 | */ 256 | 257 | /** 258 | * @} 259 | */ 260 | 261 | /******************* (C) COPYRIGHT 2009 STMicroelectronics *****END OF FILE****/ 262 | -------------------------------------------------------------------------------- /main.uvopt: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 1.0 5 | 6 |
### uVision Project, (C) Keil Software
7 | 8 | 9 | *.c 10 | *.s*; *.src; *.a* 11 | *.obj 12 | *.lib 13 | *.txt; *.h; *.inc 14 | *.plm 15 | *.cpp 16 | 17 | 18 | 19 | 0 20 | 0 21 | 22 | 23 | 24 | Target 1 25 | 0x4 26 | ARM-ADS 27 | 28 | 8000000 29 | 30 | 1 31 | 1 32 | 1 33 | 0 34 | 35 | 36 | 1 37 | 65535 38 | 0 39 | 0 40 | 0 41 | 42 | 43 | 79 44 | 66 45 | 8 46 | .\out\ 47 | 48 | 49 | 1 50 | 1 51 | 1 52 | 0 53 | 1 54 | 1 55 | 0 56 | 1 57 | 0 58 | 0 59 | 0 60 | 0 61 | 62 | 63 | 1 64 | 1 65 | 1 66 | 1 67 | 1 68 | 1 69 | 1 70 | 0 71 | 0 72 | 73 | 74 | 1 75 | 0 76 | 1 77 | 78 | 255 79 | 80 | SARMCM3.DLL 81 | -REMAP 82 | DCM.DLL 83 | -pCM3 84 | SARMCM3.DLL 85 | 86 | TCM.DLL 87 | -pCM3 88 | 89 | 90 | 0 91 | 1 92 | 1 93 | 1 94 | 1 95 | 1 96 | 1 97 | 1 98 | 1 99 | 1 100 | 1 101 | 1 102 | 1 103 | 1 104 | 0 105 | 1 106 | 0 107 | 1 108 | 1 109 | 0 110 | 0 111 | 11 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | STLink\ST-LINKIII-KEIL_SWO.dll 123 | 124 | 125 | 126 | 0 127 | ST-LINKIII-KEIL_SWO 128 | -U -O206 -S3 -C-1 -N00("ARM CoreSight SW-DP") -D00(1BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8004 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC800 -FN1 -FF0STM32F10x_512.FLM -FS08000000 -FL080000 -FP0($$Device:STM32F103VE$Flash\STM32F10x_512.FLM) 129 | 130 | 131 | 0 132 | JL2CM3 133 | -U871039 -O78 -S9 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -N00("ARM CoreSight SW-DP") -D00(1BA01477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8001 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO15 -FD20000000 -FC800 -FN1 -FF0STM32F10x_512 -FS08000000 -FL040000 134 | 135 | 136 | 0 137 | UL2CM3 138 | -O14 -S0 -C0 -N00("ARM Cortex-M3") -D00(1BA00477) -L00(4) -FO7 -FD20000000 -FC800 -FN1 -FF0STM32F10x_512 -FS08000000 -FL080000) 139 | 140 | 141 | 142 | 143 | 0 144 | 145 | 146 | 0 147 | 1 148 | 0 149 | 0 150 | 0 151 | 0 152 | 0 153 | 0 154 | 0 155 | 0 156 | 0 157 | 0 158 | 0 159 | 0 160 | 0 161 | 0 162 | 0 163 | 0 164 | 0 165 | 0 166 | 0 167 | 0 168 | 0 169 | 0 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | lib 178 | 1 179 | 0 180 | 0 181 | 0 182 | 183 | 1 184 | 1 185 | 4 186 | 0 187 | 0 188 | 0 189 | 0 190 | 0 191 | 0 192 | 0 193 | .\lib\STM32_lib_3.0.lib 194 | STM32_lib_3.0.lib 195 | 0 196 | 0 197 | 198 | 199 | 200 | 201 | sys 202 | 0 203 | 0 204 | 0 205 | 0 206 | 207 | 2 208 | 2 209 | 1 210 | 0 211 | 0 212 | 0 213 | 0 214 | 0 215 | 0 216 | 0 217 | .\sys\core_cm3.c 218 | core_cm3.c 219 | 0 220 | 0 221 | 222 | 223 | 2 224 | 3 225 | 1 226 | 0 227 | 0 228 | 42 229 | 0 230 | 1 231 | 10 232 | 0 233 | .\sys\system_stm32f10x.c 234 | system_stm32f10x.c 235 | 0 236 | 0 237 | 238 | 239 | 2 240 | 4 241 | 2 242 | 0 243 | 0 244 | 0 245 | 0 246 | 0 247 | 0 248 | 0 249 | .\sys\startup_stm32f10x_hd.s 250 | startup_stm32f10x_hd.s 251 | 0 252 | 0 253 | 254 | 255 | 256 | 257 | user 258 | 1 259 | 0 260 | 0 261 | 0 262 | 263 | 3 264 | 5 265 | 1 266 | 0 267 | 0 268 | 18 269 | 0 270 | 10 271 | 8 272 | 0 273 | .\user\main.c 274 | main.c 275 | 0 276 | 0 277 | 278 | 279 | 3 280 | 6 281 | 1 282 | 0 283 | 0 284 | 18 285 | 0 286 | 1 287 | 5 288 | 0 289 | .\user\stm32f10x_it.c 290 | stm32f10x_it.c 291 | 0 292 | 0 293 | 294 | 295 | 3 296 | 7 297 | 5 298 | 0 299 | 0 300 | 27 301 | 0 302 | 0 303 | 0 304 | 0 305 | .\user\stm32f10x_conf.h 306 | stm32f10x_conf.h 307 | 0 308 | 0 309 | 310 | 311 | 3 312 | 8 313 | 1 314 | 0 315 | 0 316 | 15 317 | 0 318 | 5 319 | 19 320 | 0 321 | .\user\gpio.c 322 | gpio.c 323 | 0 324 | 0 325 | 326 | 327 | 3 328 | 9 329 | 1 330 | 0 331 | 0 332 | 1 333 | 0 334 | 6 335 | 11 336 | 0 337 | .\user\usart.c 338 | usart.c 339 | 0 340 | 0 341 | 342 | 343 | 3 344 | 10 345 | 1 346 | 0 347 | 0 348 | 18 349 | 0 350 | 2 351 | 3 352 | 0 353 | .\user\delay.c 354 | delay.c 355 | 0 356 | 0 357 | 358 | 359 | 360 | 361 | out 362 | 0 363 | 0 364 | 0 365 | 0 366 | 367 | 368 |
369 | --------------------------------------------------------------------------------