/***********************************************************************************************************************
* DISCLAIMER
* This software is supplied by Renesas Electronics Corporation and is only
* intended for use with Renesas products. No other uses are authorized. This
* software is owned by Renesas Electronics Corporation and is protected under
* all applicable laws, including copyright laws.
* THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
* THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT
* LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
* AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.
* TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS
* ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE
* FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR
* ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE
* BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
* Renesas reserves the right, without notice, to make changes to this software
* and to discontinue the availability of this software. By using this software,
* you agree to the additional terms and conditions found by accessing the
* following link:
* http://www.renesas.com/disclaimer
*
* Copyright (C) 2011, 2013 Renesas Electronics Corporation. All rights reserved.
***********************************************************************************************************************/
/***********************************************************************************************************************
* File Name : r_cg_serial.c
* Version : CodeGenerator for RL78/G13 V2.00.00.07 [22 Feb 2013]
* Device(s) : R5F100LE
* Tool-Chain : CA78K0R
* Description : This file implements device driver for Serial module.
* Creation Date: 2015/8/3
***********************************************************************************************************************/
/***********************************************************************************************************************
Pragma directive
***********************************************************************************************************************/
/* Start user code for pragma. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
Includes
***********************************************************************************************************************/
#include "r_cg_macrodriver.h"
#include "r_cg_serial.h"
/* Start user code for include. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
#include "r_cg_userdefine.h"
/***********************************************************************************************************************
Global variables and functions
***********************************************************************************************************************/
volatile uint8_t * gp_csi00_rx_address; /* csi00 receive buffer address */
volatile uint16_t g_csi00_rx_length; /* csi00 receive data length */
volatile uint16_t g_csi00_rx_count; /* csi00 receive data count */
volatile uint8_t * gp_csi00_tx_address; /* csi00 send buffer address */
volatile uint16_t g_csi00_send_length; /* csi00 send data length */
volatile uint16_t g_csi00_tx_count; /* csi00 send data count */
/* Start user code for global. Do not edit comment generated here */
/* End user code. Do not edit comment generated here */
/***********************************************************************************************************************
* Function Name: R_SAU0_Create
* Description : This function initializes the SAU0 module.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_SAU0_Create(void)
{
SAU0EN = 1U; /* supply SAU0 clock */
NOP();
NOP();
NOP();
NOP();
SPS0 = _0000_SAU_CK00_FCLK_0 | _0000_SAU_CK01_FCLK_0;
R_CSI00_Create();
}
/***********************************************************************************************************************
* Function Name: R_CSI00_Create
* Description : This function initializes the CSI00 module.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_CSI00_Create(void)
{
ST0 |= _0001_SAU_CH0_STOP_TRG_ON; /* disable CSI00 */
CSIMK00 = 1U; /* disable INTCSI00 interrupt */
CSIIF00 = 0U; /* clear INTCSI00 interrupt flag */
/* Set INTCSI00 level1 priority */
CSIPR100 = 0U;
CSIPR000 = 1U;
SIR00 = _0004_SAU_SIRMN_FECTMN | _0002_SAU_SIRMN_PECTMN | _0001_SAU_SIRMN_OVCTMN; /* clear error flag */
SMR00 = _0020_SAU_SMRMN_INITIALVALUE | _0000_SAU_CLOCK_SELECT_CK00 | _0000_SAU_CLOCK_MODE_CKS |
_0000_SAU_TRIGGER_SOFTWARE | _0000_SAU_MODE_CSI | _0000_SAU_TRANSFER_END;
SCR00 = _C000_SAU_RECEPTION_TRANSMISSION | _3000_SAU_TIMING_4 | _0000_SAU_MSB | _0007_SAU_LENGTH_8;
SDR00 = _4E00_CSI00_DIVISOR;
SO0 &= ~_0100_SAU_CH0_CLOCK_OUTPUT_1; /* CSI00 clock initial level */
SO0 &= ~_0001_SAU_CH0_DATA_OUTPUT_1; /* CSI00 SO initial level */
SOE0 |= _0001_SAU_CH0_OUTPUT_ENABLE; /* enable CSI00 output */
/* Set SI00 pin */
PM1 |= 0x02U;
/* Set SO00 pin */
P1 |= 0x04U;
PM1 &= 0xFBU;
/* Set SCK00 pin */
P1 |= 0x01U;
PM1 &= 0xFEU;
}
/***********************************************************************************************************************
* Function Name: R_CSI00_Start
* Description : This function starts the CSI00 module operation.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_CSI00_Start(void)
{
CSIIF00 = 0U; /* clear INTCSI00 interrupt flag */
CSIMK00 = 0U; /* enable INTCSI00 */
SO0 &= ~_0100_SAU_CH0_CLOCK_OUTPUT_1; /* CSI00 clock initial level */
SO0 &= ~_0001_SAU_CH0_DATA_OUTPUT_1; /* CSI00 SO initial level */
SOE0 |= _0001_SAU_CH0_OUTPUT_ENABLE; /* enable CSI00 output */
SS0 |= _0001_SAU_CH0_START_TRG_ON; /* enable CSI00 */
}
/***********************************************************************************************************************
* Function Name: R_CSI00_Stop
* Description : This function stops the CSI00 module operation.
* Arguments : None
* Return Value : None
***********************************************************************************************************************/
void R_CSI00_Stop(void)
{
ST0 |= _0001_SAU_CH0_STOP_TRG_ON; /* disable CSI00 */
SOE0 &= ~_0001_SAU_CH0_OUTPUT_ENABLE; /* disable CSI00 output */
CSIMK00 = 1U; /* disable INTCSI00 interrupt */
CSIIF00 = 0U; /* clear INTCSI00 interrupt flag */
}
/***********************************************************************************************************************
* Function Name: R_CSI00_Send_Receive
* Description : This function sends and receives CSI00 data.
* Arguments : tx_buf -
* transfer buffer pointer
* tx_num -
* buffer size
* rx_buf -
* receive buffer pointer
* Return Value : status -
* MD_OK or MD_ARGERROR
**********************************************************
RL78G13spi-.zip_proteus模拟瑞萨_瑞萨 模拟SPI_瑞萨 摄像
版权申诉
176 浏览量
2022-07-13
20:35:34
上传
评论
收藏 176KB ZIP 举报
JaniceLu
- 粉丝: 78
- 资源: 1万+
最新资源
- Q1.py
- 企业政府灵智电子政务网站系统-lingzhi.rar
- Thinkphp内核开发Lsky Pro兰空图床网站源码.rar
- 基于FPGA(XC6SLX9)+SDRAM+AD7829多通道数据采集板硬件(原理图+PCB)工程文件.zip
- 阿里巴巴精准测试体系:基于代码链路分析的性能优化方案
- mmexport1714217773503.jpg
- 【图片网盘外链系统5.0】全新前端UI界面设计 支持图片违规检测网站自适应H5源码.rar
- jsp+sql的BBS论坛系统.zip
- 网盘外链PHP开发彩虹网盘外链程序源码.rar
- 2023年最新文件快递柜系统网站源码 保护用户隐私的匿名口令分享和临时文件分享功能.rar
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
评论0