typedef enum statement confusion.
Hey all, thanks for the help. This should be fairly easy for someone who understands this syntax well. I am modifying some code for work, but ran into a little confusion with the statement below, cannot find what i need online. I understand typedef and enum alone, but the syntax here is throwing me off. Doesn't enum need a declaration of a variable name after it, before the list? And does typedef before enum cause each on to be an individual variable type? Either case does not make much sense. I just two statements of code with this syntax usage, but it appears much more so it is vital that I know what is going on. Thanks much.
Code:
typedef enum {
CLK_PRESCALER_HSIDIV1 = (u8)0x00, /*!< High speed internal clock prescaler: 1 */
CLK_PRESCALER_HSIDIV2 = (u8)0x08, /*!< High speed internal clock prescaler: 2 */
CLK_PRESCALER_HSIDIV4 = (u8)0x10, /*!< High speed internal clock prescaler: 4 */
CLK_PRESCALER_HSIDIV8 = (u8)0x18, /*!< High speed internal clock prescaler: 8 */
CLK_PRESCALER_CPUDIV1 = (u8)0x80, /*!< CPU clock division factors 1 */
CLK_PRESCALER_CPUDIV2 = (u8)0x81, /*!< CPU clock division factors 2 */
CLK_PRESCALER_CPUDIV4 = (u8)0x82, /*!< CPU clock division factors 4 */
CLK_PRESCALER_CPUDIV8 = (u8)0x83, /*!< CPU clock division factors 8 */
CLK_PRESCALER_CPUDIV16 = (u8)0x84, /*!< CPU clock division factors 16 */
CLK_PRESCALER_CPUDIV32 = (u8)0x85, /*!< CPU clock division factors 32 */
CLK_PRESCALER_CPUDIV64 = (u8)0x86, /*!< CPU clock division factors 64 */
CLK_PRESCALER_CPUDIV128 = (u8)0x87 /*!< CPU clock division factors 128 */
} CLK_Prescaler_TypeDef;
/**
* @brief SWIM Clock divider.
*/
typedef enum {
CLK_SWIMDIVIDER_2 = (u8)0x00, /*!< SWIM clock is divided by 2 */
CLK_SWIMDIVIDER_OTHER = (u8)0x01 /*!< SWIM clock is not divided by 2 */
}CLK_SWIMDivider_TypeDef;