Marlin_Firmware/Marlin/src/HAL/HAL_STM32F7/fastio_STM32F7.h

55 lines
2.1 KiB
C
Raw Normal View History

2018-01-11 15:29:08 -06:00
/**
* Marlin 3D Printer Firmware
* Copyright (C) 2016 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
* Copyright (C) 2017 Victor Perez
*
* 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 3 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/>.
*
*/
/**
* Fast I/O interfaces for STM32F7
* These use GPIO functions instead of Direct Port Manipulation, as on AVR.
*/
2018-01-15 02:28:39 -06:00
#ifndef _FASTIO_STM32F7_H
#define _FASTIO_STM32F7_H
2018-01-11 15:29:08 -06:00
#define _BV(b) (1UL << (b))
2018-01-11 15:29:08 -06:00
#define READ(IO) digitalRead(IO)
#define WRITE(IO, v) digitalWrite(IO,v)
#define TOGGLE(IO) do{ _SET_OUTPUT(IO); digitalWrite(IO,!digitalRead(IO)); }while(0)
#define WRITE_VAR(IO, v) digitalWrite(IO,v)
#define _GET_MODE(IO)
#define _SET_MODE(IO,M) pinMode(IO, M)
2018-01-15 02:28:39 -06:00
#define _SET_OUTPUT(IO) pinMode(IO, OUTPUT) /*!< Output Push Pull Mode & GPIO_NOPULL */
2018-01-11 15:29:08 -06:00
2018-01-15 02:28:39 -06:00
#define SET_INPUT(IO) _SET_MODE(IO, INPUT) /*!< Input Floating Mode */
#define SET_INPUT_PULLUP(IO) _SET_MODE(IO, INPUT_PULLUP) /*!< Input with Pull-up activation */
#define SET_INPUT_PULLDOW(IO) _SET_MODE(IO, INPUT_PULLDOWN) /*!< Input with Pull-down activation */
#define SET_OUTPUT(IO) do{ _SET_OUTPUT(IO); WRITE(IO, LOW); }while(0)
2018-01-11 15:29:08 -06:00
2018-01-15 02:28:39 -06:00
#define GET_INPUT(IO)
#define GET_OUTPUT(IO)
#define GET_TIMER(IO)
2018-01-11 15:29:08 -06:00
#define OUT_WRITE(IO, v) { _SET_OUTPUT(IO); WRITE(IO, v); }
2018-01-15 02:28:39 -06:00
#endif // _FASTIO_STM32F7_H