本文整理汇总了C++中pmc_enable_periph_clk函数的典型用法代码示例。如果您正苦于以下问题:C++ pmc_enable_periph_clk函数的具体用法?C++ pmc_enable_periph_clk怎么用?C++ pmc_enable_periph_clk使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pmc_enable_periph_clk函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: main
/**
* \brief Application entry point for TWIHS Slave example.
*
* \return Unused (ANSI-C compatibility).
*/
int main(void)
{
uint32_t i;
/* Initialize the SAM system */
sysclk_init();
/* Initialize the board */
board_init();
/* Initialize the console UART */
configure_console();
/* Output example information */
puts(STRING_HEADER);
/* Enable the peripheral clock for TWIHS */
pmc_enable_periph_clk(BOARD_ID_TWIHS_SLAVE);
for (i = 0; i < MEMORY_SIZE; i++) {
emulate_driver.uc_memory[i] = 0;
}
emulate_driver.us_offset_memory = 0;
emulate_driver.uc_acquire_address = 0;
emulate_driver.us_page_address = 0;
/* Configure TWIHS as slave */
puts("-I- Configuring the TWIHS in slave mode\n\r");
twihs_slave_init(BOARD_BASE_TWIHS_SLAVE, SLAVE_ADDRESS);
/* Clear receipt buffer */
twihs_read_byte(BOARD_BASE_TWIHS_SLAVE);
/* Configure TWIHS interrupts */
NVIC_DisableIRQ(BOARD_TWIHS_IRQn);
NVIC_ClearPendingIRQ(BOARD_TWIHS_IRQn);
NVIC_SetPriority(BOARD_TWIHS_IRQn, 0);
NVIC_EnableIRQ(BOARD_TWIHS_IRQn);
twihs_enable_interrupt(BOARD_BASE_TWIHS_SLAVE, TWIHS_SR_SVACC);
while (1) {
}
}
开发者ID:InSoonPark,项目名称:asf,代码行数:48,代码来源:twihs_slave_example.c
示例2: timer_init
void timer_init() {
// assign a clock signal
pmc_enable_periph_clk(ID_TC0);
// divide master clock by 32 and enable waveform mode in the channel mode register
TC_CMR0_CH0 = CMR_DIV_32 + CMR_WAVE_EN + CMR_WAVE_SEL;
// load the RC register with the value to interrupt every 1 ms
TC_RC0_CH0 = 3125;
// enable the RC compare interrupt in the Interrupt Enable Register
TC_IER0_CH0 = INT_CPCS;
// enable interrupts for timer 0
NVIC_EnableIRQ(TC0_IRQn);
// enable timer 0 in the channel control register
TC_CCR0_CH0 = CCR_CLKEN + CCR_SWTRG;
}
开发者ID:AbhishekShah212,项目名称:School_Projects,代码行数:19,代码来源:main.c
示例3: pwm_init
void pwm_init() {
// assign a clock signal to this peripheral
pmc_enable_periph_clk(ID_PWM);
// divide the master clock by 32 and then again by 3 in the mode register
PWM_MR = (0x05*0x100) + 0x03;
// set up the pwm module to use CLKA and set the polarity in the channel mode register
PWM_CMR0 = (0x02*0x100) + 0x0B;
// set the period to 511 in the period register to match the speed value from the potentiometer
PWM_CPRD0 = 0x1FF;
// initialize the duty cycle to 0 in the Duty Register
PWM_CDTY0 = 0x00;
// enable pwm 0 in enable register
PWM_ENA = CHID0;
}
开发者ID:AbhishekShah212,项目名称:School_Projects,代码行数:19,代码来源:main.c
示例4: main
/**
* \brief Application entry point for sdramc_example.
*
* \return Unused (ANSI-C compatibility).
*/
int main(void)
{
/* Initialize the system */
sysclk_init();
board_init();
sleepmgr_init();
/* Configure the console uart */
configure_console();
/* Output example information */
puts(STRING_HEADER);
/* Systick configuration */
if (SysTick_Config(SystemCoreClock / (1000))) {
puts("-F- Systick configuration error.\r");
}
/* Enable SMC peripheral clock */
pmc_enable_periph_clk(ID_SDRAMC);
/* Complete SDRAM configuration */
sdramc_init((sdramc_memory_dev_t *)&SDRAM_ISSI_IS42S16100E,
sysclk_get_cpu_hz());
sdram_enable_unaligned_support();
/* Test external SDRAM access */
puts("Test external SDRAM access. \r");
if (sdram_access_test() == SDRAMC_OK) {
puts("SDRAM access is successful.\n\r");
} else {
puts("SDRAM access is failed.\r");
}
if (sdram_benchmarks() == SDRAMC_OK) {
puts("SDRAM test: pass.\r");
}
for (;;) {
sleepmgr_enter_sleep();
}
}
开发者ID:thegeek82000,项目名称:asf,代码行数:48,代码来源:is42s16100e_example.c
示例5: run_trng_test
/**
* \brief Test TRNG setting.
*
* This test sets the TRNG to generate interrupt when new random value is completed.
*
* \param test Current test case.
*/
static void run_trng_test(const struct test_case *test)
{
/* Configure PMC */
pmc_enable_periph_clk(ID_TRNG);
/* Enable TRNG */
trng_enable(TRNG);
/* Enable TRNG interrupt */
NVIC_DisableIRQ(TRNG_IRQn);
NVIC_ClearPendingIRQ(TRNG_IRQn);
NVIC_SetPriority(TRNG_IRQn, 0);
NVIC_EnableIRQ(TRNG_IRQn);
trng_enable_interrupt(TRNG);
while(trng_int_flag == 0);
test_assert_true(test, trng_int_flag == 1, "No random value is generated");
}
开发者ID:thegeek82000,项目名称:asf,代码行数:26,代码来源:unit_tests.c
示例6: configure_buttons
/**
* \brief Configure the Push buttons
*
* Configure the PIO as inputs and generate corresponding interrupt when
* pressed or released.
*/
static void configure_buttons(void)
{
/* Enable the peripheral clock for PCK and push button */
pmc_enable_periph_clk(PIN_PUSHBUTTON_1_ID);
/* Adjust PIO debounce filter parameters, using 10 Hz filter. */
pio_set_debounce_filter(PIN_PUSHBUTTON_1_PIO, PIN_PUSHBUTTON_1_MASK, 10);
/* Initialize PIOs interrupt handlers, see PIO definition in board.h. */
/* Interrupt on rising edge */
pio_handler_set(PIN_PUSHBUTTON_1_PIO, PIN_PUSHBUTTON_1_ID,
PIN_PUSHBUTTON_1_MASK, PIN_PUSHBUTTON_1_ATTR, button1_handler);
/* Enable PIO controller IRQs. */
NVIC_EnableIRQ((IRQn_Type) PIN_PUSHBUTTON_1_ID);
/* Enable PIO line interrupts. */
pio_enable_interrupt(PIN_PUSHBUTTON_1_PIO, PIN_PUSHBUTTON_1_MASK);
}
开发者ID:AndreyMostovov,项目名称:asf,代码行数:25,代码来源:pmc_clock_switching_example.c
示例7: dsp_configure_dacc
/**
* \brief DACC configuration.
*/
static void dsp_configure_dacc(void)
{
pmc_enable_periph_clk(ID_DACC);
/*
* DACC setting
* -Refresh Period = 1024*REFRESH/DACC Clock
* -No max Speed Mode
* -Startup time of 0 periods of DACClock
*/
dacc_set_timing(DACC, DACC_REFRESH, 0, DACC_MR_STARTUP_0);
/* Set TIO Output of TC Channel 1 as trigger */
dacc_set_trigger(DACC,2);
/* Set to half word transfer */
dacc_set_transfer_mode(DACC, DACC_MR_WORD_HALF);
#if (SAM3S) || (SAM3XA)
/* Set to No Sleep Mode and No Fast Wake Up Mode*/
dacc_set_power_save(DACC, 0, 0);
#endif
/* Select both left/right speaker channels. */
dacc_set_channel_selection(DACC, SPEAKER_CHANNEL_R);
dacc_set_channel_selection(DACC, SPEAKER_CHANNEL_L);
/* Enable DACC channels. */
dacc_enable_channel(DACC, SPEAKER_CHANNEL_R);
dacc_enable_channel(DACC, SPEAKER_CHANNEL_L);
/* Tag selection mode enabled. */
dacc_enable_flexible_selection(DACC);
/* Get board DACC PDC base address. */
dacc_pdc = dacc_get_pdc_base(DACC);
/* Enable DACC interrupt. */
dacc_enable_interrupt(DACC,DACC_IER_ENDTX);
NVIC_SetPriority(DACC_IRQn, INT_PRIORITY_DACC);
NVIC_EnableIRQ(DACC_IRQn);
}
开发者ID:thegeek82000,项目名称:asf,代码行数:45,代码来源:task_dsp.c
示例8: init_specific_board
/**
* \brief Configures SAMG55 for low power demo.
*/
void init_specific_board(void)
{
/* For the lowest power consumption all pins should have defined state
* e.g. no floating pins.
* Set all pins as input with pull-up enabled with the exception:
* - CDC UART RX (PA27) should not be pulled up because this pin is
* driven by the EDBG in this application
* - CDC UART TX (PA28) This is actively driven by the SAMG55 in this
* application
* - PB04 should set as output
* - PB8 PB9 PB10 PB11 should set as output
*/
pio_set_input(PIOA, 0xE7FFFFFF, PIO_PULLUP);
pio_set_input(PIOA, 0x18000000, PIO_DEFAULT);
pio_set_input(PIOB, 0xFFFF0EF, PIO_PULLUP);
pio_set_output(PIOB, 0xF10, HIGH, DISABLE, DISABLE);
/* Enable the PMC clocks of push button for wakeup */
pmc_enable_periph_clk(ID_PIOA);
pio_handler_set_priority(PIOA, PIOA_IRQn, IRQ_PRIORITY_PIO);
}
开发者ID:thegeek82000,项目名称:asf,代码行数:23,代码来源:low_power_board.c
示例9: pmc_set_writeprotect
/*------------------------------------------------------------------------------
Name: startTimer
parameters: tc - timer counter
channel - timer channel
irq - isr request
frequency - frequency of inetrrupts
description: initializes timer for periodic interrupt generation
------------------------------------------------------------------------------*/
void BldcControl::configureTimerInterrupt(Tc *tc,
uint32_t channel,
IRQn_Type irq,
uint32_t frequency)
{
pmc_set_writeprotect(false);
pmc_enable_periph_clk((uint32_t)irq);
TC_Configure(tc,
channel,
TC_CMR_WAVE | TC_CMR_WAVSEL_UP_RC |
TC_CMR_TCCLKS_TIMER_CLOCK4);
uint32_t rc = VARIANT_MCK/128/frequency; //128 because we selected
//TIMER_CLOCK4 above
TC_SetRA(tc, channel, rc/2); //50% high, 50% low
TC_SetRC(tc, channel, rc);
TC_Start(tc, channel);
tc->TC_CHANNEL[channel].TC_IER=TC_IER_CPCS;
tc->TC_CHANNEL[channel].TC_IDR=~TC_IER_CPCS;
NVIC_EnableIRQ(irq);
}
开发者ID:MbedTinkerer,项目名称:ArduinoBldc,代码行数:28,代码来源:BLDC_Control.cpp
示例10: pinMode
//------------------------------------------------------------------------------
void SdSpiAltDriver::begin(uint8_t csPin) {
m_csPin = csPin;
pinMode(m_csPin, OUTPUT);
digitalWrite(m_csPin, HIGH);
SPI.begin();
#if USE_SAM3X_DMAC
pmc_enable_periph_clk(ID_DMAC);
dmac_disable();
DMAC->DMAC_GCFG = DMAC_GCFG_ARB_CFG_FIXED;
dmac_enable();
#if USE_SAM3X_BUS_MATRIX_FIX
MATRIX->MATRIX_WPMR = 0x4d415400;
MATRIX->MATRIX_MCFG[1] = 1;
MATRIX->MATRIX_MCFG[2] = 1;
MATRIX->MATRIX_SCFG[0] = 0x01000010;
MATRIX->MATRIX_SCFG[1] = 0x01000010;
MATRIX->MATRIX_SCFG[7] = 0x01000010;
#endif // USE_SAM3X_BUS_MATRIX_FIX
#endif // USE_SAM3X_DMAC
}
开发者ID:NanoDano,项目名称:cookbook,代码行数:21,代码来源:SdSpiSAM3X.cpp
示例11: run_gmac_link_test
/**
* \brief GMAC link test function.
*
* \param test Current test case.
*/
static void run_gmac_link_test(const struct test_case *test)
{
gmac_options_t gmac_option;
uint8_t uc_rc = 1;
/* Enable GMAC clock */
pmc_enable_periph_clk(ID_GMAC);
/* Fill in GMAC options */
gmac_option.uc_copy_all_frame = 1;
gmac_option.uc_no_boardcast = 1;
memcpy(gmac_option.uc_mac_addr, gs_uc_mac_address, sizeof(gs_uc_mac_address));
gs_gmac_dev.p_hw = GMAC;
/* Init GMAC driver structure */
gmac_dev_init(GMAC, &gs_gmac_dev, &gmac_option);
/* Enable Interrupt */
NVIC_EnableIRQ(GMAC_IRQn);
/* Init MAC PHY driver */
if (ethernet_phy_init(GMAC, BOARD_GMAC_PHY_ADDR, sysclk_get_cpu_hz())
!= GMAC_OK) {
uc_rc = 0;
}
/* Auto Negotiate, work in RMII mode */
if (ethernet_phy_auto_negotiate(GMAC, BOARD_GMAC_PHY_ADDR) != GMAC_OK) {
uc_rc = 0;
}
/* Establish ethernet link */
while (ethernet_phy_set_link(GMAC, BOARD_GMAC_PHY_ADDR, 1) != GMAC_OK) {
uc_rc = 0;
}
test_assert_true(test, uc_rc == 1, "Test GMAC: GMAC link test error!");
}
开发者ID:AndreyMostovov,项目名称:asf,代码行数:46,代码来源:unit_tests.c
示例12: pmc_enable_periph_clk
/*************************************************************************
Initialization of the I2C bus interface. Need to be called only once
*************************************************************************/
void HAL::i2cInit(unsigned long clockSpeedHz)
{
// enable TWI
pmc_enable_periph_clk(TWI_ID);
// Configure pins
PIO_Configure(g_APinDescription[SDA_PIN].pPort,
g_APinDescription[SDA_PIN].ulPinType,
g_APinDescription[SDA_PIN].ulPin,
g_APinDescription[SDA_PIN].ulPinConfiguration);
PIO_Configure(g_APinDescription[SCL_PIN].pPort,
g_APinDescription[SCL_PIN].ulPinType,
g_APinDescription[SCL_PIN].ulPin,
g_APinDescription[SCL_PIN].ulPinConfiguration);
// Set to Master mode with known state
TWI_INTERFACE->TWI_CR = TWI_CR_SVEN;
TWI_INTERFACE->TWI_CR = TWI_CR_SWRST;
//TWI_INTERFACE->TWI_RHR; // no action???
TWI_INTERFACE->TWI_IMR = 0;
TWI_INTERFACE->TWI_CR = TWI_CR_SVDIS;
TWI_INTERFACE->TWI_CR = TWI_CR_MSDIS;
TWI_INTERFACE->TWI_CR = TWI_CR_MSEN;
// Set i2c clock rate
uint32_t dwCkDiv = 0;
uint32_t dwClDiv;
while ( dwClDiv == 0 )
{
dwClDiv = ((F_CPU_TRUE / (2 * clockSpeedHz)) - 4) / (1<<dwCkDiv);
if ( dwClDiv > 255 )
{
dwCkDiv++;
dwClDiv = 0;
}
}
TWI_INTERFACE->TWI_CWGR = 0;
TWI_INTERFACE->TWI_CWGR = (dwCkDiv << 16) | (dwClDiv << 8) | dwClDiv;
}
开发者ID:ShenRen,项目名称:Repetier-Firmware-ZN,代码行数:44,代码来源:HAL.cpp
示例13: twi_init
uint8_t twi_init(void){
/*TWI0:
- Clock: PA4 (Laranja)
- Data: PA3 (Cinza)
- Terra: GND (Preta)
- VCC: 3V3 (Branco)*/
gpio_configure_pin(TWI0_DATA_GPIO, TWI0_DATA_FLAGS);
gpio_configure_pin(TWI0_CLK_GPIO, TWI0_CLK_FLAGS);
twi_options_t opt_twi;
pmc_enable_periph_clk(ID_TWI0);
opt_twi.master_clk = sysclk_get_cpu_hz();
opt_twi.speed = TWI_SPEED;
opt_twi.smbus = 0;
uint8_t twi_status = twi_master_init(TWI0, &opt_twi);
return twi_status;
}
开发者ID:caiotoledo,项目名称:Cubli_2015,代码行数:21,代码来源:IMU.c
示例14: init_specific_board
/**
* \brief Initialize SAM3N_EK board for low power test.
*/
void init_specific_board(void)
{
/* Configure all PIOs as inputs to save power */
pio_set_input(PIOA, 0xFFFFFFFF, PIO_PULLUP);
pio_set_input(PIOB, 0xFFFFFFFF, PIO_PULLUP);
pio_set_input(PIOC, 0xFFFFFFFF, PIO_PULLUP);
/* Disable USB Clock */
pmc_disable_upll_clock();
/* Disable PIO pull-up for PA0 (VBUS_USB) */
pio_pull_up(PIOA, (0x1 << 0), 0);
/* Initialize ADC pin as ADC input mode to save power */
adc_enable_channel(ADC, ADC_CHANNEL_0);
adc12b_enable_channel(ADC12B, ADC_CHANNEL_3);
/* Enable the PMC clocks of push button for wakeup */
pmc_enable_periph_clk(ID_PIOA);
pio_handler_set_priority(PIOA, PIOA_IRQn, IRQ_PRIOR_PIO);
}
开发者ID:Realtime-7,项目名称:asf,代码行数:24,代码来源:low_power_board.c
示例15: configure_tc
/**
* \brief Configure Timer Counter 0 (TC0) to generate an interrupt every 200ms.
* This interrupt will be used to flush USART input and echo back.
*/
static void configure_tc(void)
{
uint32_t ul_div;
uint32_t ul_tcclks;
static uint32_t ul_sysclk;
/* Get system clock. */
ul_sysclk = sysclk_get_cpu_hz();
/* Configure PMC. */
pmc_enable_periph_clk(ID_TC0);
/* Configure TC for a 50Hz frequency and trigger on RC compare. */
tc_find_mck_divisor(TC_FREQ, ul_sysclk, &ul_div, &ul_tcclks, ul_sysclk);
tc_init(TC0, 0, ul_tcclks | TC_CMR_CPCTRG);
tc_write_rc(TC0, 0, (ul_sysclk / ul_div) / TC_FREQ);
/* Configure and enable interrupt on RC compare. */
NVIC_EnableIRQ((IRQn_Type)ID_TC0);
tc_enable_interrupt(TC0, 0, TC_IER_CPCS);
}
开发者ID:AndreyMostovov,项目名称:asf,代码行数:25,代码来源:unit_tests.c
示例16: adc_setup
/*
* Initializing A/D conversion.
*/
void adc_setup(void)
{
/* Enable the specified peripheral clock (ADC clock).
If function returns 0, then we can proceed... */
pmc_enable_periph_clk(ID_ADC);
/* init A/D conversion */
adc_init(ADC, sysclk_get_main_hz(), ADC_CLOCK, 8);
/* configure timing for A/D conversion */
adc_configure_timing(ADC, 0, ADC_SETTLING_TIME_3, 1);
/* set 12 bit resolution */
adc_set_resolution(ADC, ADC_MR_LOWRES_BITS_12);
/* enable ADC channel - specified in 'adc.h' */
/*adc_enable_channel(ADC, ADC_CHANNEL_LCDButtons);
adc_enable_channel(ADC, ADC_CHANNEL_Tank1);
adc_enable_channel(ADC, ADC_CHANNEL_Tank2);*/
ADC->ADC_CHER = 3200;
/* configure conversion to be triggered by software */
adc_configure_trigger(ADC, ADC_TRIG_SW, 0);
/* indicate everything's OK! */
}
开发者ID:Soddi,项目名称:examinationsprojekt,代码行数:24,代码来源:my_adc.c
示例17: i2c_rtc_init
//initialize the i2c bus
int i2c_rtc_init(void){
twi_options_t opt;
uint32_t r;
//enable peripherial mode on TWI lines
gpio_configure_pin(PIO_PA3_IDX,(PIO_PERIPH_A | PIO_DEFAULT));
gpio_configure_pin(PIO_PA4_IDX,(PIO_PERIPH_A | PIO_DEFAULT));
//enable TWI clock
pmc_enable_periph_clk(RTC_ID_TWI);
//setup up TWI options
opt.master_clk = sysclk_get_cpu_hz();
opt.speed = 400000; //400kHz
opt.smbus = 0x0;
opt.chip = 0x0;
if((r=twi_master_init(RTC_BASE_TWI, &opt)) != TWI_SUCCESS){
printf("error setting up I2C for RTC: %d\n",(int)r);
return -1;
}
return 0;
}
开发者ID:khulegu,项目名称:smartee,代码行数:22,代码来源:rtc.c
示例18: ext_sram_init
static void ext_sram_init(void)
{
pmc_enable_periph_clk(ID_SMC);
smc_set_setup_timing(SMC, 0, SMC_SETUP_NWE_SETUP(1)
| SMC_SETUP_NCS_WR_SETUP(1)
| SMC_SETUP_NRD_SETUP(1)
| SMC_SETUP_NCS_RD_SETUP(1));
smc_set_pulse_timing(SMC, 0, SMC_PULSE_NWE_PULSE(6)
| SMC_PULSE_NCS_WR_PULSE(6)
| SMC_PULSE_NRD_PULSE(6)
| SMC_PULSE_NCS_RD_PULSE(6));
smc_set_cycle_timing(SMC, 0, SMC_CYCLE_NWE_CYCLE(7)
| SMC_CYCLE_NRD_CYCLE(7));
smc_set_mode(SMC, 0,
SMC_MODE_READ_MODE | SMC_MODE_WRITE_MODE |
SMC_MODE_DBW_8_BIT);
/* Configure LB, enable SRAM access */
pio_configure_pin(PIN_EBI_NLB, PIN_EBI_NLB_FLAGS);
/* Pull down LB, enable sram access */
pio_set_pin_low(PIN_EBI_NLB);
}
开发者ID:Gr3yR0n1n,项目名称:SAINTCON-2015-Badge,代码行数:21,代码来源:memories_initialization_sam.c
示例19: customPWMinit
//Setup the hardware for the PWM with a specific frequency and period
bool customPWMinit(unsigned long freq, unsigned long per){
if(!isEnabled)
{
globFrequency = freq;
globPeriod = per;
//Turn on the PWM peripheral
pmc_enable_periph_clk(PWM_INTERFACE_ID);
//Configure the clocks
PWMC_ConfigureClocks(freq*per, 0, VARIANT_MCK); //VARIANT_MCK is the master clock frequency
isEnabled = true;
return 0;
}
else
{
//The hardware is already set, and you are trying to set it again
return 1;
}
}
开发者ID:TheOneCurly,项目名称:CameraStabilization,代码行数:22,代码来源:customPWM.cpp
示例20: platform_spi_init
platform_result_t platform_spi_init( const platform_spi_t* spi, const platform_spi_config_t* config )
{
UNUSED_PARAMETER(spi);
UNUSED_PARAMETER(config);
platform_mcu_powersave_disable( );
Pdc* spi_pdc = spi_get_pdc_base( spi->peripheral );
/* Setup chip select pin */
platform_gpio_init( config->chip_select, OUTPUT_PUSH_PULL );
platform_gpio_output_high( config->chip_select );
/* Setup other pins */
platform_gpio_peripheral_pin_init( spi->mosi_pin, ( IOPORT_MODE_MUX_A | IOPORT_MODE_PULLUP ) );
platform_gpio_peripheral_pin_init( spi->miso_pin, ( IOPORT_MODE_MUX_A | IOPORT_MODE_PULLUP ) );
platform_gpio_peripheral_pin_init( spi->clk_pin, ( IOPORT_MODE_MUX_A | IOPORT_MODE_PULLUP ) );
/* Configure an SPI peripheral. */
pmc_enable_periph_clk( spi->peripheral_id );
spi_disable( spi->peripheral );
spi_reset( spi->peripheral );
spi_set_lastxfer( spi->peripheral );
spi_set_master_mode( spi->peripheral );
spi_disable_mode_fault_detect( spi->peripheral );
spi_set_peripheral_chip_select_value( spi->peripheral, 0 );
spi_set_clock_polarity( spi->peripheral, 0, ( ( config->mode && SPI_CLOCK_IDLE_HIGH ) ? (1) : (0) ) );
spi_set_clock_phase( spi->peripheral, 0, ( ( config->mode && SPI_CLOCK_RISING_EDGE ) ? (1) : (0) ) );
spi_set_bits_per_transfer( spi->peripheral, 0, SPI_CSR_BITS_8_BIT );
spi_set_baudrate_div( spi->peripheral, 0, (uint8_t)( CPU_CLOCK_HZ / config->speed ) );
spi_set_transfer_delay( spi->peripheral, 0, 0, 0 );
spi_enable( spi->peripheral );
pdc_disable_transfer( spi_pdc, PERIPH_PTCR_RXTDIS | PERIPH_PTCR_TXTDIS );
platform_mcu_powersave_enable( );
return PLATFORM_SUCCESS;
}
开发者ID:119,项目名称:bcm-wiced-sdk,代码行数:40,代码来源:platform_spi.c
注:本文中的pmc_enable_periph_clk函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论