]>
git.gir.st - tmk_keyboard.git/blob - tmk_core/tool/mbed/mbed-sdk/libraries/tests/mbed/pwm/main.cpp
3 /* Timer/Match Register Pinout Options
10 CT16B1/MR1 p20 (P0_22) and p14 (P1_23)
12 CT32B0/MR0 p25 (P1_24)
13 CT32B0/MR1 p26 (P1_25) and USBTX (P0_19)
14 CT32B0/MR2 p10 (P1_26)
20 #if defined(TARGET_FF_ARDUINO)
26 float result
= floor(pwm
.read() * 100 + 0.5) / 100; // round it to 0.xx
27 printf("Initialize PWM on pin D9 with duty cycle: %.2f\n", result
);
29 notify_completion(result
== value
? true : false);
31 #elif defined(TARGET_LPC1768) || defined(TARGET_LPC2368) || defined(TARGET_LPC11U24) || defined(TARGET_LPC4088)
38 printf("Initialize PWM on pin 25 with duty cycle: %.2f\n", pwm_p25
.read());
39 printf("Initialize PWM on pin 26 with duty cycle: %.2f\n", pwm_p26
.read());
41 #elif defined(TARGET_LPC1114)
42 PwmOut
pwm_dp24(dp24
); // P0_1
43 PwmOut
pwm_dp18(dp18
); // P1_9
48 printf("Initialize PWM on pin 24 with duty cycle: %.2f\n", pwm_dp24
.read());
49 printf("Initialize PWM on pin 18 with duty cycle: %.2f\n", pwm_dp18
.read());
51 #elif defined(TARGET_nRF51822)
58 printf("Initialize PWM on pin 24 with duty cycle: %.2f\n", pwm_p24
.read());
59 printf("Initialize PWM on pin 25 with duty cycle: %.2f\n", pwm_p25
.read());
61 #elif defined(TARGET_DISCO_F100RB)
68 printf("Initialize PWM on pin PB_3 with duty cycle: %.2f\n", pwm_1
.read());
69 printf("Initialize PWM on pin PB_4 with duty cycle: %.2f\n", pwm_2
.read());
70 #elif defined(TARGET_DISCO_F051R8)
77 printf("Initialize PWM on pin PA_7 with duty cycle: %.2f\n", pwm_1
.read());
78 printf("Initialize PWM on pin PC_7 with duty cycle: %.2f\n", pwm_2
.read());
79 #elif defined(TARGET_DISCO_F303VC)
86 printf("Initialize PWM on pin PA_7 with duty cycle: %.2f\n", pwm_1
.read());
87 printf("Initialize PWM on pin PC_7 with duty cycle: %.2f\n", pwm_2
.read());
88 #elif defined(TARGET_MAXWSNENV)
95 printf("Initialize PWM on pin TP2 with duty cycle: %.2f\n", pwm_1
.read());
96 printf("Initialize PWM on pin TP4 with duty cycle: %.2f\n", pwm_2
.read());
97 #elif defined(TARGET_DISCO_F407VG)
104 float result
= floor(pwm_1
.read() * 100 + 0.5) / 100; // round it to 0.xx
106 printf("Initialize PWM on pin PD_12 with duty cycle: %.2f\n", result
);
107 printf("Initialize PWM on pin PD_13 with duty cycle: %.2f\n", pwm_2
.read());
109 notify_completion(result
== value
? true : false);
110 #elif defined(TARGET_DISCO_F429ZI)
115 float result
= floor(pwm_1
.read() * 100 + 0.5) / 100; // round it to 0.xx
117 printf("Initialize PWM on pin PD_12 with duty cycle: %.2f\n", result
);
119 notify_completion(result
== value
? true : false);
120 #elif defined(TARGET_MTS_MDOT_F405RG)
125 float result
= floor(pwm_1
.read() * 100 + 0.5) / 100; // round it to 0.xx
127 printf("Initialize PWM on pin PD_12 with duty cycle: %.2f\n", result
);
129 notify_completion(result
== value
? true : false);
130 #elif defined(TARGET_MTS_DRAGONFLY_F411RE)
135 float result
= floor(pwm_1
.read() * 100 + 0.5) / 100; // round it to 0.xx
137 printf("Initialize PWM on pin PD_12 with duty cycle: %.2f\n", result
);
139 notify_completion(result
== value
? true : false);
140 #elif defined(TARGET_MTS_MDOT_F411RE)
145 float result
= floor(pwm_1
.read() * 100 + 0.5) / 100; // round it to 0.xx
147 printf("Initialize PWM on pin PD_12 with duty cycle: %.2f\n", result
);
149 notify_completion(result
== value
? true : false);
150 #elif defined(TARGET_UBLOX_C029)
155 float result
= floor(pwm_1
.read() * 100 + 0.5) / 100; // round it to 0.xx
157 printf("Initialize PWM on pin PD_12 with duty cycle: %.2f\n", result
);
159 notify_completion(result
== value
? true : false);
160 #elif defined(TARGET_MAX32600MBED)
167 printf("Initialize PWM on pin P1.2 with duty cycle: %.2f\n", pwm_1
.read());
168 printf("Initialize PWM on pin P1.3 with duty cycle: %.2f\n", pwm_2
.read());
170 #error This test is not supported on this target.
173 notify_completion(true);