当前位置: 首页>>代码示例>>C++>>正文


C++ pm_switch_to_osc0函数代码示例

本文整理汇总了C++中pm_switch_to_osc0函数的典型用法代码示例。如果您正苦于以下问题:C++ pm_switch_to_osc0函数的具体用法?C++ pm_switch_to_osc0怎么用?C++ pm_switch_to_osc0使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了pm_switch_to_osc0函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

//! The main function
int main(int argc, char *argv[])
{
  unsigned int cycle_count;

  // Switch to external Oscillator 0.
  pm_switch_to_osc0(&AVR32_PM, FOSC0, OSC0_STARTUP);

  // Initialize the DSP debug module
  dsp_debug_initialization(FOSC0);

  // Get the actual cycle count
  cycle_count = Get_sys_count();

  // Perform a 25-taps FIR
  dsp16_filt_iirpart(vect1, vect2, SIZE, num, NUM_SIZE, den, DEN_SIZE, 0, 0);

  // Calculate the number of cycles
  cycle_count = Get_sys_count() - cycle_count;

  // Print the number of cycles
  dsp16_debug_printf("Cycle count: %d\n", cycle_count);

  // Print the  output signal
  dsp16_debug_print_vect(vect1, SIZE - NUM_SIZE + 1);

  while(1);
}
开发者ID:kerichsen,项目名称:asf,代码行数:28,代码来源:iirpart_example.c

示例2: inicializa_PM

	void inicializa_PM(void)
	{

		// Activa el oscilador Osc0
		pm_switch_to_osc0(&AVR32_PM,12000000,6);

		//_______________________________________________________________________________
		//Establece la frecuencia  del VCO
		//Si DIV>1           Fvco=((MUL+1)/DIV)*Fosc
		//Si DIV=0           Fvco=2*(MUL+1)*Fosc

		pm_pll_setup(&AVR32_PM,0,7,0,0,16); // lockcount in main clock for the PLL wait lock

		//_______________________________________________________________________________
		// Establece la frecuencia de salida del PLL
		pm_pll_set_option(&AVR32_PM,0,1,1,0);//1 Star-up faster, Start-up normal
		//_______________________________________________________________________________
		//Habilita el PLL 0
		pm_pll_enable(&AVR32_PM,0);
		//_______________________________________________________________________________
		//Espera a que se establesca el PLL
		pm_wait_for_pll0_locked(&AVR32_PM) ;
		//_______________________________________________________________________________
		// Set one wait-state (WS) for flash controller
		flashc_set_wait_state(1);

		//habilita la salida del PLL0 con 2 y el OSC0 con 1
		pm_switch_to_clock(&AVR32_PM, 2);
		



	}
开发者ID:AldricLopez,项目名称:EVK1105,代码行数:33,代码来源:PrimerExamenPractico.c

示例3: main

//! The main function
int main(int argc, char *argv[])
{
  unsigned int cycle_count;
  volatile  dsp32_t fft32_max;

    // Switch to external Oscillator 0.
  pm_switch_to_osc0(&AVR32_PM, FOSC0, OSC0_STARTUP);

    // Initialize the DSP debug module
  dsp_debug_initialization(FOSC0);

    // Get the actual cycle count
  cycle_count = Get_sys_count();
    // Perform a 64-point complex FFT
  dsp32_trans_realcomplexfft(vect1, vect2, NLOG);
  // Perform the absolute value of a complex vector
  dsp32_vect_complex_abs(fft_real, vect1, SIZE);
  // Retrieves the maximum of a vector
  fft32_max = dsp32_vect_max(fft_real, SIZE);

    // Calculate the number of cycles the FFT took
  cycle_count = Get_sys_count() - cycle_count;

    // Print the number of cycles
  dsp32_debug_printf("Cycle count: %d\n", cycle_count);
    // Print the complex FFT output signal
  dsp32_debug_print_complex_vect(vect1, SIZE);

  while(1);
}
开发者ID:kerichsen,项目名称:asf,代码行数:31,代码来源:complex_fft_example.c

示例4: Actividad2

