parent
a17830030e
commit
3158445208
2 changed files with 17 additions and 5 deletions
|
@ -154,6 +154,11 @@ class MicroBitPin : public MicroBitComponent
|
|||
* @param period The new period for the analog output in milliseconds.
|
||||
*/
|
||||
void setAnalogPeriod(int period);
|
||||
|
||||
/**
|
||||
* Same thing as setAnalogPeriodUs, but with microseconds.
|
||||
*/
|
||||
void setAnalogPeriodUs(int period);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -205,11 +205,18 @@ int MicroBitPin::isTouched()
|
|||
* If this pin is not configured as an analog output, the operation
|
||||
* has no effect.
|
||||
*
|
||||
* @param period The new period for the analog output in milliseconds.
|
||||
*/
|
||||
void MicroBitPin::setAnalogPeriod(int period)
|
||||
* @param period The new period for the analog output in microseconds.
|
||||
*/
|
||||
void MicroBitPin::setAnalogPeriodUs(int period)
|
||||
{
|
||||
if (status & IO_STATUS_ANALOG_OUT)
|
||||
((DynamicPwm *)pin)->setPeriodUs(period*1000);
|
||||
|
||||
((DynamicPwm *)pin)->setPeriodUs(period);
|
||||
}
|
||||
|
||||
/**
|
||||
* Same thing as setAnalogPeriodUs, but with milliseconds.
|
||||
*/
|
||||
void MicroBitPin::setAnalogPeriod(int period)
|
||||
{
|
||||
setAnalogPeriodUs(period*1000);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue