Пример #1
0
        public BP_RESPONSE ModeI2C(BP_I2C_SPEED speed)
        {
            m_mode = BP_MODE.I2C;
            BP_RESPONSE response = BP_RESPONSE.Disconnect;

            if (IsConnected &&
                (response = SendWait("m4")) == BP_RESPONSE.OK
                )
            {
                response = SendWait(((int)speed));
            }
            return(response);
        }
Пример #2
0
        public BP_RESPONSE ModeWIRE2(BP_WIRE_SPEED speed, BP_OUTPUT output)
        {
            m_mode = BP_MODE.WIRE2;
            BP_RESPONSE response = BP_RESPONSE.Disconnect;

            if (IsConnected &&
                (response = SendWait("m6")) == BP_RESPONSE.OK &&
                (response = SendWait((int)speed)) == BP_RESPONSE.OK
                )
            {
                response = SendWait((int)output);
            }
            return(response);
        }
Пример #3
0
        public BP_RESPONSE ModeUART(BP_UART_SPEED speed, BP_UART_PROTOCOL protocol, BP_UART_STOP stop, BP_UART_POLARITY polarity, BP_OUTPUT output)
        {
            m_mode = BP_MODE.UART;
            BP_RESPONSE response = BP_RESPONSE.Disconnect;

            if (IsConnected &&
                (response = SendWait("m3")) == BP_RESPONSE.OK &&
                (response = SendWait((int)speed)) == BP_RESPONSE.OK &&
                (response = SendWait((int)protocol)) == BP_RESPONSE.OK &&
                (response = SendWait((int)stop)) == BP_RESPONSE.OK &&
                (response = SendWait((int)polarity)) == BP_RESPONSE.OK
                )
            {
                response = SendWait(((int)output));
            }
            return(response);
        }
Пример #4
0
        public BP_RESPONSE ModeSPI(BP_SPI_SPEED speed, BP_SPI_CLOCK_POLARITY polarity, BP_SPI_CLOCK_EDGE edge, BP_SPI_INPUT_PHASE phase, BP_CS_POLARITY cs, BP_OUTPUT output)
        {
            m_mode = BP_MODE.SPI;
            BP_RESPONSE response = BP_RESPONSE.Disconnect;

            if (IsConnected &&
                (response = SendWait("m5")) == BP_RESPONSE.OK &&
                (response = SendWait((int)speed)) == BP_RESPONSE.OK &&
                (response = SendWait((int)polarity)) == BP_RESPONSE.OK &&
                (response = SendWait((int)edge)) == BP_RESPONSE.OK &&
                (response = SendWait((int)phase)) == BP_RESPONSE.OK &&
                (response = SendWait((int)cs)) == BP_RESPONSE.OK
                )
            {
                response = SendWait((int)output);
            }
            return(response);
        }
Пример #5
0
        public BP_RESPONSE Info()
        {
            BP_RESPONSE response = BP_RESPONSE.Disconnect;

            if (IsConnected &&
                (response = SendWait("i")) == BP_RESPONSE.OK
                )
            {
                response = BP_RESPONSE.BadResponse;
                if (bp_lines.Count >= 5)
                {
                    HardwareVersion = GetLine(1);
                    FirmwareVersion = GetLine(2);
                    PICVersion      = GetLine(3);
                    if (!string.IsNullOrEmpty(HardwareVersion) &&
                        !string.IsNullOrEmpty(FirmwareVersion) &&
                        !string.IsNullOrEmpty(PICVersion)
                        )
                    {
                        string mode = bp_lines[bp_lines.Count - 1];
                        int    idx  = m_prompts.IndexOf(mode);
                        if (idx >= 0)
                        {
                            m_mode   = (BP_MODE)(idx + 1);
                            response = BP_RESPONSE.OK;
                            if (GetLine(7) == "Pinstates:")
                            {
                                if ((response = ParseVoltage(GetLine(11))) == BP_RESPONSE.OK &&
                                    (response = ParsePinMode(GetLine(10))) == BP_RESPONSE.OK
                                    )
                                {
                                    response = ParsePinName(GetLine(9));
                                }
                            }
                        }
                    }
                }
            }
            return(response);
        }
Пример #6
0
 public BP_RESPONSE ModeSPI(BP_SPI_SPEED speed, BP_SPI_CLOCK_POLARITY polarity, BP_SPI_CLOCK_EDGE edge, BP_SPI_INPUT_PHASE phase, BP_CS_POLARITY cs, BP_OUTPUT output)
 {
     m_mode = BP_MODE.SPI;
     BP_RESPONSE response = BP_RESPONSE.Disconnect;
     if (IsConnected &&
         (response = SendWait("m5")) == BP_RESPONSE.OK &&
         (response = SendWait((int)speed)) == BP_RESPONSE.OK &&
         (response = SendWait((int)polarity)) == BP_RESPONSE.OK &&
         (response = SendWait((int)edge)) == BP_RESPONSE.OK &&
         (response = SendWait((int)phase)) == BP_RESPONSE.OK &&
         (response = SendWait((int)cs)) == BP_RESPONSE.OK
         )
         response = SendWait((int)output);
     return response;
 }