void Actividad2(void){
		
		
		pm_switch_to_osc0(&AVR32_PM, FOSC0, OSC0_STARTUP); //osc0 a 12Mhz
		center=0;
		//Interrupciones
		
		Disable_global_interrupt();

		INTC_init_interrupts();

		INTC_register_interrupt(&tecla_lrc_isr, 71, 0);
		INTC_register_interrupt(&tecla_lrc_isr, 70,0);
		gpio_enable_pin_interrupt(QT1081_TOUCH_SENSOR_LEFT,GPIO_RISING_EDGE);
		gpio_enable_pin_interrupt(QT1081_TOUCH_SENSOR_RIGHT,GPIO_RISING_EDGE);
		gpio_enable_pin_interrupt(QT1081_TOUCH_SENSOR_ENTER,GPIO_RISING_EDGE);
		gpio_enable_pin_interrupt(QT1081_TOUCH_SENSOR_UP,GPIO_RISING_EDGE);
		gpio_enable_pin_interrupt(QT1081_TOUCH_SENSOR_DOWN,GPIO_RISING_EDGE);


		Enable_global_interrupt();
		
		
		
		
		while (1){}
	}
开发者ID:AldricLopez,项目名称:EVK1105,代码行数:27,代码来源:PrimerExamenPractico.c

示例5: main

//! The main function
int main(int argc, char *argv[])
{
  int i;

  // Switch to external Oscillator 0.
  pm_switch_to_osc0(&AVR32_PM, FOSC0, OSC0_STARTUP);

  // Initialize the DSP debug module
  dsp_debug_initialization(FOSC0);

  // Number of recursions
  for(i=0; i<1000; i++)
  {
    // Perform a IIR filter
    dsp16_filt_iir(&y[DEN_SIZE], &x[NUM_SIZE-1], SIZE, num, NUM_SIZE, den, DEN_SIZE, NUM_PREDIV, DEN_PREDIV);
    // Update the output signal
    memmove(y, &y[SIZE], (DEN_SIZE)*sizeof(dsp16_t));

  }

  // Print the  output signal
  dsp16_debug_print_vect(&y[DEN_SIZE], SIZE);

  while(1);
}
开发者ID:ThucVD2704,项目名称:femto-usb-blink-example,代码行数:26,代码来源:iir_example.c

示例6: main

//! The main function
int main(int argc, char *argv[])
{
  unsigned int cycle_count;

  // Switch to external Oscillator 0.
  pm_switch_to_osc0(&AVR32_PM, FOSC0, OSC0_STARTUP);

  // Initialize the DSP debug module
  dsp_debug_initialization(FOSC0);

  // Get the actual cycle count
  cycle_count = Get_sys_count();

  // Perform a convolution
  dsp32_vect_conv(vect1, vect2, VECT2_SIZE, vect3, VECT3_SIZE);

  // Calculate the number of cycles
  cycle_count = Get_sys_count() - cycle_count;

  // Print the number of cycles
  dsp32_debug_printf("Cycle count: %d\n", cycle_count);
  // Print the  output signal
  dsp32_debug_print_vect(vect1, VECT2_SIZE + VECT3_SIZE - 1);

  while(1);
}
开发者ID:InSoonPark,项目名称:asf,代码行数:27,代码来源:convolution_example.c

示例7: main

//! The main function
int main(int argc, char *argv[])
{
  dsp16_t sample_x,sample_d;
  dsp16_t y, e;
  int i;

  // Switch to external Oscillator 0.
  pm_switch_to_osc0(&AVR32_PM, FOSC0, OSC0_STARTUP);

  // Initialize the DSP debug module
  dsp_debug_initialization(FOSC0);


  // Initialization of the buffers
  for(i=0; i<FIR_COEF_SIZE; i++)
  {
    w[i] = 0;
    x[i] = 0;
  }

  for(i=0; i<SIZE; i++)
  {
    // Compute a new sample
    sample_x = input_x[i];
    sample_d = input_d[i];
    // Compute the LMS filter
    dsp16_filt_nlms(x, w, FIR_COEF_SIZE, sample_x, sample_d, &y, &e);

  }

  // Print the  output signal
  dsp16_debug_print_vect(&w[0], FIR_COEF_SIZE);

  while(1);
}
开发者ID:InSoonPark,项目名称:asf,代码行数:36,代码来源:nlms_example.c

示例8: main

