⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mcu_spi_config.c

📁 用于WSN的PDA搜救器
💻 C
字号:
/**
 * Copyright (c) 2004, Freescale Semiconductor
 * Freescale Confidential Proprietary
 *
 * File name :  mcu_spi_config.c
 * Project name: SMAC (Simple Media Access Controller)
 *
 * Author : Larry Roshak
 * Department : Freescale Radio Products Division
 *
 * Description : This is the SMAC C source driver file for the 
 * The driver control interface to the SPI,
 *
 * History :
 * 17/04/2004 : Initial Development. (FLR005)
 * 07/01/2005 : Code Standarization. (A19259)
 */

#include "include.h"

/*
 * SPIInit: Initialize the SPI Control and Baud Rate Registers
 *
 * Parameters: None
 *
 * Return : None
 */
void SPIInit(void){
    SPI1C1 = 0x50;   /*  
                      *     0b01010000
                      *       ||||||||__ SPI serial data transfers start with MSB
                      *       |||||||___ SS1 used as GPIO
                      *       ||||||____ First edge occurs at the middle of cycle
                      *       |||||_____ Active-high SPI clock
                      *       ||||______ SPI Configured as Master
                      *       |||_______ SPI Transmit Interrupt Disabled
                      *       ||________ SPI System Enabled
                      *       |_________ SPI Interrupt Disabled
                      */
    SPI1C2 = 0x00;   /*  
                      *     0b00000000
                      *       ||||||||__ Separate pins for data input and output.
                      *       |||||||___ SPI clocks operate in wait mode.
                      *       ||||||____ Unimplemented
                      *       |||||_____ SPI data I/O pin acts as an input.
                      *       ||||______ Mode Fault Disabled
                      *       |||_______ Unimplemented
                      *       ||________ Unimplemented
                      *       |_________ Unimplemented
                      */
    SPI1BR = 0x00;   /*  
                      *     0b00000000
                      *       |||||||| 
                      *       ||||||||
                      *       ||||||++-- Rate Divisor = 2
                      *       |||||_____ Unimplemented
                      *       |||| 
                      *       |||| 
                      *       ||++------ Prescaler Divisor = 0 
                      *       |_________ Unimplemented
                      */
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -