Project

General

Profile

Revision 1570

Added by John Sexton over 14 years ago

Final clean up of ir_branch folder. Now should Make correctly.

View differences:

branches/ir_branch/tools/eeprom/Makefile
1
# this is a local makefile
2

  
3
# Relative path to the root directory (containing lib directory)
4
#ifndef COLONYROOT
5
COLONYROOT = ..
6

  
7
# Target file name (without extension).
8
TARGET = main
9

  
10
# Uncomment this to use the wireless library
11
#USE_WIRELESS = 1
12

  
13
# com1 = serial port. Use lpt1 to connect to parallel port.
14
AVRDUDE_PORT = $(shell if uname -s |grep -i w32 >/dev/null; then echo 'COM4:'; else echo '/dev/ttyUSB0'; fi)
15

  
16
#else
17
COLONYROOT := ../$(COLONYROOT)
18
#endif
19

  
20
include $(COLONYROOT)/Makefile
branches/ir_branch/tools/eeprom/program_eeprom.c
1
#include <dragonfly_lib.h>
2
#include <eeprom.h>
3

  
4
int main()
5
{
6
  char str[5];
7
  int i=0,id;
8
  char c;
9

  
10
  dragonfly_init(ALL_ON);
11

  
12
  usb_puts("Here is the current setup:\r\n  ID: ");
13
  itoa(get_robotid(), str, 10);
14
  usb_puts(str);
15
  usb_puts("\r\n  BOM type: ");
16
  itoa(get_bom_type(), str, 10);
17
  usb_puts(str);
18
  usb_puts("\r\n\r\nEnter new ID:");
19

  
20
  while((c = usb_getc()) != '\n' && c != '\r')
21
    {
22
      usb_putc(c);
23
      if(i>=4)
24
	{
25
	  usb_puts("ERROR: filled buffer\n");
26
	  while(1);
27
	}
28
      str[i++] = c;
29
    }
30
  while(i<5)
31
    str[i++] = 0;
32

  
33
  id = atoi(str);
34

  
35
  usb_puts("\r\nsetting new id to: ");
36
  usb_puti(id);
37

  
38

  
39
  eeprom_put_byte(EEPROM_ROBOT_ID_ADDR, 'I');
40
  eeprom_put_byte(EEPROM_ROBOT_ID_ADDR+1, 'D');
41
  eeprom_put_byte(EEPROM_ROBOT_ID_ADDR+2, id);
42

  
43

  
44
  usb_puts("\r\nEnter BOM type:\r\b"
45
	   "1 for BOM 1.0\r\n"
46
	   "5 for BOM 1.5\r\n"
47
	   "r for RBOM\r\n>");
48

  
49
  c = usb_getc();
50
  usb_putc(c);
51

  
52
  switch(c)
53
    {
54
    case '1': id = BOM10; break;
55
    case '5': id = BOM15; break;
56
    case 'r': id = RBOM; break;
57
    default:
58
      usb_puts("ERROR: invalid input");
59
      while(1);
60
    }
61

  
62
  eeprom_put_byte(EEPROM_BOM_TYPE_ADDR, 'B');
63
  eeprom_put_byte(EEPROM_BOM_TYPE_ADDR+1, 'O');
64
  eeprom_put_byte(EEPROM_BOM_TYPE_ADDR+2, 'M');
65
  eeprom_put_byte(EEPROM_BOM_TYPE_ADDR+3, id);
66

  
67

  
68

  
69
  usb_puts("\r\ndone! have a nice day\r\n");
70

  
71

  
72
  while(1);
73

  
74
  return 0;
75
}
76
  
branches/ir_branch/tools/Makefile
1
# this is a local makefile
2

  
3
# Relative path to the root directory (containing lib directory)
4
ifndef COLONYROOT
5
COLONYROOT := ..
6

  
7
# Target file name (without extension).
8
TARGET = main
9

  
10
# Uncomment this to use the wireless library
11
USE_WIRELESS = 1
12

  
13
# com1 = serial port. Use lpt1 to connect to parallel port.
14
AVRDUDE_PORT = $(shell if uname -s |grep -i w32 >/dev/null; then echo 'COM4:'; else echo '/dev/ttyUSB0'; fi)
15

  
16
else
17
COLONYROOT := ../$(COLONYROOT)
18
endif
19

  
20
include $(COLONYROOT)/Makefile

Also available in: Unified diff