//! The main function
int main(int argc, char *argv[])
{
  dsp32_t vect1[SIZE];
  int cycle_count;
  int frequency, sample_rate;
  dsp32_t phase, amplitude;

  // Switch to external Oscillator 0.
  pm_switch_to_osc0(&AVR32_PM, FOSC0, OSC0_STARTUP);

  // Initialize the DSP debug module
  dsp_debug_initialization(FOSC0);

  // 1 KHz
  frequency = 1000;
  // 10 KHz
  sample_rate = 100000;
  // phase = PI/2
  phase = DSP32_Q(0.5);
  // amplitude
  amplitude = DSP32_Q(1.);

  dsp32_debug_printf("32-bit signal generation program test\n");

  // Compute the signal to generate
  switch(SIGNAL_TO_USE)
  {
  // Sinusoidal
  case SIGNAL_SIN:
    dsp32_debug_printf("Sine\n");
    dsp32_debug_printf("Frequency: %d, Fs: %d, Phase: %f\n", frequency, sample_rate, phase);
    cycle_count = Get_sys_count();
    dsp32_gen_sin(vect1, SIZE, frequency, sample_rate, phase);
    cycle_count = Get_sys_count() - cycle_count;
    break;
  // Cosinusoidal
  case SIGNAL_COS:
    dsp32_debug_printf("Cosine\n");
    dsp32_debug_printf("Frequency: %d, Fs: %d, Phase: %f\n", frequency, sample_rate, phase);
    cycle_count = Get_sys_count();
    dsp32_gen_cos(vect1, SIZE, frequency, sample_rate, phase);
    cycle_count = Get_sys_count() - cycle_count;
    break;
  // Noise
  case SIGNAL_NOISE:
    dsp32_debug_printf("Noise\n");
    dsp32_debug_printf("Amplitude: %d\n", amplitude);
    cycle_count = Get_sys_count();
    dsp32_gen_noise(vect1, SIZE, amplitude);
    cycle_count = Get_sys_count() - cycle_count;
    break;
  }

  // Print the number of cycles
  dsp32_debug_printf("Cycle count: %d\n", cycle_count);
  // Print the signal
  dsp32_debug_print_vect(vect1, SIZE);

  while(1);
}
开发者ID:kerichsen,项目名称:asf,代码行数:61,代码来源:signal_generation_example.c

示例9: main

/*! \brief This example shows how to access an external RAM connected to the SMC module.
 */
int main(void)
{
	// Get base address of SRAM module
	volatile uint32_t *sram = SRAM;

	// Switch to external oscillator 0.
	pm_switch_to_osc0(&AVR32_PM, FOSC0, OSC0_STARTUP);

	// Initialize debug serial line
	init_dbg_rs232(FOSC0);

	// Display a header to user
	print_dbg("\x1B[2J\x1B[H\r\nSMC Example\r\n");

	print_dbg("Board running at ");
	print_dbg_ulong(FOSC0 / 1000000);
	print_dbg(" MHz\r\n");

	print_dbg("Initializing SRAM...");

	// Initialize the external SRAM chip.
	smc_init(FOSC0);
	print_dbg("done\r\n\r\n");

	print_dbg("Testing SRAM...\r\n");

	// Test each address location inside the chip with a write/readback
	uint32_t total_tests  = 0;
	uint32_t total_errors = 0;

	for (uint32_t total_tests = 0; total_tests < SRAM_SIZE; total_tests++) {
		sram[total_tests] = total_tests;

		if (total_tests != sram[total_tests]) {
			total_errors++;

			print_dbg("Error at 0x");
			print_dbg_hex((uint32_t)&sram[total_tests]);
			print_dbg("\r\n");
		}
    }

	if (total_errors == 0) {
		print_dbg("SRAM test successfully completed\r\n");
	}
	else {
		print_dbg("SRAM test completed with ");
		print_dbg_ulong(total_errors);
		print_dbg(" errors out of ");
		print_dbg_ulong(total_tests);
		print_dbg(" tests\r\n");
	}

	while (true);

	return 0;
}
开发者ID:ThucVD2704,项目名称:femto-usb-blink-example,代码行数:59,代码来源:smc_example.c

示例10: main

