MotorControlModuleSDFM_TMS3.../Projects/epwm_test/src/init_perif.c

84 lines
1.7 KiB
C
Raw Normal View History

/*
* init_perif.c
*
* Created on: 21 <EFBFBD><EFBFBD><EFBFBD>. 2023 <EFBFBD>.
* Author: seklyuts
*/
#include <pwm_init.h>
#include "f28x_project.h"
#include "pwm_interrupts.h"
#include "sdfm.h"
#include "f2838x_sdfm_drivers.h"
#include "gpio_init.h"
#include "spi_init.h"
#include "i2c_init.h"
#include "frm_uart.h"
#include "BL25CM1A.h"
#include "GD25Q16ETIGR.h"
#include "ZD24C02A.h"
void InitPerif(void)
{
InitSysCtrl();
PWMGpioInit();
PWMInitEnable();
SdfmGpioInit();
SdfmInitEnable();
SpiaBGpioInit();
I2CMasterGpioInit();
// Clear all interrupts and initialize PIE vector table:
// Disable CPU interrupts
DINT;
//
// Initialize the PIE control registers to their default state.
// The default state is all PIE interrupts disabled and flags
// are cleared.
// This function is found in the f2838x_piectrl.c file.
//
InitPieCtrl();
//
// Disable CPU interrupts and clear all CPU interrupt flags:
//
IER = 0x0000;
IFR = 0x0000;
//
// Initialize the PIE vector table with pointers to the shell Interrupt
// Service Routines (ISR).
// This will populate the entire table, even if the interrupt
// is not used in this example. This is useful for debug purposes.
// The shell ISR routines are found in f2838x_defaultisr.c.
// This function is found in f2838x_pievect.c.
//
InitPieVectTable();
//
GpioInit();
PWMInitInterruptEn();
PWMAllInit();
SdfmInitInterruptEn();
SdfmInit(SDFM1);
SpiBInit();
I2CMasterInit(I2C_OWN_ADDRESS,I2C_SLAVE_ADDRESS);
//
// Enable global Interrupts and higher priority real-time debug events:
//
EINT; // Enable Global interrupt INTM
ERTM; // Enable Global realtime interrupt DBGM
FRMUartInit();
GD25Q16ETIGR_en();
// Bl25cm1a_en();
}