added prescaler for 16 bit pwm in LPC1347 target

Fork of mbed-dev by mbed official

Committer:
JojoS
Date:
Sat Sep 10 15:32:04 2016 +0000
Revision:
147:ba84b7dc41a7
Parent:
144:ef7eb2e8f9f7
added prescaler for 16 bit timers (solution as in LPC11xx), default prescaler 31 for max 28 ms period time

Who changed what in which revision?

UserRevisionLine numberNew contents of line
<> 144:ef7eb2e8f9f7 1 /* mbed Microcontroller Library
<> 144:ef7eb2e8f9f7 2 * Copyright (c) 2006-2013 ARM Limited
<> 144:ef7eb2e8f9f7 3 *
<> 144:ef7eb2e8f9f7 4 * Licensed under the Apache License, Version 2.0 (the "License");
<> 144:ef7eb2e8f9f7 5 * you may not use this file except in compliance with the License.
<> 144:ef7eb2e8f9f7 6 * You may obtain a copy of the License at
<> 144:ef7eb2e8f9f7 7 *
<> 144:ef7eb2e8f9f7 8 * http://www.apache.org/licenses/LICENSE-2.0
<> 144:ef7eb2e8f9f7 9 *
<> 144:ef7eb2e8f9f7 10 * Unless required by applicable law or agreed to in writing, software
<> 144:ef7eb2e8f9f7 11 * distributed under the License is distributed on an "AS IS" BASIS,
<> 144:ef7eb2e8f9f7 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<> 144:ef7eb2e8f9f7 13 * See the License for the specific language governing permissions and
<> 144:ef7eb2e8f9f7 14 * limitations under the License.
<> 144:ef7eb2e8f9f7 15 */
<> 144:ef7eb2e8f9f7 16 #ifndef MBED_GPIO_IRQ_API_H
<> 144:ef7eb2e8f9f7 17 #define MBED_GPIO_IRQ_API_H
<> 144:ef7eb2e8f9f7 18
<> 144:ef7eb2e8f9f7 19 #include "device.h"
<> 144:ef7eb2e8f9f7 20
<> 144:ef7eb2e8f9f7 21 #if DEVICE_INTERRUPTIN
<> 144:ef7eb2e8f9f7 22
<> 144:ef7eb2e8f9f7 23 #ifdef __cplusplus
<> 144:ef7eb2e8f9f7 24 extern "C" {
<> 144:ef7eb2e8f9f7 25 #endif
<> 144:ef7eb2e8f9f7 26
<> 144:ef7eb2e8f9f7 27 /** GPIO IRQ events
<> 144:ef7eb2e8f9f7 28 */
<> 144:ef7eb2e8f9f7 29 typedef enum {
<> 144:ef7eb2e8f9f7 30 IRQ_NONE,
<> 144:ef7eb2e8f9f7 31 IRQ_RISE,
<> 144:ef7eb2e8f9f7 32 IRQ_FALL
<> 144:ef7eb2e8f9f7 33 } gpio_irq_event;
<> 144:ef7eb2e8f9f7 34
<> 144:ef7eb2e8f9f7 35 /** GPIO IRQ HAL structure. gpio_irq_s is declared in the target's HAL
<> 144:ef7eb2e8f9f7 36 */
<> 144:ef7eb2e8f9f7 37 typedef struct gpio_irq_s gpio_irq_t;
<> 144:ef7eb2e8f9f7 38
<> 144:ef7eb2e8f9f7 39 typedef void (*gpio_irq_handler)(uint32_t id, gpio_irq_event event);
<> 144:ef7eb2e8f9f7 40
<> 144:ef7eb2e8f9f7 41 /**
<> 144:ef7eb2e8f9f7 42 * \defgroup hal_gpioirq GPIO IRQ HAL functions
<> 144:ef7eb2e8f9f7 43 * @{
<> 144:ef7eb2e8f9f7 44 */
<> 144:ef7eb2e8f9f7 45
<> 144:ef7eb2e8f9f7 46 /** Initialize the GPIO IRQ pin
<> 144:ef7eb2e8f9f7 47 *
<> 144:ef7eb2e8f9f7 48 * @param obj The GPIO object to initialize
<> 144:ef7eb2e8f9f7 49 * @param pin The GPIO pin name
<> 144:ef7eb2e8f9f7 50 * @param handler The handler to be attached to GPIO IRQ
<> 144:ef7eb2e8f9f7 51 * @param id The object ID (id != 0, 0 is reserved)
<> 144:ef7eb2e8f9f7 52 * @return -1 if pin is NC, 0 otherwise
<> 144:ef7eb2e8f9f7 53 */
<> 144:ef7eb2e8f9f7 54 int gpio_irq_init(gpio_irq_t *obj, PinName pin, gpio_irq_handler handler, uint32_t id);
<> 144:ef7eb2e8f9f7 55
<> 144:ef7eb2e8f9f7 56 /** Release the GPIO IRQ PIN
<> 144:ef7eb2e8f9f7 57 *
<> 144:ef7eb2e8f9f7 58 * @param obj The gpio object
<> 144:ef7eb2e8f9f7 59 */
<> 144:ef7eb2e8f9f7 60 void gpio_irq_free(gpio_irq_t *obj);
<> 144:ef7eb2e8f9f7 61
<> 144:ef7eb2e8f9f7 62 /** Enable/disable pin IRQ event
<> 144:ef7eb2e8f9f7 63 *
<> 144:ef7eb2e8f9f7 64 * @param obj The GPIO object
<> 144:ef7eb2e8f9f7 65 * @param event The GPIO IRQ event
<> 144:ef7eb2e8f9f7 66 * @param enable The enable flag
<> 144:ef7eb2e8f9f7 67 */
<> 144:ef7eb2e8f9f7 68 void gpio_irq_set(gpio_irq_t *obj, gpio_irq_event event, uint32_t enable);
<> 144:ef7eb2e8f9f7 69
<> 144:ef7eb2e8f9f7 70 /** Enable GPIO IRQ
<> 144:ef7eb2e8f9f7 71 *
<> 144:ef7eb2e8f9f7 72 * This is target dependent, as it might enable the entire port or just a pin
<> 144:ef7eb2e8f9f7 73 * @param obj The GPIO object
<> 144:ef7eb2e8f9f7 74 */
<> 144:ef7eb2e8f9f7 75 void gpio_irq_enable(gpio_irq_t *obj);
<> 144:ef7eb2e8f9f7 76
<> 144:ef7eb2e8f9f7 77 /** Disable GPIO IRQ
<> 144:ef7eb2e8f9f7 78 *
<> 144:ef7eb2e8f9f7 79 * This is target dependent, as it might disable the entire port or just a pin
<> 144:ef7eb2e8f9f7 80 * @param obj The GPIO object
<> 144:ef7eb2e8f9f7 81 */
<> 144:ef7eb2e8f9f7 82 void gpio_irq_disable(gpio_irq_t *obj);
<> 144:ef7eb2e8f9f7 83
<> 144:ef7eb2e8f9f7 84 /**@}*/
<> 144:ef7eb2e8f9f7 85
<> 144:ef7eb2e8f9f7 86 #ifdef __cplusplus
<> 144:ef7eb2e8f9f7 87 }
<> 144:ef7eb2e8f9f7 88 #endif
<> 144:ef7eb2e8f9f7 89
<> 144:ef7eb2e8f9f7 90 #endif
<> 144:ef7eb2e8f9f7 91
<> 144:ef7eb2e8f9f7 92 #endif