Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
capturet0_11u24.h
00001 /* mbed Library - CaptureT0_11U24 00002 * Copyright (c) 2014 00003 * released under MIT license http://mbed.org/licence/mit 00004 */ 00005 00006 /***********************************************************************//** 00007 * @file capturet1_11u24.h 00008 * @brief Header file for the CaptureT0_11U24 library. 00009 * @version 0.0 00010 * @date 5 Feb 2014 00011 * @author 00012 **************************************************************************/ 00013 /*************************************************************************** 00014 * Revision Date Comments 00015 *---------- -------- ----------------------------------------------- 00016 * 00017 * 0.0 2/5/14 Initial creation 00018 ***************************************************************************/ 00019 00020 #ifndef CAPTURET0_H 00021 #define CAPTURET0_H 00022 00023 /* Includes ------------------------------------------------------------------- */ 00024 #include "mbed.h" 00025 00026 00027 /* Public Types --------------------------------------------------------------- */ 00028 00029 00030 /* Public Functions ----------------------------------------------------------- */ 00031 /** @defgroup Capture_Public_Functions Capture Public Functions 00032 */ 00033 class Capture { 00034 public: 00035 00036 /** Create a Capture object and configure it 00037 * 00038 * @param none 00039 */ 00040 Capture(void); 00041 00042 /** Start capturing data. Accumulate the specified number of samples. 00043 * @param numsamples The number of samples to be accumulated 00044 * @return None 00045 */ 00046 void Start(int numsamples); 00047 00048 /** Check to see if a new count is ready. 00049 * 00050 * @return (int) Status value. Negative means overrun. 00051 */ 00052 int Ready(void); 00053 00054 /** Read (accumlated) sample count. 00055 * 00056 * @return (unsigned int) Accumulated capture value 00057 */ 00058 unsigned int Read(void); 00059 00060 00061 00062 /* Public Macros -------------------------------------------------------------- */ 00063 00064 00065 00066 00067 private: 00068 static void _Captureisr(void); 00069 void Captureisr(void); 00070 static Capture *instance; 00071 int flag; 00072 int channel; 00073 //int capturecount; 00074 unsigned int capturedata; 00075 int Nsamples; 00076 //int Nsamplebits; 00077 //int *flagaddresspointer; 00078 00079 00080 00081 /* Private Macros ------------------------------------------------------------- */ 00082 /* --------------------- BIT DEFINITIONS -------------------------------------- */ 00083 /* Timer Capture Register Definitions --------------------- */ 00084 00085 /*********************************************************************//** 00086 * Macro defines for CT32B0->IR Interrupt tegister 00087 **********************************************************************/ 00088 #define IR_CR1INT ((uint32_t)(1<<6)) /**< Interrupt flag for capture channel 1 */ 00089 00090 /*********************************************************************//** 00091 * Macro defines for IOCON->PIO1_29 register bits LPC11U24 00092 **********************************************************************/ 00093 #define PIN_PULL_UP 2UL 00094 #define PIN_REPEATER 3UL 00095 #define PIN_NORESISTOR 0UL 00096 #define PIN_PULL_DOWN 1UL 00097 00098 /* FUNC bits */ 00099 #define CT32B0_CAP1 2UL 00100 00101 /* MODE bits */ 00102 #define CAP_PULLUP ((uint32_t)(PIN_PULL_UP<<3)) // Pull up on the CT32B0_CAP1 input pin 00103 00104 /*********************************************************************//** 00105 * Macro defines for SYSCON->SYSAHBCLKDIV register bits LPC11U24 00106 **********************************************************************/ 00107 #define CT32B0_CLK_ENABLE ((uint32_t)(1<<9)) /**< CT32B0 clock enable */ 00108 00109 /*********************************************************************//** 00110 * Macro defines for CT32B0->TCR register bits LPC11U24 00111 **********************************************************************/ 00112 #define TCR_CEN 1UL 00113 00114 00115 /*********************************************************************//** 00116 * Macro defines for CT32B0->CCR register bits LPC11U24 00117 **********************************************************************/ 00118 #define CCR_CAP1RE ((uint32_t)(1<<6)) 00119 #define CCR_CAP1FE ((uint32_t)(1<<7)) 00120 #define CCR_CAP1I ((uint32_t)(1<<8)) 00121 00122 /*********************************************************************//** 00123 * Macro defines for CT32B0->CTCR register bits LPC11U24 00124 **********************************************************************/ 00125 #define CTCR_CTM_TIMER 0UL 00126 #define CTCR_ENCC ((uint32_t)(1<<4)) 00127 #define CTCR_SEICC_CAP1RE ((uint32_t)(4<<5)) 00128 00129 00130 00131 }; // End of Capture class information 00132 #endif /* CAPTURE_H */ 00133 /* --------------------------------- End Of File ------------------------------ */
Generated on Sun Jul 24 2022 05:34:28 by
1.7.2