A simple 128x32 graphical LCD program to quickstart with LCD on ARM mbed IoT Starter Kit. This requires mbed Applciation Shield with FRDM-K64F platform.

Dependencies:   C12832

Committer:
tushki7
Date:
Sun Apr 12 15:45:52 2015 +0000
Revision:
1:eb68c94a8ee5
Parent:
0:60d829a0353a
A simple 128x32 LCD program with ARM mbed IoT Starter Kit;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
tushki7 0:60d829a0353a 1 /* mbed Microcontroller Library
tushki7 0:60d829a0353a 2 * Copyright (c) 2006-2013 ARM Limited
tushki7 0:60d829a0353a 3 *
tushki7 0:60d829a0353a 4 * Licensed under the Apache License, Version 2.0 (the "License");
tushki7 0:60d829a0353a 5 * you may not use this file except in compliance with the License.
tushki7 0:60d829a0353a 6 * You may obtain a copy of the License at
tushki7 0:60d829a0353a 7 *
tushki7 0:60d829a0353a 8 * http://www.apache.org/licenses/LICENSE-2.0
tushki7 0:60d829a0353a 9 *
tushki7 0:60d829a0353a 10 * Unless required by applicable law or agreed to in writing, software
tushki7 0:60d829a0353a 11 * distributed under the License is distributed on an "AS IS" BASIS,
tushki7 0:60d829a0353a 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
tushki7 0:60d829a0353a 13 * See the License for the specific language governing permissions and
tushki7 0:60d829a0353a 14 * limitations under the License.
tushki7 0:60d829a0353a 15 */
tushki7 0:60d829a0353a 16 #ifndef MBED_BUSOUT_H
tushki7 0:60d829a0353a 17 #define MBED_BUSOUT_H
tushki7 0:60d829a0353a 18
tushki7 0:60d829a0353a 19 #include "DigitalOut.h"
tushki7 0:60d829a0353a 20
tushki7 0:60d829a0353a 21 namespace mbed {
tushki7 0:60d829a0353a 22
tushki7 0:60d829a0353a 23 /** A digital output bus, used for setting the state of a collection of pins
tushki7 0:60d829a0353a 24 */
tushki7 0:60d829a0353a 25 class BusOut {
tushki7 0:60d829a0353a 26
tushki7 0:60d829a0353a 27 public:
tushki7 0:60d829a0353a 28
tushki7 0:60d829a0353a 29 /** Create an BusOut, connected to the specified pins
tushki7 0:60d829a0353a 30 *
tushki7 0:60d829a0353a 31 * @param p<n> DigitalOut pin to connect to bus bit <n> (p5-p30, NC)
tushki7 0:60d829a0353a 32 *
tushki7 0:60d829a0353a 33 * @note
tushki7 0:60d829a0353a 34 * It is only required to specify as many pin variables as is required
tushki7 0:60d829a0353a 35 * for the bus; the rest will default to NC (not connected)
tushki7 0:60d829a0353a 36 */
tushki7 0:60d829a0353a 37 BusOut(PinName p0, PinName p1 = NC, PinName p2 = NC, PinName p3 = NC,
tushki7 0:60d829a0353a 38 PinName p4 = NC, PinName p5 = NC, PinName p6 = NC, PinName p7 = NC,
tushki7 0:60d829a0353a 39 PinName p8 = NC, PinName p9 = NC, PinName p10 = NC, PinName p11 = NC,
tushki7 0:60d829a0353a 40 PinName p12 = NC, PinName p13 = NC, PinName p14 = NC, PinName p15 = NC);
tushki7 0:60d829a0353a 41
tushki7 0:60d829a0353a 42 BusOut(PinName pins[16]);
tushki7 0:60d829a0353a 43
tushki7 0:60d829a0353a 44 virtual ~BusOut();
tushki7 0:60d829a0353a 45
tushki7 0:60d829a0353a 46 /** Write the value to the output bus
tushki7 0:60d829a0353a 47 *
tushki7 0:60d829a0353a 48 * @param value An integer specifying a bit to write for every corresponding DigitalOut pin
tushki7 0:60d829a0353a 49 */
tushki7 0:60d829a0353a 50 void write(int value);
tushki7 0:60d829a0353a 51
tushki7 0:60d829a0353a 52 /** Read the value currently output on the bus
tushki7 0:60d829a0353a 53 *
tushki7 0:60d829a0353a 54 * @returns
tushki7 0:60d829a0353a 55 * An integer with each bit corresponding to associated DigitalOut pin setting
tushki7 0:60d829a0353a 56 */
tushki7 0:60d829a0353a 57 int read();
tushki7 0:60d829a0353a 58
tushki7 0:60d829a0353a 59 /** Binary mask of bus pins connected to actual pins (not NC pins)
tushki7 0:60d829a0353a 60 * If bus pin is in NC state make corresponding bit will be cleared (set to 0), else bit will be set to 1
tushki7 0:60d829a0353a 61 *
tushki7 0:60d829a0353a 62 * @returns
tushki7 0:60d829a0353a 63 * Binary mask of connected pins
tushki7 0:60d829a0353a 64 */
tushki7 0:60d829a0353a 65 int mask() {
tushki7 0:60d829a0353a 66 return _nc_mask;
tushki7 0:60d829a0353a 67 }
tushki7 0:60d829a0353a 68
tushki7 0:60d829a0353a 69 #ifdef MBED_OPERATORS
tushki7 0:60d829a0353a 70 /** A shorthand for write()
tushki7 0:60d829a0353a 71 */
tushki7 0:60d829a0353a 72 BusOut& operator= (int v);
tushki7 0:60d829a0353a 73 BusOut& operator= (BusOut& rhs);
tushki7 0:60d829a0353a 74
tushki7 0:60d829a0353a 75 /** Access to particular bit in random-iterator fashion
tushki7 0:60d829a0353a 76 */
tushki7 0:60d829a0353a 77 DigitalOut& operator[] (int index);
tushki7 0:60d829a0353a 78
tushki7 0:60d829a0353a 79 /** A shorthand for read()
tushki7 0:60d829a0353a 80 */
tushki7 0:60d829a0353a 81 operator int();
tushki7 0:60d829a0353a 82 #endif
tushki7 0:60d829a0353a 83
tushki7 0:60d829a0353a 84 protected:
tushki7 0:60d829a0353a 85 DigitalOut* _pin[16];
tushki7 0:60d829a0353a 86
tushki7 0:60d829a0353a 87 /** Mask of bus's NC pins
tushki7 0:60d829a0353a 88 * If bit[n] is set to 1 - pin is connected
tushki7 0:60d829a0353a 89 * if bit[n] is cleared - pin is not connected (NC)
tushki7 0:60d829a0353a 90 */
tushki7 0:60d829a0353a 91 int _nc_mask;
tushki7 0:60d829a0353a 92
tushki7 0:60d829a0353a 93 /* disallow copy constructor and assignment operators */
tushki7 0:60d829a0353a 94 private:
tushki7 0:60d829a0353a 95 BusOut(const BusOut&);
tushki7 0:60d829a0353a 96 BusOut & operator = (const BusOut&);
tushki7 0:60d829a0353a 97 };
tushki7 0:60d829a0353a 98
tushki7 0:60d829a0353a 99 } // namespace mbed
tushki7 0:60d829a0353a 100
tushki7 0:60d829a0353a 101 #endif