STM32 non-generic PWM_PIN and USEABLE_HARDWARE_PWM (#12016)
This commit is contained in:
		@@ -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)
 | 
			
		||||
 
 | 
			
		||||
@@ -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)
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user