LPC11U35 ADC Tick & USBSerial

Dependencies:   mbed

Dependents:   SmallDoseMeter_SingleCH_AE_lpc11u35_V1_00

Committer:
H_Tsunemoto
Date:
Mon Feb 19 09:09:52 2018 +0000
Revision:
1:b1a3be5f48ab
Parent:
0:871ab6846b18
test

Who changed what in which revision?

UserRevisionLine numberNew contents of line
H_Tsunemoto 0:871ab6846b18 1 /* mbed Microcontroller Library
H_Tsunemoto 0:871ab6846b18 2 * Copyright (c) 2006-2013 ARM Limited
H_Tsunemoto 0:871ab6846b18 3 *
H_Tsunemoto 0:871ab6846b18 4 * Licensed under the Apache License, Version 2.0 (the "License");
H_Tsunemoto 0:871ab6846b18 5 * you may not use this file except in compliance with the License.
H_Tsunemoto 0:871ab6846b18 6 * You may obtain a copy of the License at
H_Tsunemoto 0:871ab6846b18 7 *
H_Tsunemoto 0:871ab6846b18 8 * http://www.apache.org/licenses/LICENSE-2.0
H_Tsunemoto 0:871ab6846b18 9 *
H_Tsunemoto 0:871ab6846b18 10 * Unless required by applicable law or agreed to in writing, software
H_Tsunemoto 0:871ab6846b18 11 * distributed under the License is distributed on an "AS IS" BASIS,
H_Tsunemoto 0:871ab6846b18 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
H_Tsunemoto 0:871ab6846b18 13 * See the License for the specific language governing permissions and
H_Tsunemoto 0:871ab6846b18 14 * limitations under the License.
H_Tsunemoto 0:871ab6846b18 15 */
H_Tsunemoto 0:871ab6846b18 16 #ifndef MBED_RAW_SERIAL_H
H_Tsunemoto 0:871ab6846b18 17 #define MBED_RAW_SERIAL_H
H_Tsunemoto 0:871ab6846b18 18
H_Tsunemoto 0:871ab6846b18 19 #include "platform.h"
H_Tsunemoto 0:871ab6846b18 20
H_Tsunemoto 0:871ab6846b18 21 #if DEVICE_SERIAL
H_Tsunemoto 0:871ab6846b18 22
H_Tsunemoto 0:871ab6846b18 23 #include "SerialBase.h"
H_Tsunemoto 0:871ab6846b18 24 #include "serial_api.h"
H_Tsunemoto 0:871ab6846b18 25
H_Tsunemoto 0:871ab6846b18 26 namespace mbed {
H_Tsunemoto 0:871ab6846b18 27
H_Tsunemoto 0:871ab6846b18 28 /** A serial port (UART) for communication with other serial devices
H_Tsunemoto 0:871ab6846b18 29 * This is a variation of the Serial class that doesn't use streams,
H_Tsunemoto 0:871ab6846b18 30 * thus making it safe to use in interrupt handlers with the RTOS.
H_Tsunemoto 0:871ab6846b18 31 *
H_Tsunemoto 0:871ab6846b18 32 * Can be used for Full Duplex communication, or Simplex by specifying
H_Tsunemoto 0:871ab6846b18 33 * one pin as NC (Not Connected)
H_Tsunemoto 0:871ab6846b18 34 *
H_Tsunemoto 0:871ab6846b18 35 * Example:
H_Tsunemoto 0:871ab6846b18 36 * @code
H_Tsunemoto 0:871ab6846b18 37 * // Send a char to the PC
H_Tsunemoto 0:871ab6846b18 38 *
H_Tsunemoto 0:871ab6846b18 39 * #include "mbed.h"
H_Tsunemoto 0:871ab6846b18 40 *
H_Tsunemoto 0:871ab6846b18 41 * RawSerial pc(USBTX, USBRX);
H_Tsunemoto 0:871ab6846b18 42 *
H_Tsunemoto 0:871ab6846b18 43 * int main() {
H_Tsunemoto 0:871ab6846b18 44 * pc.putc('A');
H_Tsunemoto 0:871ab6846b18 45 * }
H_Tsunemoto 0:871ab6846b18 46 * @endcode
H_Tsunemoto 0:871ab6846b18 47 */
H_Tsunemoto 0:871ab6846b18 48 class RawSerial: public SerialBase {
H_Tsunemoto 0:871ab6846b18 49
H_Tsunemoto 0:871ab6846b18 50 public:
H_Tsunemoto 0:871ab6846b18 51 /** Create a RawSerial port, connected to the specified transmit and receive pins
H_Tsunemoto 0:871ab6846b18 52 *
H_Tsunemoto 0:871ab6846b18 53 * @param tx Transmit pin
H_Tsunemoto 0:871ab6846b18 54 * @param rx Receive pin
H_Tsunemoto 0:871ab6846b18 55 *
H_Tsunemoto 0:871ab6846b18 56 * @note
H_Tsunemoto 0:871ab6846b18 57 * Either tx or rx may be specified as NC if unused
H_Tsunemoto 0:871ab6846b18 58 */
H_Tsunemoto 0:871ab6846b18 59 RawSerial(PinName tx, PinName rx);
H_Tsunemoto 0:871ab6846b18 60
H_Tsunemoto 0:871ab6846b18 61 /** Write a char to the serial port
H_Tsunemoto 0:871ab6846b18 62 *
H_Tsunemoto 0:871ab6846b18 63 * @param c The char to write
H_Tsunemoto 0:871ab6846b18 64 *
H_Tsunemoto 0:871ab6846b18 65 * @returns The written char or -1 if an error occured
H_Tsunemoto 0:871ab6846b18 66 */
H_Tsunemoto 0:871ab6846b18 67 int putc(int c);
H_Tsunemoto 0:871ab6846b18 68
H_Tsunemoto 0:871ab6846b18 69 /** Read a char from the serial port
H_Tsunemoto 0:871ab6846b18 70 *
H_Tsunemoto 0:871ab6846b18 71 * @returns The char read from the serial port
H_Tsunemoto 0:871ab6846b18 72 */
H_Tsunemoto 0:871ab6846b18 73 int getc();
H_Tsunemoto 0:871ab6846b18 74
H_Tsunemoto 0:871ab6846b18 75 /** Write a string to the serial port
H_Tsunemoto 0:871ab6846b18 76 *
H_Tsunemoto 0:871ab6846b18 77 * @param str The string to write
H_Tsunemoto 0:871ab6846b18 78 *
H_Tsunemoto 0:871ab6846b18 79 * @returns 0 if the write succeeds, EOF for error
H_Tsunemoto 0:871ab6846b18 80 */
H_Tsunemoto 0:871ab6846b18 81 int puts(const char *str);
H_Tsunemoto 0:871ab6846b18 82
H_Tsunemoto 0:871ab6846b18 83 int printf(const char *format, ...);
H_Tsunemoto 0:871ab6846b18 84 };
H_Tsunemoto 0:871ab6846b18 85
H_Tsunemoto 0:871ab6846b18 86 } // namespace mbed
H_Tsunemoto 0:871ab6846b18 87
H_Tsunemoto 0:871ab6846b18 88 #endif
H_Tsunemoto 0:871ab6846b18 89
H_Tsunemoto 0:871ab6846b18 90 #endif