Skip to content

Commit

Permalink
Merge pull request #836 from Paciente8159/STM32F0-I2C
Browse files Browse the repository at this point in the history
STM32F0 fix I2C implementation
  • Loading branch information
Paciente8159 authored Mar 2, 2025
2 parents c1e508d + 4baa1a8 commit f8e288b
Show file tree
Hide file tree
Showing 11 changed files with 316 additions and 246 deletions.
12 changes: 6 additions & 6 deletions uCNC/src/hal/boards/pin_mapping_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -1404,13 +1404,13 @@ extern "C"
#define SPI_CS_BIT MCU_PIN(SPI_CS_PIN,BIT)
#define SPI_CS_PORT MCU_PIN(SPI_CS_PIN,PORT)
#endif
#if (defined(I2C_SCL_PIN) && !(defined(I2C_SCL_BIT) || defined(I2C_SCL_PORT)))
#define I2C_SCL_BIT MCU_PIN(I2C_SCL_PIN,BIT)
#define I2C_SCL_PORT MCU_PIN(I2C_SCL_PIN,PORT)
#if (defined(I2C_CLK_PIN) && !(defined(I2C_CLK_BIT) || defined(I2C_CLK_PORT)))
#define I2C_CLK_BIT MCU_PIN(I2C_CLK_PIN,BIT)
#define I2C_CLK_PORT MCU_PIN(I2C_CLK_PIN,PORT)
#endif
#if (defined(I2C_SDA_PIN) && !(defined(I2C_SDA_BIT) || defined(I2C_SDA_PORT)))
#define I2C_SDA_BIT MCU_PIN(I2C_SDA_PIN,BIT)
#define I2C_SDA_PORT MCU_PIN(I2C_SDA_PIN,PORT)
#if (defined(I2C_DATA_PIN) && !(defined(I2C_DATA_BIT) || defined(I2C_DATA_PORT)))
#define I2C_DATA_BIT MCU_PIN(I2C_DATA_PIN,BIT)
#define I2C_DATA_PORT MCU_PIN(I2C_DATA_PIN,PORT)
#endif
#if (defined(TX2_PIN) && !(defined(TX2_BIT) || defined(TX2_PORT)))
#define TX2_BIT MCU_PIN(TX2_PIN,BIT)
Expand Down
4 changes: 2 additions & 2 deletions uCNC/src/hal/boards/stm32/stm32.ini
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ build_flags = ${common_stm32.build_flags} -D BOARDMAP=\"src/hal/boards/stm32/boa
[env:STM32F0-Bluepill-F030C8]
extends = common_stm32
board = genericSTM32F0
; upload_protocol = stlink
; debug_tool=stlink
upload_protocol = stlink
debug_tool=stlink
board_build.mcu = stm32f030c8t6
board_build.f_cpu = 48000000L
board_upload.maximum_size = 65536
Expand Down
45 changes: 45 additions & 0 deletions uCNC/src/hal/kinematics/kinematic_dummy.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/*
Name: kinematic_dummy.c
Description: Custom kinematics definitions for a dummy kinematics
Copyright: Copyright (c) João Martins
Author: João Martins
Date: 01-03-2025
µ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 <http://www.gnu.org/licenses/>
µ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.
*/

#include "../../cnc.h"

#if (KINEMATIC == KINEMATIC_DUMMY)

void kinematics_init(void)
{
}

void kinematics_apply_inverse(float *axis, int32_t *steps)
{
}

void kinematics_apply_forward(int32_t *steps, float *axis)
{
}

uint8_t kinematics_home(void)
{
return STATUS_OK;
}

bool kinematics_check_boundaries(float *axis)
{
return true;
}

#endif
32 changes: 32 additions & 0 deletions uCNC/src/hal/kinematics/kinematic_dummy.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
Name: kinematic_dummy.h
Description: Custom kinematics definitions for a dummy kinematics
Copyright: Copyright (c) João Martins
Author: João Martins
Date: 01-03-2025
µ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 <http://www.gnu.org/licenses/>
µ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 KINEMATIC_DUMMY_H
#define KINEMATIC_DUMMY_H

#ifdef __cplusplus
extern "C"
{
#endif

#define KINEMATIC_TYPE_STR "DMY"

#ifdef __cplusplus
}
#endif
#endif
2 changes: 2 additions & 0 deletions uCNC/src/hal/kinematics/kinematicdefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ extern "C"
#include "kinematic_delta.h"
#elif (KINEMATIC == KINEMATIC_SCARA)
#include "kinematic_scara.h"
#elif (KINEMATIC == KINEMATIC_DUMMY)
#include "kinematic_dummy.h"
#else
#error Kinematics not implemented
#endif
Expand Down
1 change: 1 addition & 0 deletions uCNC/src/hal/kinematics/kinematics.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ extern "C"
#define KINEMATIC_LINEAR_DELTA 3
#define KINEMATIC_DELTA 4
#define KINEMATIC_SCARA 5
#define KINEMATIC_DUMMY 99

#define COREXY_AXIS_XY 1
#define COREXY_AXIS_XZ 2
Expand Down
4 changes: 2 additions & 2 deletions uCNC/src/hal/mcus/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,8 @@ These pins also obey a numbering system to make them transversal between boards
| 205 | DIO205 | SPI_SDI |
| 206 | DIO206 | SPI_SDO |
| 207 | DIO207 | SPI_CS |
| 208 | DIO208 | I2C_SCL |
| 209 | DIO209 | I2C_SDA |
| 208 | DIO208 | I2C_CLK |
| 209 | DIO209 | I2C_DATA |
| 210 | DIO210 | TX2 |
| 211 | DIO211 | RX2 |
| 212 | DIO212 | SPI2_CLK |
Expand Down
Loading

0 comments on commit f8e288b

Please sign in to comment.