//! The main function
int main(int argc, char *argv[])
{
  A_ALIGNED static dsp16_t s_input[N/NB_CUTS];
  int f;
  dsp_resampling_t *resampling;
  dsp16_t *output;
  U32 temp;
  dsp16_resampling_options_t options;

  // Initialize options
  memset(&options, 0, sizeof(options));
  options.coefficients_generation = DSP16_RESAMPLING_OPTIONS_USE_DYNAMIC;
  options.dynamic.coefficients_normalization = true;

  // Switch to external Oscillator 0.
  pm_switch_to_osc0(&AVR32_PM, FOSC0, OSC0_STARTUP);

  // Initialize the DSP debug module
  dsp_debug_initialization(FOSC0);

  dsp16_debug_printf("16-bit fixed point signal resampling\n");
  dsp16_debug_printf("Input Fs: %iHz\n", F_INPUT);
  dsp16_debug_printf("Output Fs: %iHz\n", F_OUTPUT);
  dsp16_debug_printf("%i samples to process cut into %i buffers\n", N, NB_CUTS);
  dsp16_debug_printf("Filter order used: %i\n", FILTER_ORDER);

  if (!(resampling = dsp16_resampling_setup(F_INPUT, F_OUTPUT, N/NB_CUTS, FILTER_ORDER, 1, (malloc_fct_t) malloc, &options)))
  {
    dsp16_debug_printf("Unable to allocate enough memory\n");
    return -1;
  }

  if (!(output = (dsp16_t *) malloc(dsp16_resampling_get_output_max_buffer_size(resampling)*sizeof(dsp16_t) + 4)))
  {
    dsp16_debug_printf("Unable to allocate enough memory for the output buffer\n");
    return -1;
  }

  for(f=0; f<NB_CUTS; f++)
  {
    memcpy(s_input, &s[N/NB_CUTS*f], (N/NB_CUTS)*sizeof(dsp16_t));
    temp = Get_sys_count();
    dsp16_resampling_compute(resampling, output, s_input, 0);
    temp = Get_sys_count() - temp;
    dsp16_debug_print_vect(output, dsp16_resampling_get_output_current_buffer_size(resampling));
  }
  dsp16_debug_printf(
    "Cycle count per iteration: %i\n            in total (to compute %i samples): %i\n",
    temp,
    dsp16_resampling_get_output_current_buffer_size(resampling)*NB_CUTS,
    temp*NB_CUTS);

  dsp16_resampling_free(resampling, (free_fct_t) free);

  while(1);
}
开发者ID:InSoonPark,项目名称:asf,代码行数:57,代码来源:resampling_example.c

示例11: init_sys_clocks

/*! \brief Initializes the MCU system clocks.
 */
static void init_sys_clocks(void)
{
    // Switch to OSC0 to speed up the booting
    pm_switch_to_osc0(&AVR32_PM, FOSC0, OSC0_STARTUP);

    // Start oscillator1
    pm_enable_osc1_crystal(&AVR32_PM, FOSC1);
    //
    pm_enable_clk1(&AVR32_PM, OSC1_STARTUP);

    // Set PLL0 (fed from OSC1 = 11.2896 MHz) to 112.896 MHz
    // We use OSC1 since we need a correct master clock for the SSC module to generate
    // the correct sample rate
    pm_pll_setup(&AVR32_PM, 0,  // pll.
                 SYS_CLOCK_PLL_MUL-1,   // mul.
                 1,   // div.
                 1,   // osc.
                 16); // lockcount.

    // Set PLL operating range and divider (fpll = fvco/2)
    // -> PLL0 output = 62.0928 MHz
    pm_pll_set_option(&AVR32_PM, 0, // pll.
                      1,  // pll_freq.
                      1,  // pll_div2.
                      0); // pll_wbwdisable.

    // start PLL0 and wait for the lock
    pm_pll_enable(&AVR32_PM, 0);
    pm_wait_for_pll0_locked(&AVR32_PM);
    // Set all peripheral clocks torun at master clock rate
    pm_cksel(&AVR32_PM,
             0,   // pbadiv.
             0,   // pbasel.
             0,   // pbbdiv.
             0,   // pbbsel.
             0,   // hsbdiv.
             0);  // hsbsel.

    // Set one waitstate for the flash
    flashc_set_wait_state(1);

    // Switch to PLL0 as the master clock
    pm_switch_to_clock(&AVR32_PM, AVR32_PM_MCCTRL_MCSEL_PLL0);

#if (defined USB_RESYNC_METHOD) && (USB_RESYNC_METHOD == USB_RESYNC_METHOD_EXT_CLOCK_SYNTHESIZER)
    // Holds frequencies parameters
    g_fcpu_hz = g_fhsb_hz = g_fpba_hz = g_fpbb_hz = FMCK_HZ(11289600);
#endif

#if (defined __GNUC__) && (defined __AVR32__)
    // Give the used PBA clock frequency to Newlib, so it can work properly.
    set_cpu_hz(FPBA_HZ);
#endif
    init_usb_clock();
    init_codec_gclk();
}
开发者ID:kerichsen,项目名称:asf,代码行数:58,代码来源:audio_example.c

