Smart coffee machine with facial recognition and remote control

Dependencies:   Camera_LS_Y201 EthernetInterface EthernetNetIf HTTPClient SRF05 TextLCD mbed-rtos mbed-src

Committer:
projetmacintel
Date:
Wed Jan 15 11:09:52 2014 +0000
Revision:
0:43669f623d43
dep?t final PAO Macintel

Who changed what in which revision?

UserRevisionLine numberNew contents of line
projetmacintel 0:43669f623d43 1 /**
projetmacintel 0:43669f623d43 2 * =============================================================================
projetmacintel 0:43669f623d43 3 * LS-Y201 device driver class (Version 0.0.1)
projetmacintel 0:43669f623d43 4 * Reference documents: LinkSprite JPEG Color Camera Serial UART Interface
projetmacintel 0:43669f623d43 5 * January 2010
projetmacintel 0:43669f623d43 6 * =============================================================================
projetmacintel 0:43669f623d43 7 * Copyright (c) 2010 Shinichiro Nakamura (CuBeatSystems)
projetmacintel 0:43669f623d43 8 *
projetmacintel 0:43669f623d43 9 * Permission is hereby granted, free of charge, to any person obtaining a copy
projetmacintel 0:43669f623d43 10 * of this software and associated documentation files (the "Software"), to deal
projetmacintel 0:43669f623d43 11 * in the Software without restriction, including without limitation the rights
projetmacintel 0:43669f623d43 12 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
projetmacintel 0:43669f623d43 13 * copies of the Software, and to permit persons to whom the Software is
projetmacintel 0:43669f623d43 14 * furnished to do so, subject to the following conditions:
projetmacintel 0:43669f623d43 15 *
projetmacintel 0:43669f623d43 16 * The above copyright notice and this permission notice shall be included in
projetmacintel 0:43669f623d43 17 * all copies or substantial portions of the Software.
projetmacintel 0:43669f623d43 18 *
projetmacintel 0:43669f623d43 19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
projetmacintel 0:43669f623d43 20 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
projetmacintel 0:43669f623d43 21 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
projetmacintel 0:43669f623d43 22 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
projetmacintel 0:43669f623d43 23 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
projetmacintel 0:43669f623d43 24 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
projetmacintel 0:43669f623d43 25 * THE SOFTWARE.
projetmacintel 0:43669f623d43 26 * =============================================================================
projetmacintel 0:43669f623d43 27 */
projetmacintel 0:43669f623d43 28
projetmacintel 0:43669f623d43 29 #ifndef _SERIAL_BUFFERED_H_
projetmacintel 0:43669f623d43 30 #define _SERIAL_BUFFERED_H_
projetmacintel 0:43669f623d43 31
projetmacintel 0:43669f623d43 32 /**
projetmacintel 0:43669f623d43 33 * Buffered serial class.
projetmacintel 0:43669f623d43 34 */
projetmacintel 0:43669f623d43 35 class SerialBuffered : public RawSerial {
projetmacintel 0:43669f623d43 36 public:
projetmacintel 0:43669f623d43 37 /**
projetmacintel 0:43669f623d43 38 * Create a buffered serial class.
projetmacintel 0:43669f623d43 39 *
projetmacintel 0:43669f623d43 40 * @param tx A pin for transmit.
projetmacintel 0:43669f623d43 41 * @param rx A pin for receive.
projetmacintel 0:43669f623d43 42 */
projetmacintel 0:43669f623d43 43 SerialBuffered(PinName tx, PinName rx);
projetmacintel 0:43669f623d43 44
projetmacintel 0:43669f623d43 45 /**
projetmacintel 0:43669f623d43 46 * Destroy.
projetmacintel 0:43669f623d43 47 */
projetmacintel 0:43669f623d43 48 virtual ~SerialBuffered();
projetmacintel 0:43669f623d43 49
projetmacintel 0:43669f623d43 50 /**
projetmacintel 0:43669f623d43 51 * Get a character.
projetmacintel 0:43669f623d43 52 *
projetmacintel 0:43669f623d43 53 * @return A character. (-1:timeout)
projetmacintel 0:43669f623d43 54 */
projetmacintel 0:43669f623d43 55 int getc();
projetmacintel 0:43669f623d43 56
projetmacintel 0:43669f623d43 57 /**
projetmacintel 0:43669f623d43 58 * Returns 1 if there is a character available to read, 0 otherwise.
projetmacintel 0:43669f623d43 59 */
projetmacintel 0:43669f623d43 60 int readable();
projetmacintel 0:43669f623d43 61
projetmacintel 0:43669f623d43 62 /**
projetmacintel 0:43669f623d43 63 * Set timeout for getc().
projetmacintel 0:43669f623d43 64 *
projetmacintel 0:43669f623d43 65 * @param ms milliseconds. (-1:Disable timeout)
projetmacintel 0:43669f623d43 66 */
projetmacintel 0:43669f623d43 67 void setTimeout(int ms);
projetmacintel 0:43669f623d43 68
projetmacintel 0:43669f623d43 69 /**
projetmacintel 0:43669f623d43 70 * Read requested bytes.
projetmacintel 0:43669f623d43 71 *
projetmacintel 0:43669f623d43 72 * @param bytes A pointer to a buffer.
projetmacintel 0:43669f623d43 73 * @param requested Length.
projetmacintel 0:43669f623d43 74 *
projetmacintel 0:43669f623d43 75 * @return Readed byte length.
projetmacintel 0:43669f623d43 76 */
projetmacintel 0:43669f623d43 77 size_t readBytes(uint8_t *bytes, size_t requested);
projetmacintel 0:43669f623d43 78
projetmacintel 0:43669f623d43 79 private:
projetmacintel 0:43669f623d43 80 void handleInterrupt();
projetmacintel 0:43669f623d43 81 static const int BUFFERSIZE = 4096;
projetmacintel 0:43669f623d43 82 uint8_t buffer[BUFFERSIZE]; // points at a circular buffer, containing data from m_contentStart, for m_contentSize bytes, wrapping when you get to the end
projetmacintel 0:43669f623d43 83 uint16_t indexContentStart; // index of first bytes of content
projetmacintel 0:43669f623d43 84 uint16_t indexContentEnd; // index of bytes after last byte of content
projetmacintel 0:43669f623d43 85 int timeout;
projetmacintel 0:43669f623d43 86 Timer timer;
projetmacintel 0:43669f623d43 87 };
projetmacintel 0:43669f623d43 88
projetmacintel 0:43669f623d43 89 #endif