Revision 288

trunk/bootloader/addr.h (revision 288)
1
#ifndef __ADDR_H__
2
#define __ADDR_H__
3

  
4
#include <avr/eeprom.h>
5
#include <stdint.h>
6
#include <tooltron.h>
7

  
8
uint8_t read_addr(void);
9

  
10
#endif
trunk/bootloader/addr.c (revision 288)
1
#include "addr.h"
2

  
3
uint8_t read_addr(void) {
4
    uint8_t a, b, c;
5

  
6
    a = eeprom_read_byte(EEPROM_ADDR1);
7
    b = eeprom_read_byte(EEPROM_ADDR2);
8
    c = eeprom_read_byte(EEPROM_ADDR3);
9

  
10
    if ((a == b) || a == c) {
11
        return a;
12
    } else if (b == c) {
13
        return b;
14
    } else {
15
        // Oh shit case
16
    }
17
}

Also available in: Unified diff