Patch for EK-LM3S6965 PWM1/Speaker

classic Classic list List threaded Threaded
2 messages Options
jbsnyder jbsnyder
Reply | Threaded
Open this post in threaded view
|

Patch for EK-LM3S6965 PWM1/Speaker

Hi -

I noticed that I wasn't able to get the piano example working on my device, and I tracked it down to the pwm_ports definitions in platform.c.  Here's a patch that corrects PWM1 to be on PORTD of the LM3S6965:

diff --git a/src/platform/lm3s/platform.c b/src/platform/lm3s/platform.c
index 34033ed..4097999 100644
--- a/src/platform/lm3s/platform.c
+++ b/src/platform/lm3s/platform.c
@@ -367,7 +367,11 @@ u32 platform_s_timer_op( unsigned id, int op, u32 data )
 const static u32 pwm_div_ctl[] = { SYSCTL_PWMDIV_1, SYSCTL_PWMDIV_2, SYSCTL_PWMDIV_4, SYSCTL_PWMDIV_8, SYSCTL_PWMDIV_16, SYSCTL_PWMDIV_32, SYSCTL_PWMDIV_64 };
 const static u8 pwm_div_data[] = { 1, 2, 4, 8, 16, 32, 64 };
 // Port/pin information for all channels
+#ifdef FORLM3S6965
+const static u32 pwm_ports[] =  { GPIO_PORTF_BASE, GPIO_PORTD_BASE, GPIO_PORTB_BASE, GPIO_PORTB_BASE, GPIO_PORTE_BASE, GPIO_PORTE_BASE };  
+#else
 const static u32 pwm_ports[] =  { GPIO_PORTF_BASE, GPIO_PORTG_BASE, GPIO_PORTB_BASE, GPIO_PORTB_BASE, GPIO_PORTE_BASE, GPIO_PORTE_BASE };
+#endif
 const static u8 pwm_pins[] = { GPIO_PIN_0, GPIO_PIN_1, GPIO_PIN_0, GPIO_PIN_1, GPIO_PIN_0, GPIO_PIN_1 };
 // PWM generators
 const static u16 pwm_gens[] = { PWM_GEN_0, PWM_GEN_1, PWM_GEN_2 };

Works great now :)

BogdanM BogdanM
Reply | Threaded
Open this post in threaded view
|

Patch for EK-LM3S6965 PWM1/Speaker

Hi,

Thanks for the patch. I'm going to check in this one, but as a general rule
every contributor should be able to check in his own code, things go easier
this way. So, if you're thinking to do more modifications/additions to the
code, please give me your BerliOS ID so I can add it to the list of
developers.

Best,
Bogdan

On Thu, Jan 8, 2009 at 7:09 AM, James Snyder <jbsnyder at fanplastic.org>wrote:

> Hi -
>
> I noticed that I wasn't able to get the piano example working on my device,
> and I tracked it down to the pwm_ports definitions in platform.c.  Here's a
> patch that corrects PWM1 to be on PORTD of the LM3S6965:
>
> diff --git a/src/platform/lm3s/platform.c b/src/platform/lm3s/platform.c
> index 34033ed..4097999 100644
> --- a/src/platform/lm3s/platform.c
> +++ b/src/platform/lm3s/platform.c
> @@ -367,7 +367,11 @@ u32 platform_s_timer_op( unsigned id, int op, u32 data
> )
>  const static u32 pwm_div_ctl[] = { SYSCTL_PWMDIV_1, SYSCTL_PWMDIV_2,
> SYSCTL_PWMDIV_4, SYSCTL_PWMDIV_8, SYSCTL_PWMDIV_16, SYSCTL_PWMDIV_32,
> SYSCTL_PWMDIV_64 };
>  const static u8 pwm_div_data[] = { 1, 2, 4, 8, 16, 32, 64 };
>  // Port/pin information for all channels
> +#ifdef FORLM3S6965
> +const static u32 pwm_ports[] =  { GPIO_PORTF_BASE, GPIO_PORTD_BASE,
> GPIO_PORTB_BASE, GPIO_PORTB_BASE, GPIO_PORTE_BASE, GPIO_PORTE_BASE };
> +#else
>  const static u32 pwm_ports[] =  { GPIO_PORTF_BASE, GPIO_PORTG_BASE,
> GPIO_PORTB_BASE, GPIO_PORTB_BASE, GPIO_PORTE_BASE, GPIO_PORTE_BASE };
> +#endif
>  const static u8 pwm_pins[] = { GPIO_PIN_0, GPIO_PIN_1, GPIO_PIN_0,
> GPIO_PIN_1, GPIO_PIN_0, GPIO_PIN_1 };
>  // PWM generators
>  const static u16 pwm_gens[] = { PWM_GEN_0, PWM_GEN_1, PWM_GEN_2 };
>
> Works great now :)
> _______________________________________________
> Elua-dev mailing list
> Elua-dev at lists.berlios.de
> https://lists.berlios.de/mailman/listinfo/elua-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://lists.berlios.de/pipermail/elua-dev/attachments/20090108/46e53968/attachment.html