Skip to content

Commit be492fe

Browse files
committed
Add HAL API for pwmout pinmap
Add the function pwm_pinmap to all targets.
1 parent 22a8977 commit be492fe

File tree

59 files changed

+300
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+300
-0
lines changed

hal/pwmout_api.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#define MBED_PWMOUT_API_H
2222

2323
#include "device.h"
24+
#include "pinmap.h"
2425

2526
#if DEVICE_PWMOUT
2627

@@ -108,6 +109,15 @@ void pwmout_pulsewidth_ms(pwmout_t *obj, int ms);
108109
*/
109110
void pwmout_pulsewidth_us(pwmout_t *obj, int us);
110111

112+
/** Get the pins that support PWM
113+
*
114+
* Return a PinMap array of pins that support PWM.
115+
* The array is terminated with {NC, NC, 0}.
116+
*
117+
* @return PinMap array
118+
*/
119+
const PinMap *pwmout_pinmap(void);
120+
111121
/**@}*/
112122

113123
#ifdef __cplusplus

targets/TARGET_Atmel/TARGET_SAM_CortexM0P/pwmout_api.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,3 +300,8 @@ void pwmout_pulsewidth_us(pwmout_t* obj, int us)
300300
/* This call updates pulse width as well as period */
301301
pwmout_write(obj, duty_cycle);
302302
}
303+
304+
const PinMap *pwmout_pinmap()
305+
{
306+
return PinMap_PWM;
307+
}

targets/TARGET_Atmel/TARGET_SAM_CortexM4/pwmout_api.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,3 +305,8 @@ void pwmout_pulsewidth_us(pwmout_t* obj, int us)
305305
float new_duty = (us / 1000000.0) * (float)obj->waveconfig.us_frequency;
306306
pwmout_write(obj, new_duty);
307307
}
308+
309+
const PinMap *pwmout_pinmap()
310+
{
311+
return PinMap_PWM;
312+
}

targets/TARGET_Cypress/TARGET_PSOC6/pwmout_api.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,3 +339,8 @@ void pwmout_pulsewidth_us(pwmout_t *obj, int us)
339339
}
340340
pwm_start(obj, obj->period, us);
341341
}
342+
343+
const PinMap *pwmout_pinmap()
344+
{
345+
return PinMap_PWM_OUT;
346+
}

targets/TARGET_Cypress/TARGET_PSOC6_FUTURE/pwmout_api.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -319,3 +319,8 @@ void pwmout_pulsewidth_us(pwmout_t *obj, int us)
319319
}
320320
pwm_start(obj, obj->period, us);
321321
}
322+
323+
const PinMap *pwmout_pinmap()
324+
{
325+
return PinMap_PWM_OUT;
326+
}

targets/TARGET_Freescale/TARGET_K20XX/pwmout_api.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,3 +117,8 @@ void pwmout_pulsewidth_us(pwmout_t* obj, int us) {
117117
*obj->CnV = (uint32_t)(pwm_clock * (float)us);
118118
*obj->SYNC |= FTM_SYNC_SWSYNC_MASK;
119119
}
120+
121+
const PinMap *pwmout_pinmap()
122+
{
123+
return PinMap_PWM;
124+
}

targets/TARGET_Freescale/TARGET_KLXX/pwmout_api.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,3 +123,8 @@ void pwmout_pulsewidth_ms(pwmout_t* obj, int ms) {
123123
void pwmout_pulsewidth_us(pwmout_t* obj, int us) {
124124
*obj->CnV = (uint32_t)(pwm_clock * (float)us);
125125
}
126+
127+
const PinMap *pwmout_pinmap()
128+
{
129+
return PinMap_PWM;
130+
}

targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_K66F/pwmout_api.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,4 +150,9 @@ void pwmout_pulsewidth_us(pwmout_t* obj, int us)
150150
FTM_SetSoftwareTrigger(base, true);
151151
}
152152

153+
const PinMap *pwmout_pinmap()
154+
{
155+
return PinMap_PWM;
156+
}
157+
153158
#endif

targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_K82F/pwmout_api.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,4 +150,9 @@ void pwmout_pulsewidth_us(pwmout_t* obj, int us)
150150
FTM_SetSoftwareTrigger(base, true);
151151
}
152152

153+
const PinMap *pwmout_pinmap()
154+
{
155+
return PinMap_PWM;
156+
}
157+
153158
#endif

targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_KL27Z/pwmout_api.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,4 +145,9 @@ void pwmout_pulsewidth_us(pwmout_t* obj, int us)
145145
base->CONTROLS[obj->pwm_name & 0xF].CnV = value;
146146
}
147147

148+
const PinMap *pwmout_pinmap()
149+
{
150+
return PinMap_PWM;
151+
}
152+
148153
#endif

0 commit comments

Comments
 (0)