mbed libraries for KL25Z

Dependents:   FRDM_RGBLED

pwmout_api.h

Committer:
emilmont
Date:
2012-10-11
Revision:
3:aff886a69715
Parent:
2:e9a661555b58
Child:
8:c14af7958ef5

File content as of revision 3:aff886a69715:

/* 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