示例12: init_sys_clocks

/*! \brief Initializes the MCU system clocks.
 */
void init_sys_clocks(void)
{
  // Switch to OSC0 to speed up the booting
  pm_switch_to_osc0(&AVR32_PM, FOSC0, OSC0_STARTUP);

  // Start oscillator1
  pm_enable_osc1_crystal(&AVR32_PM, FOSC1);
  pm_enable_clk1(&AVR32_PM, OSC1_STARTUP);

  // Set PLL0 (fed from OSC0 = 12 MHz) to 132 MHz
  // We use OSC1 since we need a correct master clock for the SSC module to generate
  // the correct sample rate
  pm_pll_setup(&AVR32_PM, 0,  // pll.
    10,  // mul.
    1,   // div.
    0,   // osc.
    16); // lockcount.

  // Set PLL operating range and divider (fpll = fvco/2)
  // -> PLL0 output = 66 MHz
  pm_pll_set_option(&AVR32_PM, 0, // pll.
    1,  // pll_freq.
    1,  // pll_div2.
    0); // pll_wbwdisable.

  // start PLL0 and wait for the lock
  pm_pll_enable(&AVR32_PM, 0);
  pm_wait_for_pll0_locked(&AVR32_PM);
  // Set all peripheral clocks torun at master clock rate

  // Set one waitstate for the flash
  flashc_set_wait_state(1);

  // Switch to PLL0 as the master clock
  pm_switch_to_clock(&AVR32_PM, AVR32_PM_MCCTRL_MCSEL_PLL0);

  // Use 12MHz from OSC0 and generate 96 MHz
  pm_pll_setup(&AVR32_PM, 1,  // pll.
	  7,   // mul.
	  1,   // div.
	  0,   // osc.
	  16); // lockcount.

  pm_pll_set_option(&AVR32_PM, 1, // pll.
	  1,  // pll_freq: choose the range 80-180MHz.
	  1,  // pll_div2.
	  0); // pll_wbwdisable.

  // start PLL1 and wait forl lock
  pm_pll_enable(&AVR32_PM, 1);

  // Wait for PLL1 locked.
  pm_wait_for_pll1_locked(&AVR32_PM);

}
开发者ID:kerichsen,项目名称:asf,代码行数:57,代码来源:demo.c

示例13: Avr32InitClockTree

