BusIn HelloWorld

Fork of BusIn_HelloWorld by Mbed

Use

BusIn is an abstraction that takes any pins and makes them appear as though they are linearly memory mapped for ease of use. This abstraction is useful for checking multiple inputs in a single pass. In general this abstraction can be used to make code less cluttered, clearer, and take less time to write.

Note

Please pay attention to the ordering of pins in the initialization. The order pins are initialized in are the reverse order that bits are OR'd together.

API

API reference.

Import librarymbed

No documentation found.
Committer:
mbedAustin
Date:
Fri Mar 27 20:07:02 2015 +0000
Revision:
3:ac45ca465b45
Parent:
2:b22e7d5a6872
Child:
4:252fbf8e71db
Added license to top of main.c file

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbedAustin 3:ac45ca465b45 1 /* mbed Example Program
mbedAustin 3:ac45ca465b45 2 * Copyright (c) 2006-2014 ARM Limited
mbedAustin 3:ac45ca465b45 3 *
mbedAustin 3:ac45ca465b45 4 * Licensed under the Apache License, Version 2.0 (the "License");
mbedAustin 3:ac45ca465b45 5 * you may not use this file except in compliance with the License.
mbedAustin 3:ac45ca465b45 6 * You may obtain a copy of the License at
mbedAustin 3:ac45ca465b45 7 *
mbedAustin 3:ac45ca465b45 8 * http://www.apache.org/licenses/LICENSE-2.0
mbedAustin 3:ac45ca465b45 9 *
mbedAustin 3:ac45ca465b45 10 * Unless required by applicable law or agreed to in writing, software
mbedAustin 3:ac45ca465b45 11 * distributed under the License is distributed on an "AS IS" BASIS,
mbedAustin 3:ac45ca465b45 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
mbedAustin 3:ac45ca465b45 13 * See the License for the specific language governing permissions and
mbedAustin 3:ac45ca465b45 14 * limitations under the License.
mbedAustin 3:ac45ca465b45 15 */
mbedAustin 3:ac45ca465b45 16
mbed_official 0:5e474ece410b 17 #include "mbed.h"
mbed_official 0:5e474ece410b 18
mbedAustin 2:b22e7d5a6872 19 BusIn nibble(p5, p6, p18, p11); // change pins according to platform
mbed_official 0:5e474ece410b 20
mbed_official 0:5e474ece410b 21 int main() {
mbed_official 0:5e474ece410b 22 while(1) {
mbed_official 0:5e474ece410b 23 switch(nibble) {
mbed_official 0:5e474ece410b 24 case 0x3: printf("Hello!\n"); break; // p5 and p6 are 1
mbed_official 0:5e474ece410b 25 case 0x8: printf("World!\n"); break; // p11 is 1
mbed_official 0:5e474ece410b 26 }
mbed_official 0:5e474ece410b 27 }
mbed_official 0:5e474ece410b 28 }