Added pin descriptions for NUCLEO-F303RE. Tested

Fork of FastPWM by Erik -

Committer:
alpsayin
Date:
Wed Sep 30 20:46:18 2015 +0000
Revision:
25:8b1bf34c72aa
Parent:
4:a7b9f778c4b4
added pins for ST32F303RE

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Sissors 4:a7b9f778c4b4 1 #ifdef TARGET_LPC1768
Sissors 4:a7b9f778c4b4 2
Sissors 4:a7b9f778c4b4 3 #include "FastPWM.h"
Sissors 4:a7b9f778c4b4 4
Sissors 4:a7b9f778c4b4 5 void FastPWM::initFastPWM( void ) {
Sissors 4:a7b9f778c4b4 6 //Set clock source
Sissors 4:a7b9f778c4b4 7 LPC_SC->PCLKSEL0|=1<<12;
Sissors 4:a7b9f778c4b4 8 bits = 32;
Sissors 4:a7b9f778c4b4 9 }
Sissors 4:a7b9f778c4b4 10
Sissors 4:a7b9f778c4b4 11 void FastPWM::pulsewidth_ticks( uint32_t ticks ) {
Sissors 4:a7b9f778c4b4 12 *(_pwm.MR) = ticks;
Sissors 4:a7b9f778c4b4 13 LPC_PWM1->LER |= 1 << _pwm.pwm;
Sissors 4:a7b9f778c4b4 14 }
Sissors 4:a7b9f778c4b4 15
Sissors 4:a7b9f778c4b4 16 void FastPWM::period_ticks( uint32_t ticks ) {
Sissors 4:a7b9f778c4b4 17 LPC_PWM1->MR0 = ticks;
Sissors 4:a7b9f778c4b4 18 LPC_PWM1->LER |= 1 << 0;
Sissors 4:a7b9f778c4b4 19 }
Sissors 4:a7b9f778c4b4 20
Sissors 4:a7b9f778c4b4 21 uint32_t FastPWM::getPeriod( void ) {
Sissors 4:a7b9f778c4b4 22 return LPC_PWM1->MR0;
Sissors 4:a7b9f778c4b4 23 }
Sissors 4:a7b9f778c4b4 24
Sissors 4:a7b9f778c4b4 25 //Maybe implemented later, but needing to change the prescaler for a 32-bit
Sissors 4:a7b9f778c4b4 26 //timer used in PWM mode is kinda unlikely.
Sissors 4:a7b9f778c4b4 27 //If you really need to do it, rejoice, you can make it run so slow a period is over 40,000 year
Sissors 4:a7b9f778c4b4 28 uint32_t FastPWM::setPrescaler(uint32_t reqScale) {
Sissors 4:a7b9f778c4b4 29 //Disable dynamic prescaling
Sissors 4:a7b9f778c4b4 30 dynamicPrescaler = false;
Sissors 4:a7b9f778c4b4 31
Sissors 4:a7b9f778c4b4 32 return 1;
Sissors 4:a7b9f778c4b4 33 }
Sissors 4:a7b9f778c4b4 34 #endif