STM32 non-generic PWM_PIN and USEABLE_HARDWARE_PWM (#12016)

This commit is contained in:
Scott Lahteine 2018-10-06 00:14:12 -05:00 committed by GitHub
parent d5141c4e03
commit 33056046a3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 22 additions and 10 deletions

View File

@ -47,7 +47,7 @@
// Due has 12 PWMs assigned to logical pins 2-13.
// 6, 7, 8 & 9 come from the PWM controller. The others come from the timers.
#define USEABLE_HARDWARE_PWM(p) ((2 <= p) && (p <= 13))
#define USEABLE_HARDWARE_PWM(p) WITHIN(p, 2, 13)
#ifndef MASK
#define MASK(PIN) (1 << PIN)

View File

@ -29,8 +29,6 @@
#define _BV(b) (1 << (b))
#define USEABLE_HARDWARE_PWM(p) true
#define READ(IO) digitalRead(IO)
#define WRITE(IO,V) digitalWrite(IO,V)
#define WRITE_VAR(IO,V) WRITE(IO,V)
@ -51,3 +49,6 @@
#define GET_INPUT(IO)
#define GET_OUTPUT(IO)
#define GET_TIMER(IO)
#define PWM_PIN(p) true
#define USEABLE_HARDWARE_PWM(p) PWM_PIN(p)

View File

@ -50,9 +50,7 @@
#define GET_OUTPUT(IO) (_GET_MODE(IO) == GPIO_OUTPUT_PP)
#define GET_TIMER(IO) (PIN_MAP[IO].timer_device != NULL)
/**
* TODO: Write a macro to test if PIN is PWM or not.
*/
#define PWM_PIN(p) true
#define PWM_PIN(p) digitalPinHasPWM(p)
#define USEABLE_HARDWARE_PWM(p) PWM_PIN(p)
#endif // _FASTIO_STM32F1_H

View File

@ -32,8 +32,6 @@
#undef _BV
#define _BV(b) (1 << (b))
#define USEABLE_HARDWARE_PWM(p) true
#define READ(IO) digitalRead(IO)
#define WRITE(IO,V) digitalWrite(IO,V)
#define WRITE_VAR(IO,V) WRITE(IO,V)
@ -55,6 +53,12 @@
#define GET_OUTPUT(IO)
#define GET_TIMER(IO)
#define PWM_PIN(p) digitalPinHasPWM(p)
#define USEABLE_HARDWARE_PWM(p) PWM_PIN(p)
//
// Pins Definitions
//
#define PORTA 0
#define PORTB 1
#define PORTC 2

View File

@ -52,6 +52,12 @@
#define GET_OUTPUT(IO)
#define GET_TIMER(IO)
#define PWM_PIN(p) digitalPinHasPWM(p)
#define USEABLE_HARDWARE_PWM(p) PWM_PIN(p)
//
// Pins Definitions
//
#define PORTA 0
#define PORTB 1
#define PORTC 2

View File

@ -8,5 +8,8 @@ opt_set MOTHERBOARD BOARD_STM32F1R
opt_enable EEPROM_SETTINGS EEPROM_CHITCHAT REPRAP_DISCOUNT_SMART_CONTROLLER SDSUPPORT
exec_test $1 $2 "STM32F1R EEPROM_SETTINGS EEPROM_CHITCHAT REPRAP_DISCOUNT_SMART_CONTROLLER SDSUPPORT"
#cleanup
opt_enable SPINDLE_LASER_ENABLE
exec_test $1 $2 "STM32F1R SPINDLE_LASER_ENABLE"
# cleanup
restore_configs