Hello Rioters,
I am using a samr21 and I want to connect some peripheral devices
(one motion sensor, its connected to the pin_17 and if there is motion I will get an 1 as input, and a speaker, I will create a frequence with the osciloscope and then send it to the speaker). Is there any library which takes care of these staff?? Any example or any help overall will be appreciated. Thank you in advance!
Hi,
Thanks Peter, The idea is if the pir detects something, then the speaker will produce a sound, for example for 2 minutes, then a udp message will be sent. I have some questions(as a newbie ) :
I didn’t find the pwm.c file, maybe someone erased it during a clean up operation?
-Is there any example of using the pwm lib? (mostly on the sequence of the function call)
There is a variable dev that points to the speaker device(as mentioned this lib was used with virtual devices), is there a specific integer for one device or it doesn’t matter? (
I would like a small explanation of the value “TCC_CTRLA_PRESCALER_DIV*_VAL” in line 84 in [1], is it possible to add the equivelant value of the “TC_CLOCK_PRESCALER_DIV1”(as found from the atmel studio).
I don't know details about the PWM clock generation on this
microcontroller *but* "TCC_CLOCK_PRESCALER_DIV1" means "no division of
the source clock". That will be the case when (compare [1]):
CLOCK_CORECLOCK / (freq * res) = 1 .
Calling the function like this: get_prescaler(1, &scale), returns 0
(same value as TCC_CTRLA_PRESCALER_DIV1_Val) resulting in no prescaler
selection here [2]. That's why I assume the feature you want should be
already there, or am I mistaken?
In case you convince me of the contrary :-), there's nothing against
improving the peripheral driver implementation.