Mouse code for the MacroRat
mbed-dev/targets/TARGET_NUVOTON/TARGET_M451/device/StdDriver/m451_wwdt.c@46:b156ef445742, 2017-06-03 (annotated)
- Committer:
- sahilmgandhi
- Date:
- Sat Jun 03 00:22:44 2017 +0000
- Revision:
- 46:b156ef445742
- Parent:
- 18:6a4db94011d3
Final code for internal battlebot competition.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
sahilmgandhi | 18:6a4db94011d3 | 1 | /**************************************************************************//** |
sahilmgandhi | 18:6a4db94011d3 | 2 | * @file wwdt.c |
sahilmgandhi | 18:6a4db94011d3 | 3 | * @version V3.00 |
sahilmgandhi | 18:6a4db94011d3 | 4 | * $Revision: 4 $ |
sahilmgandhi | 18:6a4db94011d3 | 5 | * $Date: 15/08/11 10:26a $ |
sahilmgandhi | 18:6a4db94011d3 | 6 | * @brief M451 series WWDT 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 WWDT_Driver WWDT Driver |
sahilmgandhi | 18:6a4db94011d3 | 19 | @{ |
sahilmgandhi | 18:6a4db94011d3 | 20 | */ |
sahilmgandhi | 18:6a4db94011d3 | 21 | |
sahilmgandhi | 18:6a4db94011d3 | 22 | /** @addtogroup WWDT_EXPORTED_FUNCTIONS WWDT Exported Functions |
sahilmgandhi | 18:6a4db94011d3 | 23 | @{ |
sahilmgandhi | 18:6a4db94011d3 | 24 | */ |
sahilmgandhi | 18:6a4db94011d3 | 25 | |
sahilmgandhi | 18:6a4db94011d3 | 26 | /** |
sahilmgandhi | 18:6a4db94011d3 | 27 | * @brief Open WWDT and start counting |
sahilmgandhi | 18:6a4db94011d3 | 28 | * |
sahilmgandhi | 18:6a4db94011d3 | 29 | * @param[in] u32PreScale Pre-scale setting of WWDT counter. Valid values are: |
sahilmgandhi | 18:6a4db94011d3 | 30 | * - \ref WWDT_PRESCALER_1 |
sahilmgandhi | 18:6a4db94011d3 | 31 | * - \ref WWDT_PRESCALER_2 |
sahilmgandhi | 18:6a4db94011d3 | 32 | * - \ref WWDT_PRESCALER_4 |
sahilmgandhi | 18:6a4db94011d3 | 33 | * - \ref WWDT_PRESCALER_8 |
sahilmgandhi | 18:6a4db94011d3 | 34 | * - \ref WWDT_PRESCALER_16 |
sahilmgandhi | 18:6a4db94011d3 | 35 | * - \ref WWDT_PRESCALER_32 |
sahilmgandhi | 18:6a4db94011d3 | 36 | * - \ref WWDT_PRESCALER_64 |
sahilmgandhi | 18:6a4db94011d3 | 37 | * - \ref WWDT_PRESCALER_128 |
sahilmgandhi | 18:6a4db94011d3 | 38 | * - \ref WWDT_PRESCALER_192 |
sahilmgandhi | 18:6a4db94011d3 | 39 | * - \ref WWDT_PRESCALER_256 |
sahilmgandhi | 18:6a4db94011d3 | 40 | * - \ref WWDT_PRESCALER_384 |
sahilmgandhi | 18:6a4db94011d3 | 41 | * - \ref WWDT_PRESCALER_512 |
sahilmgandhi | 18:6a4db94011d3 | 42 | * - \ref WWDT_PRESCALER_768 |
sahilmgandhi | 18:6a4db94011d3 | 43 | * - \ref WWDT_PRESCALER_1024 |
sahilmgandhi | 18:6a4db94011d3 | 44 | * - \ref WWDT_PRESCALER_1536 |
sahilmgandhi | 18:6a4db94011d3 | 45 | * - \ref WWDT_PRESCALER_2048 |
sahilmgandhi | 18:6a4db94011d3 | 46 | * @param[in] u32CmpValue Setting the window compared value. Valid values are between 0x0 to 0x3F. |
sahilmgandhi | 18:6a4db94011d3 | 47 | * @param[in] u32EnableInt Enable WWDT time-out interrupt function. Valid values are TRUE and FALSE. |
sahilmgandhi | 18:6a4db94011d3 | 48 | * |
sahilmgandhi | 18:6a4db94011d3 | 49 | * @return None |
sahilmgandhi | 18:6a4db94011d3 | 50 | * |
sahilmgandhi | 18:6a4db94011d3 | 51 | * @details This function makes WWDT module start counting with different counter period by pre-scale setting and compared window value. |
sahilmgandhi | 18:6a4db94011d3 | 52 | * @note This WWDT_CTL register can be write only one time after chip is powered on or reset. |
sahilmgandhi | 18:6a4db94011d3 | 53 | */ |
sahilmgandhi | 18:6a4db94011d3 | 54 | void WWDT_Open(uint32_t u32PreScale, |
sahilmgandhi | 18:6a4db94011d3 | 55 | uint32_t u32CmpValue, |
sahilmgandhi | 18:6a4db94011d3 | 56 | uint32_t u32EnableInt) |
sahilmgandhi | 18:6a4db94011d3 | 57 | { |
sahilmgandhi | 18:6a4db94011d3 | 58 | WWDT->CTL = u32PreScale | |
sahilmgandhi | 18:6a4db94011d3 | 59 | (u32CmpValue << WWDT_CTL_CMPDAT_Pos) | |
sahilmgandhi | 18:6a4db94011d3 | 60 | ((u32EnableInt == TRUE) ? WWDT_CTL_INTEN_Msk : 0) | |
sahilmgandhi | 18:6a4db94011d3 | 61 | WWDT_CTL_WWDTEN_Msk; |
sahilmgandhi | 18:6a4db94011d3 | 62 | return; |
sahilmgandhi | 18:6a4db94011d3 | 63 | } |
sahilmgandhi | 18:6a4db94011d3 | 64 | |
sahilmgandhi | 18:6a4db94011d3 | 65 | /*@}*/ /* end of group WWDT_EXPORTED_FUNCTIONS */ |
sahilmgandhi | 18:6a4db94011d3 | 66 | |
sahilmgandhi | 18:6a4db94011d3 | 67 | /*@}*/ /* end of group WWDT_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. ***/ |