Embedded Freaks..

August 5, 2010

Can you spot the problem ?

Filed under: programming-tips — Tags: — kunilkuda @ 10:49 am

This is what we called: the eye trick..Spot the problem if you can.

    ret = IAP_PrepareSec(sector_index, sector_index);
    if (ret != IAP_STA_CMD_SUCCESS)
        while (1)

	ret = IAP_CopyRAMToFlash(app_addr, (unsigned int)&data[0], 256);
    if (ret != IAP_STA_CMD_SUCCESS)
        while (1);

February 19, 2009

Programming Timeout under FreeRTOS

Filed under: programming-tips — Tags: — kunilkuda @ 11:23 am

It seems like the FreeRTOS has some support to program a timeout, but unpublished anywhere. I’ve checked the FreeRTOS source code, regarding the usage, and it seems like it’s quite safe to use it under user’s application.

Here’s what I’ve found:


November 17, 2008

Composite Pattern for C (AVR-GCC)

Filed under: avr, programming-tips — Tags: , — kunilkuda @ 5:41 pm

In java, you can have composite pattern easily using interface, like this:

Animal[] animals = new Animal[] { new Elephant(), new Cow(), new Cat() };
for(Animal currAnimal : animals) {
  // Do the stuff here

Now, I want to have the same thing for serial RX interrupt in AVR. Something like this:

ISR(USART0_RX_vect) {
  uint8_t data = UDR0;
  for(InterruptHandler currHandler: interruptHandlers) {

By that way, I can chain the interrupt handler easily. Of course, mixing C and Java in C-compiler won’t be OK for AVR-GCC. But I found out some way to do the similar thing in C.


Older Posts »