Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed-rtos EthernetInterface FatFileSystemCpp MCP23S17 SDFileSystem mbed
Fork of HTTPServerHelloWorld by
HardwareDrivers/mbed/BusOut.h@4:a19825caaf41, 2014-02-01 (annotated)
- Committer:
- wyunreal
- Date:
- Sat Feb 01 17:29:15 2014 +0000
- Revision:
- 4:a19825caaf41
- Parent:
- mbed/BusOut.h@3:5dc0023e6284
creating the application model
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| wyunreal | 3:5dc0023e6284 | 1 | /* mbed Microcontroller Library - BusOut |
| wyunreal | 3:5dc0023e6284 | 2 | * Copyright (c) 2007-2009 ARM Limited. All rights reserved. |
| wyunreal | 3:5dc0023e6284 | 3 | * sford, rmeyer |
| wyunreal | 3:5dc0023e6284 | 4 | */ |
| wyunreal | 3:5dc0023e6284 | 5 | |
| wyunreal | 3:5dc0023e6284 | 6 | #ifndef MBED_BUSOUT_H |
| wyunreal | 3:5dc0023e6284 | 7 | #define MBED_BUSOUT_H |
| wyunreal | 3:5dc0023e6284 | 8 | |
| wyunreal | 3:5dc0023e6284 | 9 | #include "platform.h" |
| wyunreal | 3:5dc0023e6284 | 10 | #include "PinNames.h" |
| wyunreal | 3:5dc0023e6284 | 11 | #include "PeripheralNames.h" |
| wyunreal | 3:5dc0023e6284 | 12 | #include "Base.h" |
| wyunreal | 3:5dc0023e6284 | 13 | #include "DigitalOut.h" |
| wyunreal | 3:5dc0023e6284 | 14 | |
| wyunreal | 3:5dc0023e6284 | 15 | namespace mbed { |
| wyunreal | 3:5dc0023e6284 | 16 | |
| wyunreal | 3:5dc0023e6284 | 17 | /* Class: BusOut |
| wyunreal | 3:5dc0023e6284 | 18 | * A digital output bus, used for setting the state of a collection of pins |
| wyunreal | 3:5dc0023e6284 | 19 | */ |
| wyunreal | 3:5dc0023e6284 | 20 | class BusOut : public Base { |
| wyunreal | 3:5dc0023e6284 | 21 | |
| wyunreal | 3:5dc0023e6284 | 22 | public: |
| wyunreal | 3:5dc0023e6284 | 23 | |
| wyunreal | 3:5dc0023e6284 | 24 | /* Group: Configuration Methods */ |
| wyunreal | 3:5dc0023e6284 | 25 | |
| wyunreal | 3:5dc0023e6284 | 26 | /* Constructor: BusOut |
| wyunreal | 3:5dc0023e6284 | 27 | * Create an BusOut, connected to the specified pins |
| wyunreal | 3:5dc0023e6284 | 28 | * |
| wyunreal | 3:5dc0023e6284 | 29 | * Variables: |
| wyunreal | 3:5dc0023e6284 | 30 | * p<n> - DigitalOut pin to connect to bus bit <n> (p5-p30, NC) |
| wyunreal | 3:5dc0023e6284 | 31 | * |
| wyunreal | 3:5dc0023e6284 | 32 | * Note: |
| wyunreal | 3:5dc0023e6284 | 33 | * It is only required to specify as many pin variables as is required |
| wyunreal | 3:5dc0023e6284 | 34 | * for the bus; the rest will default to NC (not connected) |
| wyunreal | 3:5dc0023e6284 | 35 | */ |
| wyunreal | 3:5dc0023e6284 | 36 | BusOut(PinName p0, PinName p1 = NC, PinName p2 = NC, PinName p3 = NC, |
| wyunreal | 3:5dc0023e6284 | 37 | PinName p4 = NC, PinName p5 = NC, PinName p6 = NC, PinName p7 = NC, |
| wyunreal | 3:5dc0023e6284 | 38 | PinName p8 = NC, PinName p9 = NC, PinName p10 = NC, PinName p11 = NC, |
| wyunreal | 3:5dc0023e6284 | 39 | PinName p12 = NC, PinName p13 = NC, PinName p14 = NC, PinName p15 = NC, |
| wyunreal | 3:5dc0023e6284 | 40 | const char *name = NULL); |
| wyunreal | 3:5dc0023e6284 | 41 | |
| wyunreal | 3:5dc0023e6284 | 42 | BusOut(PinName pins[16], const char *name = NULL); |
| wyunreal | 3:5dc0023e6284 | 43 | |
| wyunreal | 3:5dc0023e6284 | 44 | virtual ~BusOut(); |
| wyunreal | 3:5dc0023e6284 | 45 | |
| wyunreal | 3:5dc0023e6284 | 46 | /* Group: Access Methods */ |
| wyunreal | 3:5dc0023e6284 | 47 | |
| wyunreal | 3:5dc0023e6284 | 48 | /* Function: write |
| wyunreal | 3:5dc0023e6284 | 49 | * Write the value to the output bus |
| wyunreal | 3:5dc0023e6284 | 50 | * |
| wyunreal | 3:5dc0023e6284 | 51 | * Variables: |
| wyunreal | 3:5dc0023e6284 | 52 | * value - An integer specifying a bit to write for every corresponding DigitalOut pin |
| wyunreal | 3:5dc0023e6284 | 53 | */ |
| wyunreal | 3:5dc0023e6284 | 54 | void write(int value); |
| wyunreal | 3:5dc0023e6284 | 55 | |
| wyunreal | 3:5dc0023e6284 | 56 | |
| wyunreal | 3:5dc0023e6284 | 57 | /* Function: read |
| wyunreal | 3:5dc0023e6284 | 58 | * Read the value currently output on the bus |
| wyunreal | 3:5dc0023e6284 | 59 | * |
| wyunreal | 3:5dc0023e6284 | 60 | * Variables: |
| wyunreal | 3:5dc0023e6284 | 61 | * returns - An integer with each bit corresponding to associated DigitalOut pin setting |
| wyunreal | 3:5dc0023e6284 | 62 | */ |
| wyunreal | 3:5dc0023e6284 | 63 | int read(); |
| wyunreal | 3:5dc0023e6284 | 64 | |
| wyunreal | 3:5dc0023e6284 | 65 | #ifdef MBED_OPERATORS |
| wyunreal | 3:5dc0023e6284 | 66 | /* Group: Access Method Shorthand */ |
| wyunreal | 3:5dc0023e6284 | 67 | |
| wyunreal | 3:5dc0023e6284 | 68 | /* Function: operator= |
| wyunreal | 3:5dc0023e6284 | 69 | * A shorthand for <write> |
| wyunreal | 3:5dc0023e6284 | 70 | */ |
| wyunreal | 3:5dc0023e6284 | 71 | BusOut& operator= (int v); |
| wyunreal | 3:5dc0023e6284 | 72 | BusOut& operator= (BusOut& rhs); |
| wyunreal | 3:5dc0023e6284 | 73 | |
| wyunreal | 3:5dc0023e6284 | 74 | /* Function: operator int() |
| wyunreal | 3:5dc0023e6284 | 75 | * A shorthand for <read> |
| wyunreal | 3:5dc0023e6284 | 76 | */ |
| wyunreal | 3:5dc0023e6284 | 77 | operator int(); |
| wyunreal | 3:5dc0023e6284 | 78 | #endif |
| wyunreal | 3:5dc0023e6284 | 79 | |
| wyunreal | 3:5dc0023e6284 | 80 | #ifdef MBED_RPC |
| wyunreal | 3:5dc0023e6284 | 81 | virtual const struct rpc_method *get_rpc_methods(); |
| wyunreal | 3:5dc0023e6284 | 82 | static struct rpc_class *get_rpc_class(); |
| wyunreal | 3:5dc0023e6284 | 83 | #endif |
| wyunreal | 3:5dc0023e6284 | 84 | |
| wyunreal | 3:5dc0023e6284 | 85 | protected: |
| wyunreal | 3:5dc0023e6284 | 86 | |
| wyunreal | 3:5dc0023e6284 | 87 | DigitalOut* _pin[16]; |
| wyunreal | 3:5dc0023e6284 | 88 | |
| wyunreal | 3:5dc0023e6284 | 89 | #ifdef MBED_RPC |
| wyunreal | 3:5dc0023e6284 | 90 | static void construct(const char *arguments, char *res); |
| wyunreal | 3:5dc0023e6284 | 91 | #endif |
| wyunreal | 3:5dc0023e6284 | 92 | |
| wyunreal | 3:5dc0023e6284 | 93 | }; |
| wyunreal | 3:5dc0023e6284 | 94 | |
| wyunreal | 3:5dc0023e6284 | 95 | } // namespace mbed |
| wyunreal | 3:5dc0023e6284 | 96 | |
| wyunreal | 3:5dc0023e6284 | 97 | #endif |
| wyunreal | 3:5dc0023e6284 | 98 |
