mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2024-11-28 06:21:31 +00:00
Clean up fast_pwm.cpp
This commit is contained in:
parent
49229d97db
commit
47fd74a98d
@ -1,15 +1,30 @@
|
|||||||
|
/**
|
||||||
|
* 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__
|
#ifdef __AVR__
|
||||||
|
|
||||||
#include "../../inc/MarlinConfigPre.h"
|
#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
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if ENABLED(FAST_PWM_FAN)
|
#if ENABLED(FAST_PWM_FAN)
|
||||||
|
|
||||||
#include "HAL.h"
|
#include "HAL.h"
|
||||||
|
|
||||||
struct Timer {
|
struct Timer {
|
||||||
@ -20,7 +35,13 @@
|
|||||||
uint8_t q; // the timer output [0->2] (A->C)
|
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;
|
uint8_t q = 0;
|
||||||
switch (digitalPinToTimer(pin)) {
|
switch (digitalPinToTimer(pin)) {
|
||||||
// Protect reserved timers (TIMER0 & TIMER1)
|
// Protect reserved timers (TIMER0 & TIMER1)
|
||||||
|
Loading…
Reference in New Issue
Block a user