📄 initialisation.c
字号:
#include "Core A.h"
//--------------------------------------------------------------------------//
// Function: Init_Interrupts //
// //
// Parameters: None //
// //
// Return: None //
// //
// Description: This function initialises all interrupts. //
//--------------------------------------------------------------------------//
void Init_Interrupts(void)
{
// assign core IDs to interrupts
*pSICA_IAR0 = 0xfff1ffff;
*pSICA_IAR1 = 0xffffffff;
*pSICA_IAR2 = 0xffffffff;
*pSICA_IAR3 = 0xffffffff;
*pSICA_IAR4 = 0xffff3fff; // Timers -> ID3
*pSICA_IAR5 = 0xffffffff;
*pSICA_IAR6 = 0xffffffff;
*pSICA_IAR7 = 0xffffffff;
// assign ISRs to interrupt vectors
register_handler(ik_ivg10, Timers_ISR); // Timers ISR -> IVG10
// enable interrupts
*pSICA_IMASK0 = 0x00001000;
*pSICA_IMASK1 = 0x00000008;
}
//--------------------------------------------------------------------------//
// Function: I2C_SM_Clock_Init //
//--------------------------------------------------------------------------//
void I2C_SM_Clock_Init(void)
{
// configure Timer0
*pTIMER0_PERIOD = I2C_CLOCK_PERIOD;
*pTIMER0_WIDTH = I2C_CLOCK_WIDTH;
*pTIMER0_CONFIG = OUT_DIS | IRQ_ENA | PERIOD_CNT | PWM_OUT;
}
//--------------------------------------------------------------------------//
// Function: I2C_SM_Clock_Enable //
// //
// Parameters: None //
// //
// Return: None //
// //
// Description: This function is used to enable the timer that provides the //
// the clock for the I2C state machine. //
//--------------------------------------------------------------------------//
void I2C_SM_Clock_Enable(void)
{
*pTMRS8_ENABLE = I2C_CLOCK_TIMER;
}
//--------------------------------------------------------------------------//
// Function: I2C_SM_Clock_Disable //
// //
// Parameters: None //
// //
// Return: None //
// //
// Description: This function is used to disable the timer that provides //
// the clock for the I2C state machine. //
//--------------------------------------------------------------------------//
void I2C_SM_Clock_Disable(void)
{
*pTMRS8_DISABLE = I2C_CLOCK_TIMER;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -