public static void Set_Comm_Mode(byte p_comm_mode, byte p_i2cs_mode) { switch (p_comm_mode) { case 0: g_comm_mode = COMM_MODE.IDLE; return; case 1: g_comm_mode = COMM_MODE.I2C_M; return; case 2: g_comm_mode = COMM_MODE.SPI_M; return; case 3: g_comm_mode = COMM_MODE.SPI_S; return; case 4: g_comm_mode = COMM_MODE.USART_A; return; case 5: g_comm_mode = COMM_MODE.USART_SM; return; case 6: g_comm_mode = COMM_MODE.USART_SS; return; case 7: g_comm_mode = COMM_MODE.I2C_S; g_i2cs_mode = (I2CS_MODE)p_i2cs_mode; return; case 8: g_comm_mode = COMM_MODE.I2C_BBM; return; case 9: g_comm_mode = COMM_MODE.I2C_SBBM; return; case 10: g_comm_mode = COMM_MODE.LIN; return; case 11: g_comm_mode = COMM_MODE.UWIRE; return; case 12: g_comm_mode = COMM_MODE.MTOUCH2; return; } g_comm_mode = COMM_MODE.CM_ERROR; }
public static void InitializeParams() { m_flags.HID_write_handle = IntPtr.Zero; m_flags.HID_read_handle = IntPtr.Zero; m_flags.write_buffer = new byte[0x41]; m_flags.read_buffer = new byte[0x41]; m_flags.bl_buffer = new byte[0x41]; m_flags.orbl = 0x41; m_flags.irbl = 0x41; m_flags.g_status_packet_mutex = new Mutex(false); g_comm_mode = COMM_MODE.IDLE; g_i2cs_mode = I2CS_MODE.DEFAULT; Constants.STATUS_PACKET_DATA = new byte[0x41]; Mode.configure_run_mode_arrays(); m_flags.g_status_packet_data_update_event = new AutoResetEvent(false); m_flags.g_data_arrived_event = new AutoResetEvent(false); m_flags.g_bl_data_arrived_event = new AutoResetEvent(false); m_flags.g_PKSA_has_completed_script = new AutoResetEvent(false); m_flags.g_special_status_request_event = new AutoResetEvent(false); USBWrite.Initialize_Write_Objects(); USBRead.Initialize_Read_Objects(); }
public static void Set_Comm_Mode(byte p_comm_mode, byte p_i2cs_mode) { switch (p_comm_mode) { case 0: g_comm_mode = COMM_MODE.IDLE; return; case 1: g_comm_mode = COMM_MODE.I2C_M; return; case 2: g_comm_mode = COMM_MODE.SPI_M; return; case 3: g_comm_mode = COMM_MODE.SPI_S; return; case 4: g_comm_mode = COMM_MODE.USART_A; return; case 5: g_comm_mode = COMM_MODE.USART_SM; return; case 6: g_comm_mode = COMM_MODE.USART_SS; return; case 7: g_comm_mode = COMM_MODE.I2C_S; g_i2cs_mode = (I2CS_MODE) p_i2cs_mode; return; case 8: g_comm_mode = COMM_MODE.I2C_BBM; return; case 9: g_comm_mode = COMM_MODE.I2C_SBBM; return; case 10: g_comm_mode = COMM_MODE.LIN; return; case 11: g_comm_mode = COMM_MODE.UWIRE; return; case 12: g_comm_mode = COMM_MODE.MTOUCH2; return; } g_comm_mode = COMM_MODE.CM_ERROR; }