added basic eeprom code
authorroot@rika
Thu, 23 Apr 2009 20:54:06 +0200
changeset 3200a9c2c2f33f
parent 31 4567e7bc404c
child 33 7a0c4b0354ba
added basic eeprom code
tools/picctldisplaytest/src/picctldisplaytest.cpp
tools/picctldisplaytest/src/picctldisplaytest.h
     1.1 --- a/tools/picctldisplaytest/src/picctldisplaytest.cpp	Thu Apr 23 20:22:04 2009 +0200
     1.2 +++ b/tools/picctldisplaytest/src/picctldisplaytest.cpp	Thu Apr 23 20:54:06 2009 +0200
     1.3 @@ -128,9 +128,17 @@
     1.4  				cout << "Sending Clear Display..." << endl;
     1.5  				send_data(CMD_DISP_CLEAR_SCREEN,(sizeof(CMD_DISP_CLEAR_SCREEN)/sizeof(char)));
     1.6  				break;
     1.7 +			case 'e':
     1.8 +				cout << "Reading EEProm..." << endl;
     1.9 +				myflags.parse_return_eeprom = 1;
    1.10 +				send_data(CMD_READ_EE,(sizeof(CMD_READ_EE)/sizeof(char)));
    1.11 +				myflags.parse_return_eeprom = 0;
    1.12 +				break;
    1.13  			case 'b':
    1.14  				cout << "Sending Bootload Start..." << endl;
    1.15  				send_data(CMD_BOOT,(sizeof(CMD_BOOT)/sizeof(char)));
    1.16 +				cout << "Exiting." << endl;
    1.17 +				return EXIT_SUCCESS;
    1.18  				break;
    1.19  			case 'h':
    1.20  				print_help();
    1.21 @@ -453,10 +461,11 @@
    1.22  	cout << endl;
    1.23  	cout << "b\tenter bootload mode" << endl;
    1.24  	cout << endl;
    1.25 +	cout << "e\tdump eeprom" << endl;
    1.26 +	cout << endl;
    1.27  	cout << "h\tprint this help" << endl;
    1.28  	cout << "j\tprint command line options" << endl;
    1.29  	cout << "q\tquit" << endl;
    1.30 -	cout << ">";
    1.31  }
    1.32  
    1.33  /*! \brief prints command line options
    1.34 @@ -568,6 +577,9 @@
    1.35  		cout << endl;
    1.36  	}
    1.37  	if (myconfig.debug || myconfig.verbosity > 0) cout <<  dec << (buf_pos - buf_cmd_start) << " bytes received.\n";
    1.38 +	if (myflags.parse_return_eeprom > 0) {
    1.39 +		cout << "(eeprom-data)" << "0x" << ((int) buf[4] < 10 ? "0" : "") << hex << (int) buf[4] << " " << endl;
    1.40 +	}
    1.41  }
    1.42  
    1.43  /*! \brief sends size bytes of buffer data to the display
    1.44 @@ -595,6 +607,10 @@
    1.45  	}
    1.46  	if (myconfig.debug || myconfig.verbosity > 0) cout <<   endl;
    1.47  
    1.48 +	if (buffer == CMD_BOOT) {
    1.49 +		cout << " Entering Bootloader-mode... not waiting for an ACK Packet" << endl;
    1.50 +	}
    1.51 +
    1.52  	ack_flag = false;
    1.53  
    1.54  	while (!ack_flag && tout < 1000) {
     2.1 --- a/tools/picctldisplaytest/src/picctldisplaytest.h	Thu Apr 23 20:22:04 2009 +0200
     2.2 +++ b/tools/picctldisplaytest/src/picctldisplaytest.h	Thu Apr 23 20:54:06 2009 +0200
     2.3 @@ -43,6 +43,7 @@
     2.4  static unsigned char CMD_SET_PWM1[] = {0xAA,0x45,0x00,0x01,0x00};
     2.5  static unsigned char CMD_SET_PWM2[] = {0xAA,0x46,0x00,0x01,0x00};
     2.6  static unsigned char CMD_BOOT[] = {0xAA,0x80,0x00,0x00};
     2.7 +static unsigned char CMD_READ_EE[] = {0xAA,0x21,0x00,0x01,0x01};
     2.8  #define  BAUDRATE B921600
     2.9  
    2.10  
    2.11 @@ -66,6 +67,7 @@
    2.12  /*! \brief configuration set during runtime */
    2.13  struct runtime_flags {
    2.14  	bool parse_return_clockram;
    2.15 +	bool parse_return_eeprom;
    2.16  };
    2.17  
    2.18  /*! \brief char table display, showing almost the lower half of the display charset