void Avr32InitClockTree( void )
{
    uint32_t CPUFrequency;

    /* Switch main clock to Oscillator 0 */
    pm_switch_to_osc0(OSC0_VAL, AVR32_PM_OSCCTRL0_STARTUP_2048_RCOSC);

    pm_pll_setup(&AVR32_PM, 0,  /* use PLL0     */
                 PLL_MUL_VAL,   /* MUL          */
                 PLL_DIV_VAL,   /* DIV          */
                 0,             /* Oscillator 0 */
                 16);           /* lockcount in main clock for the PLL wait lock */

    /*
     * This function will set a PLL option.
     *
     * pm             Base address of the Power Manager (i.e. &AVR32_PM)
     * pll            PLL number 0
     * pll_freq       Set to 1 for VCO frequency range 80-180MHz,
     *                set to 0 for VCO frequency range 160-240Mhz.
     * pll_div2       Divide the PLL output frequency by 2 (this settings does
     *                not change the FVCO value)
     * pll_wbwdisable 1 Disable the Wide-Bandwidth Mode (Wide-Bandwidth mode
     *                allow a faster startup time and out-of-lock time). 0 to
     *                enable the Wide-Bandwidth Mode.
     */
    pm_pll_set_option(&AVR32_PM, 0,     /* use PLL0 */
                      PLL_FREQ_VAL,     /* pll_freq */
                      PLL_DIV2_VAL,     /* pll_div2 */
                      PLL_WBWD_VAL);    /* pll_wbwd */

    /* Enable PLL0 */
    pm_pll_enable(&AVR32_PM, 0);

    /* Wait for PLL0 locked */
    pm_wait_for_pll0_locked(&AVR32_PM);

    /* Create PBA, PBB and HSB clock */
    pm_cksel(&AVR32_PM, PLL_PBADIV_VAL, /* pbadiv */
             PLL_PBASEL_VAL,    /* pbasel */
             PLL_PBBDIV_VAL,    /* pbbdiv */
             PLL_PBBSEL_VAL,    /* pbbsel */
             PLL_HSBDIV_VAL,    /* hsbdiv */
             PLL_HSBSEL_VAL);   /* hsbsel */

    /* Calculate CPU frequency */
    CPUFrequency = (OSC0_VAL * (PLL_MUL_VAL + 1)) / PLL_DIV_VAL;
    CPUFrequency = (PLL_DIV2_VAL == 0) ? CPUFrequency : CPUFrequency >> 1;

    if (PLL_HSBDIV_VAL > 0) {
        CPUFrequency = CPUFrequency >> (PLL_HSBSEL_VAL + 1);
    }
开发者ID:Astralix,项目名称:ethernut32,代码行数:52,代码来源:pm_uc3a.c

示例14: main

/*! \brief Main function.
 */
int main(void)
{
  static const gpio_map_t TWI_GPIO_MAP =
  {
    {AVR32_TWI_SDA_0_0_PIN, AVR32_TWI_SDA_0_0_FUNCTION},
    {AVR32_TWI_SCL_0_0_PIN, AVR32_TWI_SCL_0_0_FUNCTION}
  };
  twi_options_t opt;
  twi_slave_fct_t twi_slave_fct;
  int status;

  // Switch to oscillator 0
  pm_switch_to_osc0(&AVR32_PM, FOSC0, OSC0_STARTUP);

  // Init debug serial line
  init_dbg_rs232(FOSC0);

  // Initialize and enable interrupt
  irq_initialize_vectors();
  cpu_irq_enable();

  // Display a header to user
  print_dbg("\x0C\r\nTWI Example\r\nSlave!\r\n");

  // TWI gpio pins configuration
  gpio_enable_module(TWI_GPIO_MAP, sizeof(TWI_GPIO_MAP) / sizeof(TWI_GPIO_MAP[0]));

  // options settings
  opt.pba_hz = FOSC0;
  opt.speed = TWI_SPEED;
  opt.chip = EEPROM_ADDRESS;

  // initialize TWI driver with options
  twi_slave_fct.rx = &twi_slave_rx;
  twi_slave_fct.tx = &twi_slave_tx;
  twi_slave_fct.stop = &twi_slave_stop;
  status = twi_slave_init(&AVR32_TWI, &opt, &twi_slave_fct );
  // check init result
  if (status == TWI_SUCCESS)
  {
    // display test result to user
    print_dbg("Slave start:\tPASS\r\n");
  }
  else
  {
    // display test result to user
    print_dbg("slave start:\tFAIL\r\n");
  }

  while(1);
}
开发者ID:AndreyMostovov,项目名称:asf,代码行数:53,代码来源:twi_slave_example.c

示例15: main

//! The main function
int main(int argc, char *argv[])
{
  int cycle_count, size;
  int i;

  // Switch to external Oscillator 0.
  pm_switch_to_osc0(&AVR32_PM, FOSC0, OSC0_STARTUP);

  // Initialize the DSP debug module
  dsp_debug_initialization(FOSC0);

  dsp16_debug_printf("16-bit fixed point vectors program test\n");

  dsp16_debug_printf("Output vector 1 (size %i)\n", VECT1_SIZE);
  dsp16_debug_printf("Input vector 2 (size %i)\n", VECT2_SIZE);
  dsp16_debug_printf("Input vector 3 (size %i)\n", VECT3_SIZE);

  while(1)
  {
    // Print the menu
    dsp16_debug_printf("***** Menu *****\n");
    for(i=0; i<sizeof(item_menu)/sizeof(s_item_menu); i++)
      dsp16_debug_printf("%i:\t%s\n", i, item_menu[i].title);

    // Prompt
    dsp16_debug_printf("> ");
    i = dsp_debug_read_ui();

    if (i >= 0 && i < sizeof(item_menu)/sizeof(s_item_menu))
    {
      // Print the title
      dsp16_debug_printf("%s\n", item_menu[i].title);

      // Call the function to execute
      cycle_count = item_menu[i].action(&size);

      if (cycle_count != -1)
      {
        // Print the number of cycles
        dsp16_debug_printf("Cycle count: %d\n", cycle_count);
        // Print the result
        dsp16_debug_print_vect(vect1, size);
      }
    }
    else
      dsp16_debug_printf("!Invalid item!\n");

    dsp16_debug_printf("<Press any key to continue>\n");
    dsp_debug_read_fct();
  }
}
开发者ID:ThucVD2704,项目名称:femto-usb-blink-example,代码行数:52,代码来源:vectors_example.c


注:本文中的pm_switch_to_osc0函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。