Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Android Hardware Interfacing with the BeagleBone Black

You're reading from  Android Hardware Interfacing with the BeagleBone Black

Product type Book
Published in Feb 2015
Publisher
ISBN-13 9781784392161
Pages 134 pages
Edition 1st Edition
Languages

Chapter 6. Creating a Complete Interfacing Solution

In the previous chapters of this book, you interfaced with devices using GPIOs, I2C, and SPI. You used AsyncTasks to perform hardware interfacing in background threads, and you explored how to structure an app to interact with those threads.

In this chapter, you will bring all of these concepts together to create a circuit that uses all three interfacing methods, and you will explore an app that uses all the interfaces together to make a complex system.

In this chapter, we will cover the following topics:

  • Building the complete interface circuit

  • Exploring the final example app

Building the complete interface circuit


The interfacing circuit used in this chapter is a combination of each of the circuits described in chapters 3, 4, and 5. If you have successfully constructed the circuits from the previous chapters, you already have a good understanding of how the circuit in this chapter will be put together. Leave any previously constructed circuits on the breadboard to save you some effort if you have constructed those circuits by closely following the instructions from earlier chapters.

The following diagram shows the connections between the sensor breakout board, FRAM breakout board, LED, pushbutton switch, resistor, and the BBB. Revisit chapters 3, 4, and 5 for the exact details on how to construct the GPIO, FRAM, and SPI portions of the circuit, if you have not yet done so.

The complete hardware interfacing circuit that uses components which interface with the BBB using the GPIOs, I2C, and SPI components

Exploring the complete example app


In this section, you will examine the example Android app that performs GPIO, I2C, and interfacing on BBB. The purpose of this application is to demonstrate how to use PacktHAL to perform a variety of hardware tasks from within an actual app using a set of interfacing functions. Unlike the previous example apps, which take input from the user, this app takes all of its input directly from the hardware itself. This requires a slightly more complex approach than that taken by the earlier apps.

Before digging through the app's code, you must install the code on your development system and install the app on your Android system. The source code for the app as well as the precompiled .apk package is located in the chapter6.tgz file, which is available for download from the Packt website. Follow the same process to download and add the app to your Eclipse ADT environment, which was described in Chapter 3, Handling Inputs and Outputs with GPIOs.

The app's user interface...

Summary


In this chapter, we introduced the concept of long-lived threads for hardware interfacing. You constructed a circuit that connected the GPIO pushbutton switch, GPIO LED, FRAM device, and temperature and pressure sensors to the BBB. Unlike the example apps in the previous chapters, the example app in this chapter used polling to continually monitor the state of the hardware. You also explored using five additional methods of the AsyncTask class for communication and control between the background thread and the main UI thread of your app.

Now that you have learned many of the basic concepts of hardware interfacing with Android using an app, it is time to look at the bigger picture and see how to turn your prototyped solution into a more permanent solution.

In the next chapter, you will learn about integrating your solution with the Android framework, combining your solution with other capes available for the BBB, and other interfaces that you can use for your future interfacing projects...

lock icon The rest of the chapter is locked
You have been reading a chapter from
Android Hardware Interfacing with the BeagleBone Black
Published in: Feb 2015 Publisher: ISBN-13: 9781784392161
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime}