rCOS

rCOS RCOPEN24 AVR-Speak BkSave RCDI SSDEMUX CSV2AVI FM-Manager BettyCheck

btm222-tool.tcl


  1: #!/usr/bin/wish
  2: #
  3: #
  4: 
  5: global line
  6: global argv
  7: set line ""
  8: set VERSION ""
  9: 
 10: proc Serial_Init {ComPort ComRate} {
 11:         set iChannel [open $ComPort w+]
 12:         set rate $ComRate
 13:         fconfigure $iChannel -mode $ComRate,n,8,1
 14:         fconfigure $iChannel -blocking 0
 15:         fconfigure $iChannel -buffering none
 16:         fileevent $iChannel readable ""
 17:         return $iChannel
 18: }
 19: 
 20: proc send_cmd2 {CMD} {
 21:         global Serial
 22:         foreach CHAR [split "$CMD" ""] {
 23: #                puts -nonewline "$CHAR"
 24:                 puts -nonewline $Serial "$CHAR"
 25:                 after 100
 26:         }
 27: }
 28: 
 29: proc rd_chid {chid} {
 30:         global line
 31:         global VERSION
 32:         global SYSINFO
 33:         set msg [read $chid 1]
 34:         if {$msg == "\n"} {
 35:                 puts "$line"
 36: 
 37:                 set line ""
 38:         } else {
 39:                 set line "$line$msg"
 40:         }
 41: }
 42: 
 43: 
 44: #wm geometry . 320x250
 45: wm title . "BTM222-Tool"
 46: 
 47: frame .frame3
 48: pack .frame3 -side top -fill x -expand yes
 49: 
 50:         button .frame3.master -text "Master" -command {
 51:                 send_cmd2 "ATR0\r"
 52:         }
 53:         pack .frame3.master -side top -fill x -expand yes
 54: 
 55:         button .frame3.slave -text "Slave" -command {
 56:                 send_cmd2 "ATR1\r"
 57:         }
 58:         pack .frame3.slave -side top -fill x -expand yes
 59: 
 60:         button .frame3.info -text "Info" -command {
 61:                 send_cmd2 "ATI1\r"
 62:         }
 63:         pack .frame3.info -side top -fill x -expand yes
 64: 
 65:         button .frame3.scan -text "Scan" -command {
 66:                 send_cmd2 "ATF?\r"
 67:         }
 68:         pack .frame3.scan -side top -fill x -expand yes
 69: 
 70:         button .frame3.hwaddr -text "MyHWADDR" -command {
 71:                 send_cmd2 "ATB?\r"
 72:         }
 73:         pack .frame3.hwaddr -side top -fill x -expand yes
 74: 
 75:         button .frame3.autoconnect -text "Auto-Connect On" -command {
 76:                 send_cmd2 "ATO0\r"
 77:         }
 78:         pack .frame3.autoconnect -side top -fill x -expand yes
 79: 
 80:         button .frame3.autoconnect_off -text "Auto-Connect Off" -command {
 81:                 send_cmd2 "ATO1\r"
 82:         }
 83:         pack .frame3.autoconnect_off -side top -fill x -expand yes
 84: 
 85: 
 86: 
 87: if {[lindex $argv 0] != ""} {
 88:         puts "Open Serial-Port: [lindex $argv 0]"
 89:         if {[lindex $argv 1] != ""} {
 90:                 set Serial [Serial_Init "[lindex $argv 0]" [lindex $argv 1]]
 91:         } else {
 92:                 set Serial [Serial_Init "[lindex $argv 0]" 19200]
 93:         }
 94: } else {
 95:         puts "USAGE: rx-tool COMPORT [BAUD]"
 96:         exit 1
 97: }
 98: fileevent $Serial readable [list rd_chid $Serial]
 99: 
100: send_cmd2 "ATI1\r"
101: 
102: 
103: 
104: 
105: 
106: 
107: 
108: 
109: 
Links
Sources

Targets
Disk-Driver
Drawing-Library
Filesystem-Libraries
GPIO-Based Driver
Graphic-Driver
I2C-Based Driver
Power-Management
Serial-Based Driver
SPI-Based Driver
Menu
Platforms
RCSML
Tools