From b67514b28f50524611ac378a21ea12fe3883ca79 Mon Sep 17 00:00:00 2001 From: Paciente8159 Date: Thu, 5 Jan 2023 19:48:15 +0000 Subject: [PATCH] Added UNO Shield V3 board --- uCNC/src/hal/boards/avr/avr.ini | 5 ++ .../hal/boards/avr/boardmap_uno_shield_v3.h | 66 +++++++++++++++++++ uCNC/src/hal/boards/boarddefs.h | 5 ++ uCNC/src/hal/boards/boards.h | 1 + 4 files changed, 77 insertions(+) create mode 100644 uCNC/src/hal/boards/avr/boardmap_uno_shield_v3.h diff --git a/uCNC/src/hal/boards/avr/avr.ini b/uCNC/src/hal/boards/avr/avr.ini index 8e5875dc9..a39bc7089 100644 --- a/uCNC/src/hal/boards/avr/avr.ini +++ b/uCNC/src/hal/boards/avr/avr.ini @@ -17,6 +17,11 @@ extends = common_avr board = uno build_flags = ${common_avr.build_flags} -D BOARD=BOARD_UNO +[env:uno_shield_v3] +extends = common_avr +board = uno +build_flags = ${common_avr.build_flags} -D BOARD=BOARD_UNO_SHIELD_V3 + [env:x_controller] extends = common_avr board = uno diff --git a/uCNC/src/hal/boards/avr/boardmap_uno_shield_v3.h b/uCNC/src/hal/boards/avr/boardmap_uno_shield_v3.h new file mode 100644 index 000000000..37ff14463 --- /dev/null +++ b/uCNC/src/hal/boards/avr/boardmap_uno_shield_v3.h @@ -0,0 +1,66 @@ +/* + Name: boardmap_uno_shield_v3.h + Description: Contains all MCU and PIN definitions for Arduino UNO similar to Grbl 1.1+ to run µCNC. + + Copyright: Copyright (c) João Martins + Author: João Martins + Date: 05/01/2023 + + µCNC is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. Please see + + µCNC is distributed WITHOUT ANY WARRANTY; + Also without the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the GNU General Public License for more details. +*/ + +#ifndef BOARDMAP_UNO_SHIELD_V3_H +#define BOARDMAP_UNO_SHIELD_V3_H + +#ifdef __cplusplus +extern "C" +{ +#endif + +#ifndef BOARD_NAME +#define BOARD_NAME "UNO SHIELD V3" +#endif + +#include "boardmap_uno.h" + +//swap limit z and replace pwm by spin enable pin +#ifdef LIMIT_Z_BIT +#undef LIMIT_Z_BIT +#endif +#ifdef LIMIT_Z_PORT +#undef LIMIT_Z_PORT +#endif +#ifdef PWM0_BIT +#undef PWM0_BIT +#endif +#ifdef PWM0_PORT +#undef PWM0_PORT +#endif +#ifdef PWM0_CHANNEL +#undef PWM0_CHANNEL +#endif +#ifdef PWM0_TIMER +#undef PWM0_TIMER +#endif + +// Grbl 0.8 limit z +#define LIMIT_Z_BIT 3 // assigns LIMIT_Z pin +#define LIMIT_Z_PORT B // assigns LIMIT_Z port +#define LIMIT_Z_ISR 0 // assigns LIMIT_Z ISR + +// spindle en +#define DOUT1_BIT 4 +#define DOUT1_PORT B + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/uCNC/src/hal/boards/boarddefs.h b/uCNC/src/hal/boards/boarddefs.h index f634ac882..e98176066 100644 --- a/uCNC/src/hal/boards/boarddefs.h +++ b/uCNC/src/hal/boards/boarddefs.h @@ -43,6 +43,11 @@ extern "C" #include "avr/boardmap_uno.h" #endif +#if (BOARD == BOARD_UNO_SHIELD_V3) +#define MCU MCU_AVR +#include "avr/boardmap_uno_shield_v3.h" +#endif + #if (BOARD == BOARD_X_CONTROLLER) #define MCU MCU_AVR #include "avr/boardmap_x_controller.h" diff --git a/uCNC/src/hal/boards/boards.h b/uCNC/src/hal/boards/boards.h index f49bfc79e..88bbbd461 100644 --- a/uCNC/src/hal/boards/boards.h +++ b/uCNC/src/hal/boards/boards.h @@ -30,6 +30,7 @@ extern "C" #define BOARD_MKS_DLC 4 #define BOARD_X_CONTROLLER 5 #define BOARD_MKS_GEN_L_V1 6 +#define BOARD_UNO_SHIELD_V3 7 #define BOARD_BLUEPILL 10 #define BOARD_BLACKPILL 11 #define BOARD_MKS_ROBIN_NANO_V1_2 12