@@ -74,70 +74,85 @@ typedef struct can_s can_t;
7474 * @param rd The CAN RD pin name 
7575 * @param td The CAN TD pin name 
7676 */ 
77- void            can_init (can_t  * obj , PinName  rd , PinName  td );
77+ void  can_init (can_t  * obj , PinName  rd , PinName  td );
7878
7979/** Initialize the CAN peripheral. It sets the default parameters for CAN 
8080 *  peripheral, and configures its specifieds pins. 
8181 * 
8282 * @param obj The CAN object 
8383 * @param pinmap pointer to structure which holds static pinmap 
8484 */ 
85- void            can_init_direct (can_t  * obj , const  can_pinmap_t  * pinmap );
85+ void  can_init_direct (can_t  * obj , const  can_pinmap_t  * pinmap );
8686
8787/** Initialize the CAN peripheral. It sets the default parameters for CAN 
8888 *  peripheral, and configures its specifieds pins. 
8989 * 
9090 * @param obj CAN object 
9191 * @param rd The CAN RD pin name 
9292 * @param td The CAN TD pin name 
93-  * @param hz The bus frequency 
93+  * @param hz The bus frequency in classical CAN mode, or nominal phase frequency in CAN FD mode 
94+  * @param data_hz The data phase frequency in CAN FD mode, the CAN object is put into Classical CAN mode if this parameter is zero 
9495 */ 
95- void           can_init_freq (can_t  * obj , PinName  rd , PinName  td , int  hz );
96+ void  can_init_freq (can_t  * obj , PinName  rd , PinName  td , int  hz 
97+ #ifdef  DEVICE_CAN_FD 
98+     , int  data_hz 
99+ #endif 
100+     );
96101
97102/** Initialize the CAN peripheral. It sets the default parameters for CAN 
98103 *  peripheral, and configures its specifieds pins. 
99104 * 
100105 * @param obj CAN object 
101106 * @param pinmap pointer to structure which holds static pinmap 
102-  * @param hz The bus frequency 
107+  * @param hz The bus frequency in classical CAN mode, or nominal phase frequency in CAN FD mode 
108+  * @param data_hz The data phase frequency in CAN FD mode, the CAN object is put into Classical CAN mode if this parameter is zero 
103109 */ 
104- void           can_init_freq_direct (can_t  * obj , const  can_pinmap_t  * pinmap , int  hz );
110+ void  can_init_freq_direct (can_t  * obj , const  can_pinmap_t  * pinmap , int  hz 
111+ #ifdef  DEVICE_CAN_FD 
112+     , int  data_hz 
113+ #endif 
114+     );
105115
106116/** Release the CAN peripheral, not currently invoked. It requires further 
107117 *  resource management. 
108118 * 
109119 * @param obj The CAN object 
110120 */ 
111- void            can_free (can_t  * obj );
121+ void  can_free (can_t  * obj );
112122
113123/** Configure the CAN bus frequency 
114124 * 
115125 * @param obj The CAN object 
116-  * @param hz The bus frequency 
126+  * @param hz The bus frequency in classical CAN mode, or nominal phase frequency in CAN FD mode 
127+  * @param data_hz The data phase frequency in CAN FD mode, the CAN object is put into Classical CAN mode if this parameter is zero 
117128 */ 
118- int            can_frequency (can_t  * obj , int  hz );
129+ int  can_frequency (can_t  * obj , int  hz 
130+ #ifdef  DEVICE_CAN_FD 
131+     , int  data_hz 
132+ #endif 
133+     );
119134
120135/** Initialize the CAN IRQ handler 
121136 * 
122137 * @param obj     The CAN object 
123138 * @param handler The handler to be attached to CAN IRQ 
124139 * @param context The context to be passed back to the handler (context != 0, 0 is reserved) 
125140 */ 
126- void            can_irq_init (can_t  * obj , can_irq_handler  handler , uintptr_t  context );
141+ void  can_irq_init (can_t  * obj , can_irq_handler  handler , uintptr_t  context );
127142
128- /** Release  the CAN object  
143+ /** Remove  the CAN IRQ handler  
129144 * 
130145 * @param obj The CAN object 
131146 */ 
132- void            can_irq_free (can_t  * obj );
147+ void  can_irq_free (can_t  * obj );
133148
134149/** Enable/disable the CAN IRQ event 
135150 * 
136151 * @param obj    The CAN object 
137152 * @param irq    The CAN IRQ event 
138153 * @param enable The enable flag 
139154 */ 
140- void            can_irq_set (can_t  * obj , CanIrqType  irq , uint32_t  enable );
155+ void  can_irq_set (can_t  * obj , CanIrqType  irq , uint32_t  enable );
141156
142157/** Write a CAN message to the bus. 
143158 * 
@@ -147,7 +162,7 @@ void          can_irq_set(can_t *obj, CanIrqType irq, uint32_t enable);
147162 * @return 0 if write failed, 
148163 *    1 if write was successful 
149164 */ 
150- int             can_write (can_t  * obj , CAN_Message  msg );
165+ int  can_write (can_t  * obj , CAN_Message  msg );
151166
152167/** Read a CAN message from the bus. 
153168 * 
@@ -158,7 +173,7 @@ int           can_write(can_t *obj, CAN_Message msg);
158173 * @return 0 if no message arrived, 
159174 *         1 if message arrived 
160175 */ 
161- int             can_read (can_t  * obj , CAN_Message  * msg , int  handle );
176+ int  can_read (can_t  * obj , CAN_Message  * msg , int  handle );
162177
163178/** Change CAN operation to the specified mode. 
164179 * 
@@ -168,7 +183,7 @@ int           can_read(can_t *obj, CAN_Message *msg, int handle);
168183 * @return 0 if mode change failed or unsupported, 
169184 *   1 if mode change was successful 
170185 */ 
171- int             can_mode (can_t  * obj , CanMode  mode );
186+ int  can_mode (can_t  * obj , CanMode  mode );
172187
173188/** Filter out incomming messages. 
174189 * 
@@ -181,15 +196,15 @@ int           can_mode(can_t *obj, CanMode mode);
181196 * @return 0 if filter change failed or unsupported, 
182197 *    new filter handle if successful 
183198 */ 
184- int             can_filter (can_t  * obj , uint32_t  id , uint32_t  mask , CANFormat  format , int32_t  handle );
199+ int  can_filter (can_t  * obj , uint32_t  id , uint32_t  mask , CANFormat  format , int32_t  handle );
185200
186201/** Reset CAN interface. 
187202 * 
188203 * @param obj    CAN object 
189204 * 
190205 * To use after error overflow. 
191206 */ 
192- void            can_reset (can_t  * obj );
207+ void  can_reset (can_t  * obj );
193208
194209/**  Detects read errors - Used to detect read overflow errors. 
195210 * 
@@ -210,38 +225,9 @@ unsigned char can_tderror(can_t *obj);
210225 * @param obj CAN object 
211226 * @param silent boolean indicating whether to go into silent mode or not. 
212227 */ 
213- void            can_monitor (can_t  * obj , int  silent );
228+ void  can_monitor (can_t  * obj , int  silent );
214229
215230#if  DEVICE_CAN_FD 
216- /** Initialize the CAN FD peripheral. It sets the default parameters for CAN FD 
217-  *  peripheral, and configures its specifieds pins. 
218-  * 
219-  * @param obj CAN object 
220-  * @param rd The CAN RD pin name 
221-  * @param td The CAN TD pin name 
222-  * @param hz The bus frequency of nominal phase 
223-  * @param data_hz The bus frequency of data phase, the CAN object is put into Classical CAN mode if this parameter is zero 
224-  */ 
225- void           canfd_init_freq (can_t  * obj , PinName  rd , PinName  td , int  hz , int  data_hz );
226- 
227- /** Initialize the CAN FD peripheral. It sets the default parameters for CAN FD 
228-  *  peripheral, and configures its specifieds pins. 
229-  * 
230-  * @param obj CAN object 
231-  * @param pinmap pointer to structure which holds static pinmap 
232-  * @param hz The bus frequency of nominal phase 
233-  * @param data_hz The bus frequency of data phase, the CAN object is put into Classical CAN mode if this parameter is zero 
234-  */ 
235- void           canfd_init_freq_direct (can_t  * obj , const  can_pinmap_t  * pinmap , int  hz , int  data_hz );
236- 
237- /** Configure the CAN FD bus frequency 
238-  * 
239-  * @param obj The CAN object 
240-  * @param hz The bus frequency of nominal phase 
241-  * @param data_hz The bus frequency of data phase, the CAN object is put into Classical CAN mode if this parameter is zero 
242-  */ 
243- int            canfd_frequency (can_t  * obj , int  hz , int  data_hz );
244- 
245231/** Write a CAN FD Message to the bus. 
246232 * 
247233 * @param obj    The CAN object 
@@ -250,7 +236,7 @@ int           canfd_frequency(can_t *obj, int hz, int data_hz);
250236 * @return 0 if write failed, 
251237 *    1 if write was successful 
252238 */ 
253- int             canfd_write (can_t  * obj , CANFD_Message  msg );
239+ int  canfd_write (can_t  * obj , CANFD_Message  msg );
254240
255241/** Read a Classical CAN or CAN FD Message from the bus. 
256242 * 
@@ -261,7 +247,7 @@ int           canfd_write(can_t *obj, CANFD_Message msg);
261247 * @return 0 if no message arrived, 
262248 *         1 if message arrived 
263249 */ 
264- int             canfd_read (can_t  * obj , CANFD_Message  * msg , int  handle );
250+ int  canfd_read (can_t  * obj , CANFD_Message  * msg , int  handle );
265251#endif 
266252
267253/** Get the pins that support CAN RD 
0 commit comments