Mouse code for the MacroRat

Dependencies:   ITG3200 QEI

Committer:
sahilmgandhi
Date:
Sun May 14 23:18:57 2017 +0000
Revision:
18:6a4db94011d3
Publishing again

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sahilmgandhi 18:6a4db94011d3 1 /**************************************************************************//**
sahilmgandhi 18:6a4db94011d3 2 * @file wdt.c
sahilmgandhi 18:6a4db94011d3 3 * @version V3.00
sahilmgandhi 18:6a4db94011d3 4 * $Revision: 5 $
sahilmgandhi 18:6a4db94011d3 5 * $Date: 15/08/11 10:26a $
sahilmgandhi 18:6a4db94011d3 6 * @brief M451 series WDT driver source file
sahilmgandhi 18:6a4db94011d3 7 *
sahilmgandhi 18:6a4db94011d3 8 * @note
sahilmgandhi 18:6a4db94011d3 9 * Copyright (C) 2013~2015 Nuvoton Technology Corp. All rights reserved.
sahilmgandhi 18:6a4db94011d3 10 *****************************************************************************/
sahilmgandhi 18:6a4db94011d3 11 #include "M451Series.h"
sahilmgandhi 18:6a4db94011d3 12
sahilmgandhi 18:6a4db94011d3 13
sahilmgandhi 18:6a4db94011d3 14 /** @addtogroup Standard_Driver Standard Driver
sahilmgandhi 18:6a4db94011d3 15 @{
sahilmgandhi 18:6a4db94011d3 16 */
sahilmgandhi 18:6a4db94011d3 17
sahilmgandhi 18:6a4db94011d3 18 /** @addtogroup WDT_Driver WDT Driver
sahilmgandhi 18:6a4db94011d3 19 @{
sahilmgandhi 18:6a4db94011d3 20 */
sahilmgandhi 18:6a4db94011d3 21
sahilmgandhi 18:6a4db94011d3 22 /** @addtogroup WDT_EXPORTED_FUNCTIONS WDT Exported Functions
sahilmgandhi 18:6a4db94011d3 23 @{
sahilmgandhi 18:6a4db94011d3 24 */
sahilmgandhi 18:6a4db94011d3 25
sahilmgandhi 18:6a4db94011d3 26 /**
sahilmgandhi 18:6a4db94011d3 27 * @brief Initialize WDT and start counting
sahilmgandhi 18:6a4db94011d3 28 *
sahilmgandhi 18:6a4db94011d3 29 * @param[in] u32TimeoutInterval Time-out interval period of WDT module. Valid values are:
sahilmgandhi 18:6a4db94011d3 30 * - \ref WDT_TIMEOUT_2POW4
sahilmgandhi 18:6a4db94011d3 31 * - \ref WDT_TIMEOUT_2POW6
sahilmgandhi 18:6a4db94011d3 32 * - \ref WDT_TIMEOUT_2POW8
sahilmgandhi 18:6a4db94011d3 33 * - \ref WDT_TIMEOUT_2POW10
sahilmgandhi 18:6a4db94011d3 34 * - \ref WDT_TIMEOUT_2POW12
sahilmgandhi 18:6a4db94011d3 35 * - \ref WDT_TIMEOUT_2POW14
sahilmgandhi 18:6a4db94011d3 36 * - \ref WDT_TIMEOUT_2POW16
sahilmgandhi 18:6a4db94011d3 37 * - \ref WDT_TIMEOUT_2POW18
sahilmgandhi 18:6a4db94011d3 38 * @param[in] u32ResetDelay Configure WDT time-out reset delay period. Valid values are:
sahilmgandhi 18:6a4db94011d3 39 * - \ref WDT_RESET_DELAY_1026CLK
sahilmgandhi 18:6a4db94011d3 40 * - \ref WDT_RESET_DELAY_130CLK
sahilmgandhi 18:6a4db94011d3 41 * - \ref WDT_RESET_DELAY_18CLK
sahilmgandhi 18:6a4db94011d3 42 * - \ref WDT_RESET_DELAY_3CLK
sahilmgandhi 18:6a4db94011d3 43 * @param[in] u32EnableReset Enable WDT time-out reset system function. Valid values are TRUE and FALSE.
sahilmgandhi 18:6a4db94011d3 44 * @param[in] u32EnableWakeup Enable WDT time-out wake-up system function. Valid values are TRUE and FALSE.
sahilmgandhi 18:6a4db94011d3 45 *
sahilmgandhi 18:6a4db94011d3 46 * @return None
sahilmgandhi 18:6a4db94011d3 47 *
sahilmgandhi 18:6a4db94011d3 48 * @details This function makes WDT module start counting with different time-out interval, reset delay period and choose to \n
sahilmgandhi 18:6a4db94011d3 49 * enable or disable WDT time-out reset system or wake-up system.
sahilmgandhi 18:6a4db94011d3 50 * @note Please make sure that Register Write-Protection Function has been disabled before using this function.
sahilmgandhi 18:6a4db94011d3 51 */
sahilmgandhi 18:6a4db94011d3 52 void WDT_Open(uint32_t u32TimeoutInterval,
sahilmgandhi 18:6a4db94011d3 53 uint32_t u32ResetDelay,
sahilmgandhi 18:6a4db94011d3 54 uint32_t u32EnableReset,
sahilmgandhi 18:6a4db94011d3 55 uint32_t u32EnableWakeup)
sahilmgandhi 18:6a4db94011d3 56 {
sahilmgandhi 18:6a4db94011d3 57 WDT->ALTCTL = u32ResetDelay;
sahilmgandhi 18:6a4db94011d3 58
sahilmgandhi 18:6a4db94011d3 59 WDT->CTL = u32TimeoutInterval | WDT_CTL_WDTEN_Msk |
sahilmgandhi 18:6a4db94011d3 60 (u32EnableReset << WDT_CTL_RSTEN_Pos) |
sahilmgandhi 18:6a4db94011d3 61 (u32EnableWakeup << WDT_CTL_WKEN_Pos);
sahilmgandhi 18:6a4db94011d3 62 return;
sahilmgandhi 18:6a4db94011d3 63 }
sahilmgandhi 18:6a4db94011d3 64
sahilmgandhi 18:6a4db94011d3 65 /*@}*/ /* end of group WDT_EXPORTED_FUNCTIONS */
sahilmgandhi 18:6a4db94011d3 66
sahilmgandhi 18:6a4db94011d3 67 /*@}*/ /* end of group WDT_Driver */
sahilmgandhi 18:6a4db94011d3 68
sahilmgandhi 18:6a4db94011d3 69 /*@}*/ /* end of group Standard_Driver */
sahilmgandhi 18:6a4db94011d3 70
sahilmgandhi 18:6a4db94011d3 71 /*** (C) COPYRIGHT 2013~2015 Nuvoton Technology Corp. ***/