Here I am sharing a header file called easyavr.h. This is a pretty basic header file with some helper functions related to input output pins of AVR
// Sets pin of port to 1
// Example for PD2: PIN_ON(PORTD, 2)
#define PIN_ON(port,pin) ((port) |= (1 << (pin)))
// Sets pin of port to 0
// Example for PD2: PIN_OFF(PORTD, 2)
#define PIN_OFF(port,pin) ((port) &= ~(1 << (pin)))
// Sets pin of port to value
// Example for PD2: PIN_SET(PORTD, 2, 1)
#define PIN_SET(port,pin,val) (((val) > 0) ? PIN_ON((port),(pin)) : PIN_OFF((port),(pin)))
// Sets all of port pins to OUTPUT mode
// Example for PORTD: PORT_AS_OUTPUT(PORTD)
#define PORT_AS_OUTPUT(port) ((port) = 0xFF)
// Sets all of port pins to INPUT mode
// Example for PORTD: PORT_AS_INPUT(PORTD)
#define PORT_AS_INPUT(port) ((port) = 0x00)
// Sets pin of port to OUTPUT mode
// Example for PD1: PORT_AS_OUTPUT(DDRD, 1)
#define PIN_AS_OUTPUT(ddr,pin) ((ddr) |= (1 << (pin)))
// Sets pin of port to INPUT mode
// Example for PD1: PORT_AS_INPUT(DDRD, 1)
#define PIN_AS_INPUT(ddr,pin) ((ddr) &= ~(1 << (pin)))
// Checks pin's value of port
// Returns 1 or 0
// Example for PD2: CHECK_PIN(PIND, 2)
#define CHECK_PIN(pinreg,pin) (((pinreg) & (1 << (pin))) != 0)
There are many third-party libraries for Android but several of them are “must have” libraries that are extremely popular and are often used in almost any Android project. Each has different purposes but all of them make life as a developer much more pleasant. The major libraries are listed below in a few categories.
This “standard pack” listed below are libraries that are quite popular, widely applicable and should probably be setup within most Android apps:
||A type-safe REST client for Android which intelligently maps an API into a client interface using annotations.
||A powerful image downloading and caching library for Android.
||Using Java annotations, makes Android development better by simplifying common tasks.
||Android Parcelable made easy through code generation
||Android Instance State made easy
||Context-sensitive, configurable alert notices much better than toasts
||Easier logging using annotations
- ButterKnife – Using Java annotations, makes Android development better by simplifying common tasks. Downloadand install as a jar. Make sure to setup eclipse integration for this to work.
- Dagger – A fast dependency injector for Android and Java.
- Parceler – Android Parcelable made easy through code generation.
- IcePick – Android Instance State made easy
- Hugo – Easier logging within your app
- AndroidAnnotations – Framework that speeds up Android development. It takes care of the plumbing, and lets you concentrate on what’s really important. By simplifying your code, it facilitates its maintenance
- RoboGuice – Powerful extensions to Android using dependency injection.
- Calligraphy – Custom fonts made easy
- Otto – An enhanced Guava-based event bus with emphasis on Android support
- EventBus – Android optimized event bus that simplifies communication between components.
- Tape – Tape is a collection of queue-related classes for Android and Java
- RxJava – Reactive Extensions for the JVM
- Priority JobQueue – Easier background tasks
- ACRA – Crash reporting made easy and free. Check the setup instructions and open-source backend.
- Picasso – A powerful image downloading and caching library for Android.
- Ion – Powerful asynchronous networking library. Download as a jar here.
- Android Async HTTP – Asynchronous networking client for loading remote content such as JSON.
- Retrofit – A type-safe REST client for Android and Java which intelligently maps an API into a client interface using annotations.
- PagerSlidingTabStrip – An interactive indicator to navigate between the different pages of a ViewPager.
- ViewPagerIndicator – Paging indicator widgets compatible with the ViewPager from the Android Support Library and ActionBarSherlock.
- JazzyViewPager – Pager with more animations
- ParallaxPager – ViewPager with Parallax scrolling effects
- SlidingMenu – Library that allows developers to easily create applications with sliding menus like those made popular in the Google+, YouTube, and Facebook apps.
- MenuDrawer – Library for easy menu drawers
- Android Satellite Menu – Radial menu which is configurable reminiscent of the “Path” menu style.
- ArcMenu – Alternate radial menu modeled after the “Path” menu style.
- AndroidSlidingUpPanel – Sliding Up Panel
- DraggablePanel – Panels that can be dragged
Check out the following resources for finding libraries:
A collection of free and opensource libraries and tools for developers that can prove to be very helpful.