Skip to content

Soft-Uart Tx only using software delays only

I was working on a code for a module on my GSM gateway today , for which I had given 1 pin of micro-controller to use as software Tx. Software UARTs usually uses timers to make them robust, but I had already used them all. So I decided to write a code using software delays.

The UART logic is inverted , so to send logic 1 you have to send low signal  and vice versa . Here is my code , hope it might help someone else.

/*
* soft-uart Tx only without any timmer uses software delays
* the baud rate depends on the delay in us , here I am using
* 4800 with a 1 start bit, 8 databits and 1 stop bit
* if you wanna change the baud rate calculate it by 1/baud and
* modify the _delay_us();
*
* Created: 11/21/2012 1:52:37 PM
* Author: AbuUmar
*/
#include <avr/io.h>
#include <util/delay.h>
#define portlow PORTC&=~0x01
#define porthigh PORTC|=0x01
void putchar_soft(char data_soft)
{
 char bit_count=10; // 1+8+1SB
 data_soft=~data_soft;
 char secc=1;char0:
 if (secc=1)
 portlow;
 else
 porthigh;
 _delay_us(208);
 //_delay_us(208);
 for ( char i = 0; i < 8; i++ ) { 
 if(data_soft & 1) 
 portlow; 
 else 
 porthigh; 
 data_soft=data_soft>>1;
 _delay_us(208);
 }
 porthigh;
 _delay_us(208);
 _delay_us(208);
 return;
}
int main(void)
{
 DDRC|=0b00000001;
 porthigh;
char inte=0;
while(1)
 {
 // example use, initializing a var to 0 and sending the data
 // with 1 sec delays
 putchar_soft(inte) ;
 _delay_ms(250);
 _delay_ms(250);
 _delay_ms(250);
 _delay_ms(250);
 inte++;
 }
}

Android Layout Finder – A useful online tool

Android developers have to write a lot of findViewbyId() codes in their java classes, which is often boring, this can be avoided by either use of  annotation based library (dependency injection frameworks) like Android Annotations, RoboGuice (which the Official document of Android suggests to avoid ) or use Android Layout Finder (an online tool).

Android Layout Finder tool can automate process of writing findViewById() code and thereby we can have JAVA code automated way and can save our valuable time.You just have to paste XML layout code and it gives you JAVA code with findViewById and click listeners.

Give it a try :)

Useful Android Libraries

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.

Standard Pack

This “standard pack” listed below are libraries that are quite popular, widely applicable and should probably be setup within most Android apps:

Name Description
Retrofit A type-safe REST client for Android which intelligently maps an API into a client interface using annotations.
Picasso A powerful image downloading and caching library for Android.
ButterKnife Using Java annotations, makes Android development better by simplifying common tasks.
Parceler Android Parcelable made easy through code generation
IcePick Android Instance State made easy
Crouton Context-sensitive, configurable alert notices much better than toasts
Hugo Easier logging using annotations

Convenience

  • 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

Extensions

  • 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.

Networking

  • 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.

ListView

Easy Navigation

  • 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

UI Components

Drawing

Scanning

Persistence

Compatibility

Resources

Check out the following resources for finding libraries:

References

Sim800H EAGLE library / footprint

SIM800H is a complete Quad-band GSM/GPRS solution in a LGA type which can be embedded in the customer applications.
SIM800H support Quad-band 850/900/1800/1900MHz, it can transmit Voice, SMS and data information with low power consumption. With tiny size of 15.8*17.8*2.4 mm, it can fit into slim and compact demands of customer design.  Featuring Bluetooth, FM and Embedded AT, it allows total cost savings and fast time-to-market for customer applications.

 

SIM800H

SIM800H

Product details

Download Library for Eagle Cadsoft

Beagle Bone linux images

What is BeagleBone Black?

BeagleBone Black is a low-cost, community-supported development platform for developers and hobbyists. Boot Linux in under 10 seconds and get started on development in less than 5 minutes with just a single USB cable.

MKCCE3-0_grandeMKCCE3-1_grande

Processor: AM335x 1GHz ARM® Cortex-A8

  • 512MB DDR3 RAM
  • 4GB 8-bit eMMC on-board flash storage
  • 3D graphics accelerator
  • NEON floating-point accelerator
  • 2x PRU 32-bit microcontrollers

Connectivity

  • USB client for power & communications
  • USB host
  • Ethernet
  • HDMI
  • 2x 46 pin headers

Software Compatibility

  • Debian
  • Android
  • Ubuntu
  • Cloud9 IDE on Node.js w/ BoneScript library
  • plus much more

 

 

 

 

 

The following link hosts all beagle-bone images and is actively maintained.It includes flasher and SD card images of angstrom, debian and ubuntu builds. Those who wish to compile the kernel from source may also do so.

https://rcn-ee.net/deb/

Android DPI Calculator

 Capture

Android Screens Densities

http://coh.io/adpi/

Enter values for the source dpi and the utility will fill in others.

Density-independent pixel (dp)
A virtual pixel unit that you should use when defining UI layout, to express layout dimensions or position in a density-independent way.

By Martin Cohen

MultiChoiceAdapter Android

Example ImageMultiChoiceAdapter is an implementation of ListAdapter which adds support for modal multiple choice selection as in the native Gmail app.

It provides a functionality similar to that of the CHOICE_MODE_MULTIPLE_MODAL ListView mode, with two additional benefits:

  • It’s easier to use, as it keeps count of the selected items, updates their background accordingly and handles checkboxes transparently.
  • It is compatible with every version of Android from 2.x. Of course, this implies that your project must use either ActionBarSherlock or the support library’s ActionBarCompat.

A version of the library that works with the stock action is also provided, for those apps with minSdkVersion=11or newer.

 

Try out the sample application:

Android app on Google Play

Or browse the source code of the sample application for a complete example of use.

Download from GitHub

FunDapter – Simplify Adapter creation Android

Simplify Adapter creation for your Android ListViews. FunDapter takes the pain and hassle out of creating a new Adapter class for each ListView you have in your Android app.

It is a new approach to custom adapter creation for Android apps. You get free ViewHolder pattern support, field validation so you don’t get bit by trivial bugs and best of all – you get to keep it DRY!

Download from GitHub

MapNavigator Library Android

Easy to use library to get and display driving directions on Google Maps v2 in Android. This library gives you directions and displays the route on the map.

Download from GitHub

 

ActivitySplitAnimation Android

A utility class to create split Activity animation made by Udi Cohen from Any.DO.

You can also read the post about this library on Udi’s blog.

Download from GitHuball