This repo contains the libraries of Mbed for LPC1549 with following changes: - IAP commands. - EEPROM write and read. - UART write and read (public) - CAN can_s -> LPC_C_CAN0_Type *can

Committer:
gmatarrubia
Date:
Tue Apr 14 15:00:13 2015 +0200
Revision:
0:820a69dfd200
Initial repo. IAP commands, EEPROM write/read, UART write/read, CAN

Who changed what in which revision?

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