added prescaler for 16 bit pwm in LPC1347 target
Fork of mbed-dev by
targets/hal/TARGET_ONSEMI/TARGET_NCS36510/char_driver.h@147:ba84b7dc41a7, 2016-09-10 (annotated)
- 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?
User | Revision | Line number | New contents of line |
---|---|---|---|
<> | 144:ef7eb2e8f9f7 | 1 | /** |
<> | 144:ef7eb2e8f9f7 | 2 | ****************************************************************************** |
<> | 144:ef7eb2e8f9f7 | 3 | * @file char_driver.h |
<> | 144:ef7eb2e8f9f7 | 4 | * @brief Defines a character driver data type. |
<> | 144:ef7eb2e8f9f7 | 5 | * @internal |
<> | 144:ef7eb2e8f9f7 | 6 | * @author ON Semiconductor |
<> | 144:ef7eb2e8f9f7 | 7 | * $Rev: 2607 $ |
<> | 144:ef7eb2e8f9f7 | 8 | * $Date: 2013-12-06 18:02:43 +0530 (Fri, 06 Dec 2013) $ |
<> | 144:ef7eb2e8f9f7 | 9 | ****************************************************************************** |
<> | 144:ef7eb2e8f9f7 | 10 | * @copyright (c) 2012 ON Semiconductor. All rights reserved. |
<> | 144:ef7eb2e8f9f7 | 11 | * ON Semiconductor is supplying this software for use with ON Semiconductor |
<> | 144:ef7eb2e8f9f7 | 12 | * processor based microcontrollers only. |
<> | 144:ef7eb2e8f9f7 | 13 | * |
<> | 144:ef7eb2e8f9f7 | 14 | * THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED |
<> | 144:ef7eb2e8f9f7 | 15 | * OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF |
<> | 144:ef7eb2e8f9f7 | 16 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. |
<> | 144:ef7eb2e8f9f7 | 17 | * ON SEMICONDUCTOR SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, |
<> | 144:ef7eb2e8f9f7 | 18 | * INCIDENTAL, OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. |
<> | 144:ef7eb2e8f9f7 | 19 | * @endinternal |
<> | 144:ef7eb2e8f9f7 | 20 | * |
<> | 144:ef7eb2e8f9f7 | 21 | * @details |
<> | 144:ef7eb2e8f9f7 | 22 | * The character driver is intended for devices that allow read and write |
<> | 144:ef7eb2e8f9f7 | 23 | * operations with "streams" of data, such as UART devices, SPI or I2c, etc. |
<> | 144:ef7eb2e8f9f7 | 24 | * |
<> | 144:ef7eb2e8f9f7 | 25 | * The character driver derives from the generic driver template (see driver.h). |
<> | 144:ef7eb2e8f9f7 | 26 | * It does so by including an element of the generic driver_t type. |
<> | 144:ef7eb2e8f9f7 | 27 | * |
<> | 144:ef7eb2e8f9f7 | 28 | * The driver defines blocking and non-blocking read and write operations. It is |
<> | 144:ef7eb2e8f9f7 | 29 | * up to the driver implementation to decide which of these to actually implement. |
<> | 144:ef7eb2e8f9f7 | 30 | * |
<> | 144:ef7eb2e8f9f7 | 31 | * @ingroup char_drivers |
<> | 144:ef7eb2e8f9f7 | 32 | */ |
<> | 144:ef7eb2e8f9f7 | 33 | |
<> | 144:ef7eb2e8f9f7 | 34 | #ifndef CHAR_DRIVER_H_ |
<> | 144:ef7eb2e8f9f7 | 35 | #define CHAR_DRIVER_H_ |
<> | 144:ef7eb2e8f9f7 | 36 | |
<> | 144:ef7eb2e8f9f7 | 37 | #include "driver.h" |
<> | 144:ef7eb2e8f9f7 | 38 | |
<> | 144:ef7eb2e8f9f7 | 39 | #define DRV_NO_ERROR (True) |
<> | 144:ef7eb2e8f9f7 | 40 | #define DRV_ERROR (False) |
<> | 144:ef7eb2e8f9f7 | 41 | |
<> | 144:ef7eb2e8f9f7 | 42 | /** A character driver structure. */ |
<> | 144:ef7eb2e8f9f7 | 43 | typedef struct char_driver { |
<> | 144:ef7eb2e8f9f7 | 44 | /** The parent generic driver. */ |
<> | 144:ef7eb2e8f9f7 | 45 | driver_t driver; |
<> | 144:ef7eb2e8f9f7 | 46 | |
<> | 144:ef7eb2e8f9f7 | 47 | /** Blocking read into a buffer. |
<> | 144:ef7eb2e8f9f7 | 48 | * @param device The device to read from. |
<> | 144:ef7eb2e8f9f7 | 49 | * @param buf The buffer to read into. |
<> | 144:ef7eb2e8f9f7 | 50 | * @param len The number of bytes to read. |
<> | 144:ef7eb2e8f9f7 | 51 | */ |
<> | 144:ef7eb2e8f9f7 | 52 | uint8_t (*read_b)(device_pt device, uint8_t *const buf, uint32_t len); |
<> | 144:ef7eb2e8f9f7 | 53 | |
<> | 144:ef7eb2e8f9f7 | 54 | /** Non-blocking read into a buffer. |
<> | 144:ef7eb2e8f9f7 | 55 | * @param device The device to read from. |
<> | 144:ef7eb2e8f9f7 | 56 | * @param buf The buffer to read into. |
<> | 144:ef7eb2e8f9f7 | 57 | * @param len The maximum number of bytes to read; typically the size of the buffer. |
<> | 144:ef7eb2e8f9f7 | 58 | * @return The number of bytes actually read. |
<> | 144:ef7eb2e8f9f7 | 59 | */ |
<> | 144:ef7eb2e8f9f7 | 60 | uint32_t (*read_nb)(device_pt device, uint8_t *const buf, uint32_t len); |
<> | 144:ef7eb2e8f9f7 | 61 | |
<> | 144:ef7eb2e8f9f7 | 62 | /** Blocking write from a buffer. |
<> | 144:ef7eb2e8f9f7 | 63 | * @param device The device to write to. |
<> | 144:ef7eb2e8f9f7 | 64 | * @param buf The buffer to read from. |
<> | 144:ef7eb2e8f9f7 | 65 | * @param len The number of bytes to write; typically the size of the buffer. |
<> | 144:ef7eb2e8f9f7 | 66 | * @return success or error message |
<> | 144:ef7eb2e8f9f7 | 67 | */ |
<> | 144:ef7eb2e8f9f7 | 68 | uint8_t (*write_b)(device_pt device, const uint8_t *buf, uint32_t len); |
<> | 144:ef7eb2e8f9f7 | 69 | |
<> | 144:ef7eb2e8f9f7 | 70 | /** Non-blocking write from a buffer. |
<> | 144:ef7eb2e8f9f7 | 71 | * @param device The device to write to. |
<> | 144:ef7eb2e8f9f7 | 72 | * @param buf The buffer to read from. |
<> | 144:ef7eb2e8f9f7 | 73 | * @param len The number of bytes to write; typically the size of the buffer. |
<> | 144:ef7eb2e8f9f7 | 74 | * @return success or error message |
<> | 144:ef7eb2e8f9f7 | 75 | */ |
<> | 144:ef7eb2e8f9f7 | 76 | uint8_t (*write_nb)(device_pt device, const uint8_t *buf, uint32_t len); |
<> | 144:ef7eb2e8f9f7 | 77 | } char_driver_t, *char_driver_pt; |
<> | 144:ef7eb2e8f9f7 | 78 | |
<> | 144:ef7eb2e8f9f7 | 79 | #endif /* CHAR_DRIVER_H_ */ |