Пример #7
0
 public BP_RESPONSE ModeLCD()
 {
     m_mode = BP_MODE.LCD;
     return Execute("m8");
 }
Пример #8
0
 public BP_RESPONSE ModeI2C(BP_I2C_SPEED speed)
 {
     m_mode = BP_MODE.I2C;
     BP_RESPONSE response = BP_RESPONSE.Disconnect;
     if (IsConnected &&
         (response = SendWait("m4")) == BP_RESPONSE.OK
         )
         response = SendWait(((int)speed));
     return response;
 }
Пример #9
0
 public BP_RESPONSE ModeHiZ()
 {
     m_mode = BP_MODE.HiZ;
     return Execute("m1");
 }
Пример #10
0
 public BP_RESPONSE ModeDIO()
 {
     m_mode = BP_MODE.DIO;
     return Execute("m9");
 }
Пример #11
0
 public BP_RESPONSE ModeWIRE1()
 {
     m_mode = BP_MODE.WIRE1;
     return(Execute("m2"));
 }
Пример #12
0
 public BP_RESPONSE ModeWIRE3(BP_WIRE_SPEED speed, BP_CS_POLARITY cs, BP_OUTPUT output)
 {
     m_mode = BP_MODE.WIRE3;
     BP_RESPONSE response = BP_RESPONSE.Disconnect;
     if (IsConnected &&
         (response = SendWait("m7")) == BP_RESPONSE.OK &&
         (response = SendWait((int)speed)) == BP_RESPONSE.OK &&
         (response = SendWait((int)cs)) == BP_RESPONSE.OK
         )
         response = SendWait((int)output);
     return response;
 }
Пример #13
0
 public BP_RESPONSE ModeDIO()
 {
     m_mode = BP_MODE.DIO;
     return(Execute("m9"));
 }
Пример #14
0
 public BP_RESPONSE ModeLCD()
 {
     m_mode = BP_MODE.LCD;
     return(Execute("m8"));
 }
Пример #15
0
 public BP_RESPONSE ModeUART(BP_UART_SPEED speed, BP_UART_PROTOCOL protocol, BP_UART_STOP stop, BP_UART_POLARITY polarity, BP_OUTPUT output)
 {
     m_mode = BP_MODE.UART;
     BP_RESPONSE response = BP_RESPONSE.Disconnect;
     if (IsConnected &&
         (response = SendWait("m3")) == BP_RESPONSE.OK &&
         (response = SendWait((int)speed)) == BP_RESPONSE.OK &&
         (response = SendWait((int)protocol)) == BP_RESPONSE.OK &&
         (response = SendWait((int)stop)) == BP_RESPONSE.OK &&
         (response = SendWait((int)polarity)) == BP_RESPONSE.OK
         )
         response = SendWait(((int)output));
     return response;
 }
Пример #16
0
 public BP_RESPONSE ModeWIRE1()
 {
     m_mode = BP_MODE.WIRE1;
     return Execute("m2");
 }
Пример #17
0
 public BP_RESPONSE Info()
 {
     BP_RESPONSE response = BP_RESPONSE.Disconnect;
     if (IsConnected &&
         (response = SendWait("i")) == BP_RESPONSE.OK
         )
     {
         response = BP_RESPONSE.BadResponse;
         if (bp_lines.Count >= 5)
         {
             HardwareVersion = GetLine(1);
             FirmwareVersion = GetLine(2);
             PICVersion = GetLine(3);
             if (!string.IsNullOrEmpty(HardwareVersion) &&
                 !string.IsNullOrEmpty(FirmwareVersion) &&
                 !string.IsNullOrEmpty(PICVersion)
                 )
             {
                 string mode = bp_lines[bp_lines.Count - 1];
                 int idx = m_prompts.IndexOf(mode);
                 if (idx >= 0)
                 {
                     m_mode = (BP_MODE)(idx + 1);
                     response = BP_RESPONSE.OK;
                     if (GetLine(7) == "Pinstates:")
                     {
                         if ((response = ParseVoltage(GetLine(11))) == BP_RESPONSE.OK &&
                             (response = ParsePinMode(GetLine(10))) == BP_RESPONSE.OK
                             )
                             response = ParsePinName(GetLine(9));
                     }
                 }
             }
         }
     }
     return response;
 }
Пример #18
0
 extern static public int JLINKARM_SetBPEx(UInt32 addr, BP_MODE mode);
Пример #19
0
 public BP_RESPONSE ModeHiZ()
 {
     m_mode = BP_MODE.HiZ;
     return(Execute("m1"));
 }