// Workout bit clock for USBasp programmer frequency private void cmbUSBaspFreq_SelectedIndexChanged(object sender, EventArgs e) { Avrdude.UsbAspFreq freq = ((Avrdude.UsbAspFreq)((ComboBox)sender).SelectedItem); if (cmbUSBaspFreq.Visible && freq != null) { txtBitClock.Text = freq.bitClock; } }
// Programmer choice changed private void cmbProg_SelectedIndexChanged(object sender, EventArgs e) { // Credits: // Simone Chifari (USBasp frequency stuff) // Hide/show USBasp frequency/bit clock boxes if (prog != null && prog.name == "usbasp") // USBasp has been selected { if (txtBitClock.Visible) { // Store bit clock oldBitClock = txtBitClock.Text; // Show/hide stuff txtBitClock.Hide(); cmbUSBaspFreq.Show(); // Make sure a selected index changed event occurs cmbUSBaspFreq.SelectedIndex = -1; // Restore USBasp frequency if (oldUsbAspFreq != null) { cmbUSBaspFreq.SelectedItem = oldUsbAspFreq; } else { cmbUSBaspFreq.SelectedIndex = 0; } } } else { if (!txtBitClock.Visible) { // Store selected USBasp frequency oldUsbAspFreq = ((Avrdude.UsbAspFreq)cmbUSBaspFreq.SelectedItem); // Restore bit clock txtBitClock.Text = oldBitClock; // Show/hide stuff txtBitClock.Show(); cmbUSBaspFreq.Hide(); } } }
// Programmer choice changed private void cmbProg_SelectedIndexChanged(object sender, EventArgs e) { // Credits: // Simone Chifari (USBasp frequency stuff) // Hide/show USBasp frequency/bit clock boxes if (prog != null && prog.name == "usbasp") // USBasp has been selected { if (txtBitClock.Visible) { // Store bit clock oldBitClock = txtBitClock.Text; // Show/hide stuff txtBitClock.Hide(); cmbUSBaspFreq.Show(); // Make sure a selected index changed event occurs cmbUSBaspFreq.SelectedIndex = -1; // Restore USBasp frequency if (oldUsbAspFreq != null) cmbUSBaspFreq.SelectedItem = oldUsbAspFreq; else cmbUSBaspFreq.SelectedIndex = 0; } } else { if (!txtBitClock.Visible) { // Store selected USBasp frequency oldUsbAspFreq = ((Avrdude.UsbAspFreq)cmbUSBaspFreq.SelectedItem); // Restore bit clock txtBitClock.Text = oldBitClock; // Show/hide stuff txtBitClock.Show(); cmbUSBaspFreq.Hide(); } } }