2023-09-14 14:39:29 +03:00
|
|
|
|
/*
|
|
|
|
|
|
* init_perif.c
|
|
|
|
|
|
*
|
|
|
|
|
|
* Created on: 21 <EFBFBD><EFBFBD><EFBFBD>. 2023 <EFBFBD>.
|
|
|
|
|
|
* Author: seklyuts
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
2023-09-26 08:51:03 +03:00
|
|
|
|
#include "pwm_init.h"
|
2023-09-14 14:39:29 +03:00
|
|
|
|
#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"
|
2023-09-26 08:51:03 +03:00
|
|
|
|
#include "vector.h"
|
2023-09-14 14:39:29 +03:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void InitPerif(void)
|
|
|
|
|
|
{
|
|
|
|
|
|
InitSysCtrl();
|
|
|
|
|
|
|
|
|
|
|
|
PWMGpioInit();
|
|
|
|
|
|
PWMInitEnable();
|
|
|
|
|
|
|
|
|
|
|
|
SdfmGpioInit();
|
|
|
|
|
|
SdfmInitEnable();
|
|
|
|
|
|
|
2023-09-26 08:51:03 +03:00
|
|
|
|
SpiGpioInit();
|
2023-09-14 14:39:29 +03:00
|
|
|
|
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();
|
2023-09-20 17:43:56 +03:00
|
|
|
|
SdfmInit();
|
2023-09-26 08:51:03 +03:00
|
|
|
|
SpiInit();
|
2023-09-14 14:39:29 +03:00
|
|
|
|
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();
|
2023-10-12 17:00:15 +03:00
|
|
|
|
vectorInitCurrLoop();
|
2023-09-14 14:39:29 +03:00
|
|
|
|
|
|
|
|
|
|
}
|