mbed libraries for KL25Z
Diff: pwmout_api.h
- Revision:
- 2:e9a661555b58
- Child:
- 3:aff886a69715
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/pwmout_api.h Wed Oct 10 14:14:12 2012 +0000 @@ -0,0 +1,53 @@ +/* mbed Microcontroller Library - pwmout_api + * Copyright (c) 2009-2011 ARM Limited. All rights reserved. + */ + +#ifndef MBED_PWMOUT_API_H +#define MBED_PWMOUT_API_H + +#include "device.h" + +#if DEVICE_PWMOUT + +#include "PinNames.h" +#include "PeripheralNames.h" + +#ifdef __cplusplus +extern "C" { +#endif + +// Todo: Remove the lookup tables and add the actual values in the object +typedef struct { +#if defined(TARGET_LPC1768) || defined(TARGET_LPC2368) + __IO uint32_t MR; + PWMName pwm; +#elif defined(TARGET_LPC11U24) + PWMName pwm; +#elif defined(TARGET_KL25Z) + __IO uint32_t *MOD; + __IO uint32_t *CNT; + __IO uint32_t *CnV; +#endif +} pwmout_object; + +void pwmout_init (pwmout_object* obj, PinName pin); +void pwmout_free (pwmout_object* obj); + +void pwmout_write (pwmout_object* obj, float percent); +float pwmout_read (pwmout_object* obj); + +void pwmout_period (pwmout_object* obj, float seconds); +void pwmout_period_ms (pwmout_object* obj, int ms); +void pwmout_period_us (pwmout_object* obj, int us); + +void pwmout_pulsewidth (pwmout_object* obj, float seconds); +void pwmout_pulsewidth_ms(pwmout_object* obj, int ms); +void pwmout_pulsewidth_us(pwmout_object* obj, int us); + +#ifdef __cplusplus +} +#endif + +#endif + +#endif