2424
2525typedef struct
2626{
27- DACX DACx ;
27+ DACX DACx ;
2828 DAC_Module * DAC_Module ;
29- uint32_t periph_clk ;
30- void (* EnablePeriphClk )(uint32_t periph , FunctionalState cmd );
31- uint32_t DAC_clk_pres ;
29+ uint32_t periph_clk ;
30+ void (* EnablePeriphClk )(uint32_t periph , FunctionalState cmd );
31+ uint32_t DAC_clk_pres ;
3232
3333 GPIO_Module * GPIOx ;
34- uint16_t GPIO_Pin ;
35- uint32_t GPIO_RCC ;
34+ uint16_t GPIO_Pin ;
35+ uint32_t GPIO_RCC ;
3636
3737 DAC_InitType Init ;
3838} DAC_InitInfo_t ;
@@ -52,7 +52,7 @@ static struct n32_dac n32_dac_obj[sizeof(dac_config) / sizeof(dac_config[0])];
5252
5353struct n32_dac
5454{
55- DAC_InitInfo_t DAC_Info ;
55+ DAC_InitInfo_t DAC_Info ;
5656 struct rt_dac_device n32_dac_device ;
5757};
5858
@@ -92,7 +92,7 @@ static rt_uint8_t n32_dac_get_resolution(struct rt_dac_device *device)
9292
9393static rt_err_t n32_set_dac_value (struct rt_dac_device * device , rt_uint32_t channel , rt_uint32_t * value )
9494{
95- rt_uint16_t set_value ;
95+ rt_uint16_t set_value ;
9696 DAC_InitInfo_t * n32_dac_info ;
9797
9898 RT_ASSERT (device != RT_NULL );
@@ -116,17 +116,17 @@ static rt_err_t n32_set_dac_value(struct rt_dac_device *device, rt_uint32_t chan
116116}
117117
118118static const struct rt_dac_ops n32_dac_ops = {
119- .disabled = n32_dac_disabled ,
120- .enabled = n32_dac_enabled ,
121- .convert = n32_set_dac_value ,
119+ .disabled = n32_dac_disabled ,
120+ .enabled = n32_dac_enabled ,
121+ .convert = n32_set_dac_value ,
122122 .get_resolution = n32_dac_get_resolution ,
123123};
124124
125125static int n32_dac_init (void )
126126{
127- int result = RT_EOK ;
127+ int result = RT_EOK ;
128128 char name_buf [5 ] = { 'd' , 'a' , 'c' , '0' , 0 };
129- int i = 0 ;
129+ int i = 0 ;
130130
131131 for (i = 0 ; i < sizeof (dac_config ) / sizeof (dac_config [0 ]); i ++ )
132132 {
@@ -135,9 +135,13 @@ static int n32_dac_init(void)
135135 /* Set device name */
136136 name_buf [3 ] = '0' ;
137137 if (n32_dac_obj [i ].DAC_Info .DACx == DAC1 )
138+ {
138139 name_buf [3 ] = '1' ;
140+ }
139141 else if (n32_dac_obj [i ].DAC_Info .DACx == DAC2 )
142+ {
140143 name_buf [3 ] = '2' ;
144+ }
141145
142146 /* Enable DAC peripheral clock */
143147 n32_dac_obj [i ].DAC_Info .EnablePeriphClk (n32_dac_obj [i ].DAC_Info .periph_clk , ENABLE );
0 commit comments