Esempio n. 1
0
//------------------------------------------------------------------------------
// Sets up ports for all peripherals
// NOTE 'default' Refers to the default device setup for the application.
void gPB_enter_default_config()
{
   // Enable the APB clock to the PB registers
   // Enable SW printf
   SI32_CLKCTRL_A_enable_apb_to_modules_0(SI32_CLKCTRL_0,
      SI32_CLKCTRL_A_APBCLKG0_PB0);
   SI32_PBSTD_A_set_pins_push_pull_output(SI32_PBSTD_1, 0x00000008);

   // Enable Crossbar 1, where the example drives LEDs, samples buttons, and
   // outputs the RTC clock.
   SI32_PBCFG_A_enable_crossbar_1(SI32_PBCFG_0);

   // GPIO Port Bank setup
   // Enable the LED drivers (P2.10, P2.11)
   SI32_PBSTD_A_set_pins_push_pull_output(SI32_PBSTD_2, 0x00000C00);

   // Enable switch sensing (P2.10, P2.11)
   SI32_PBSTD_A_set_pins_digital_input(SI32_PBSTD_2, 0x00000300);

   // RTC Port Bank setup
   // Set the RTC oscillator pins to analog mode (PB0.9, PB0.10)
   SI32_PBSTD_A_set_pins_analog(SI32_PBSTD_0, 0x00000600);

   // Ouptut the RTC0 clock (PB2.7)
   SI32_PBSTD_A_set_pins_push_pull_output(SI32_PBSTD_2, 0x00000080);
   SI32_PBSTD_A_write_pbskipen(SI32_PBSTD_2, 0x0000007F);
   SI32_PBCFG_A_enable_xbar1_peripherals(SI32_PBCFG_0,
      SI32_PBCFG_A_XBAR1_RTC0EN);
}
Esempio n. 2
0
void pb_enter_default_mode_from_reset(void)
{
  // PB0 Setup (SPI MISO=PB0.6, SCLK=PB0.5,MOSI=PB0.7,CS=PB0.8)
  SI32_PBSTD_A_set_pins_digital_input(SI32_PBSTD_0, 0x0040);
  SI32_PBSTD_A_set_pins_push_pull_output(SI32_PBSTD_0, 0x01A0);
  SI32_PBSTD_A_write_pbskipen(SI32_PBSTD_0, 0xFE1F);

  // PB1 Setup (UART TX = PB1.12, RX = PB1.13)
  SI32_PBSTD_A_set_pins_digital_input(SI32_PBSTD_1, 0x2000);
  SI32_PBSTD_A_set_pins_push_pull_output(SI32_PBSTD_1, 0x1008);
  SI32_PBSTD_A_write_pbskipen(SI32_PBSTD_1, 0x0FFF);

  // Enable Crossbar0 signals & set properties
  SI32_PBCFG_A_enable_xbar0l_peripherals(SI32_PBCFG_0,
                                         SI32_PBCFG_A_XBAR0L_SPI0EN |
                                         SI32_PBCFG_A_XBAR0L_SPI0NSSEN);
  SI32_PBCFG_A_enable_xbar0h_peripherals(SI32_PBCFG_0, SI32_PBCFG_A_XBAR0H_UART0EN);
  SI32_PBCFG_A_enable_crossbar_0(SI32_PBCFG_0);

  // PB2 Setup (SDSW = PB2.9, PB2.10 and PB2.11 are LEDs)
  SI32_PBSTD_A_set_pins_digital_input(SI32_PBSTD_2, 0x0200);
  SI32_PBSTD_A_set_pins_push_pull_output(SI32_PBSTD_2, 0x0C00);

  // Enable Crossbar1 signals & set properties
  SI32_PBCFG_A_enable_crossbar_1(SI32_PBCFG_0);
}
Esempio n. 3
0
void wave_125k_init(void)
{
	SI32_TIMER_A_Type* SI32_TIMER = SI32_TIMER_1;
	uint16_t reload_value = get_wave_reload_value(WAVE_125K);
	SI32_CLKCTRL_A_enable_apb_to_modules_0(SI32_CLKCTRL_0, SI32_CLKCTRL_A_APBCLKG0_TIMER1);
	
	SI32_TIMER_A_select_square_wave_output_mode(SI32_TIMER);
	SI32_TIMER_A_disable_high_overflow_interrupt(SI32_TIMER);
	SI32_TIMER_A_disable_high_extra_interrupt(SI32_TIMER);
	SI32_TIMER_A_enable_stall_in_debug_mode(SI32_TIMER);
	SI32_TIMER_A_select_high_clock_source_apb_clock(SI32_TIMER);
	SI32_TIMER_A_select_split_timer_mode(SI32_TIMER);
	
	SI32_TIMER_A_set_high_count(SI32_TIMER,reload_value);
	SI32_TIMER_A_set_high_reload(SI32_TIMER,reload_value);

	SI32_TIMER_A_clear_high_overflow_interrupt(SI32_TIMER);
	SI32_PBCFG_A_enable_xbar0_peripherals(SI32_PBCFG_0, SI32_PBCFG_A_XBAR0_TMR1EXEN);
	SI32_PBSTD_A_set_pins_push_pull_output(SI32_PBSTD_0, 0x0100);	
}