Browse Source

Clean up fast_pwm.cpp

pull/1/head
Scott Lahteine 6 years ago
parent
commit
47fd74a98d
  1. 37
      Marlin/src/HAL/HAL_AVR/fast_pwm.cpp

37
Marlin/src/HAL/HAL_AVR/fast_pwm.cpp

@ -1,15 +1,30 @@
#ifdef __AVR__
#include "../../inc/MarlinConfigPre.h"
/**
* get_pwm_timer
* Grabs timer information and registers of the provided pin
* returns Timer struct containing this information
* Used by set_pwm_frequency, set_pwm_duty
* Marlin 3D Printer Firmware
* Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
*
* 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/>.
*
*/
#ifdef __AVR__
#include "../../inc/MarlinConfigPre.h"
#if ENABLED(FAST_PWM_FAN)
#include "HAL.h"
struct Timer {
@ -20,7 +35,13 @@
uint8_t q; // the timer output [0->2] (A->C)
};
Timer get_pwm_timer(pin_t pin) {
/**
* get_pwm_timer
* Get the timer information and register of the provided pin.
* Return a Timer struct containing this information.
* Used by set_pwm_frequency, set_pwm_duty
*/
Timer get_pwm_timer(const pin_t pin) {
uint8_t q = 0;
switch (digitalPinToTimer(pin)) {
// Protect reserved timers (TIMER0 & TIMER1)

Loading…
Cancel
Save