Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*******************************************************************************
- ** Includes **
- *******************************************************************************/
- #include "tle_device.h"
- #include "types.h"
- #include "stdint.h"
- #include "gpio.h"
- #include "ssc.h"
- #include "gpt12.h"
- #include "dma.h"
- #include "scu.h"
- /*******************************************************************************
- ** SSC Defines **
- *******************************************************************************/
- #define SSC_Read_Word() ((uint16_t)SSC0_getRXvalue() & 0xFFFF)
- #define SSC_Send_Word(Word) (SSC0_setTXvalue((uint64_t)Word))
- #define SSC_Chip_Select_Down() (GPIO_setP12State(GPIO_STATE_LOW))
- #define SSC_Chip_Select_Up() (GPIO_setP12State(GPIO_STATE_HIGH))
- #define SSC_Clear_TIR() (SSC0->ISC.bit.TIRCLR = 1u)
- #define SSC_Clear_RIR() (SSC0->ISC.bit.RIRCLR = 1u)
- #define Enable_MTSR_Open_Drain() (GPIO->P0_OD.bit.OD1 = 1)
- #define Disable_MTSR_Open_Drain() (GPIO->P0_OD.bit.OD1 = 0)
- /*******************************************************************************
- ** DMA Defines **
- *******************************************************************************/
- #define DMA_Enable_Master() (DMA_enMaster())
- #define DMA_Disable_Master() (DMA->DMA_CFG.bit.MASTER_ENABLE = 0u)
- /*******************************************************************************
- ** Global Constant Declarations **
- *******************************************************************************/
- uint16_t DMA_TX_Buffer[4] = {0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF};
- uint16_t DMA_RX_Buffer[4] = {0x0000, 0x0000, 0x0000, 0x0000};
- /*******************************************************************************
- ** Global Type Declarations **
- *******************************************************************************/
- /*******************************************************************************
- ** Global Macro Declarations **
- *******************************************************************************/
- /*******************************************************************************
- ** Global Function Declarations **
- *******************************************************************************/
- void SendReadAngleCommand(void)
- {
- DMA_resetChannel(0, 3);
- DMA_resetChannel(1, 4);
- SSC_Chip_Select_Down();
- Disable_MTSR_Open_Drain();
- SSC_Send_Word(0x8022);
- SCU_delay_us(2);
- Enable_MTSR_Open_Drain();
- DMA_Enable_Master();
- SCU_delay_us(10);
- SSC_Chip_Select_Up();
- DMA_Disable_Master();
- SSC_Clear_TIR();
- SSC_Clear_RIR();
- }
- /*******************************************************************************
- ** Global Inline Function Definitions **
- *******************************************************************************/
- sint32 main(void)
- {
- sint8 s8_returnCode;
- /* Clear watchdog fail status */
- PMU_clrFailSafeWatchdogFailSts();
- /* Initialization of hardware modules based on Config Wizard configuration */
- s8_returnCode = TLE_init();
- if (s8_returnCode != ERR_LOG_SUCCESS)
- {
- /* Place your code here to handle an initialization error */
- }
- /*****************************************************************************
- ** Place your application code here **
- *****************************************************************************/
- // DMA_setBasicTransfer(0, (uint32)&DMA_TX_Buffer[0], (uint32)&SSC0->TB0.reg, 3, DMA_transferSize_16bit, 0);
- // DMA_setBasicTransfer(1, (uint32)&SSC0->RB0.reg, (uint32)&DMA_RX_Buffer[0], 4, DMA_transferSize_16bit, 1);
- GPT12_startT3();
- /*****************************************************************************
- ** Main endless loop **
- *****************************************************************************/
- for (;;)
- {
- /* Main watchdog service */
- (void)PMU_serviceFailSafeWatchdog();
- /***************************************************************************
- ** Place your application code here **
- ***************************************************************************/
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement