Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add central location for ChibiOS defines #7542

Merged
merged 4 commits into from
Dec 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions drivers/arm/i2c_master.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@
* STM32_I2C_USE_I2C1 is TRUE in the mcuconf.h file. Pins B6 and B7 are used
* but using any other I2C pins should be trivial.
*/

#include "i2c_master.h"
#include "quantum.h"
#include "i2c_master.h"
#include <string.h>
#include <hal.h>

Expand Down
28 changes: 10 additions & 18 deletions drivers/arm/i2c_master.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@
#include "ch.h"
#include <hal.h>

#if defined(STM32F1XX) || defined(STM32F1xx) || defined(STM32F2xx) || defined(STM32F4xx) || defined(STM32F4XX) || defined(STM32L0xx) || defined(STM32L1xx)
# define USE_I2CV1
#endif

#ifdef I2C1_BANK
# define I2C1_SCL_BANK I2C1_BANK
# define I2C1_SDA_BANK I2C1_BANK
Expand All @@ -51,20 +47,6 @@
# define I2C1_SDA 7
#endif

#if defined(STM32F1XX) || defined(STM32F1xx)
# define USE_GPIOV1
#endif

#ifndef USE_GPIOV1
// The default PAL alternate modes are used to signal that the pins are used for I2C
# ifndef I2C1_SCL_PAL_MODE
# define I2C1_SCL_PAL_MODE 4
# endif
# ifndef I2C1_SDA_PAL_MODE
# define I2C1_SDA_PAL_MODE 4
# endif
#endif

#ifdef USE_I2CV1
# ifndef I2C1_OPMODE
# define I2C1_OPMODE OPMODE_I2C
Expand Down Expand Up @@ -99,6 +81,16 @@
# define I2C_DRIVER I2CD1
#endif

#ifndef USE_GPIOV1
// The default PAL alternate modes are used to signal that the pins are used for I2C
# ifndef I2C1_SCL_PAL_MODE
# define I2C1_SCL_PAL_MODE 4
# endif
# ifndef I2C1_SDA_PAL_MODE
# define I2C1_SDA_PAL_MODE 4
# endif
#endif

typedef int16_t i2c_status_t;

#define I2C_STATUS_SUCCESS (0)
Expand Down
4 changes: 0 additions & 4 deletions quantum/backlight/backlight_arm.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@
# error "Backlight support for STMF072 is not available. Please disable."
# endif

# if defined(STM32F1XX) || defined(STM32F1xx)
# define USE_GPIOV1
# endif

// GPIOV2 && GPIOV3
# ifndef BACKLIGHT_PAL_MODE
# define BACKLIGHT_PAL_MODE 2
Expand Down
1 change: 1 addition & 0 deletions quantum/quantum.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#endif
#if defined(PROTOCOL_CHIBIOS)
# include "hal.h"
# include "chibios_config.h"
#endif

#include "wait.h"
Expand Down
24 changes: 24 additions & 0 deletions tmk_core/common/chibios/chibios_config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/* Copyright 2019
*
* This program 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 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once

#if defined(STM32F1XX)
# define USE_GPIOV1
#endif

#if defined(STM32F1XX) || defined(STM32F2XX) || defined(STM32F4XX) || defined(STM32L1XX)
# define USE_I2CV1
#endif