Home Alert System

Dependencies:   PWM_Tone_Library DHT

Committer:
ethaderu
Date:
Tue Mar 05 02:34:44 2019 +0000
Revision:
3:78f223d34f36
Publish 1

Who changed what in which revision?

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