kywwilson11 commented on code in PR #17007:
URL: https://github.com/apache/nuttx/pull/17007#discussion_r2353417060


##########
arch/arm/src/stm32h5/stm32_adc.h:
##########
@@ -498,8 +521,8 @@ extern "C"
 
 struct adc_dev_s;
 struct adc_dev_s *stm32h5_adc_initialize(int intf,
-                                         const uint8_t *chanlist,
-                                         int nchannels);
+                                         struct stm32_adc_channel_s *chanlist
+                                         , int nchannels);

Review Comment:
   I am going to try and drop the hostility. I made the choice about 
stm32_adc_channel_s for several reasons. I am going to list them here:
   
   1. I evaluated the other implementations in the stm32 family. I did not like 
any of them for the stm32h5. The stm32f7 could work technically, but honestly I 
think my implementation is better.  The below structures make little sense for 
the h5. all_same is unnecessary, each channel sample time is independent of the 
other. To me, this structure did not make a lot of sense for the h5, and the 
parts that did overly complicated things. 
   
   <pre>
   typedef struct adc_channel_s
   {
     uint8_t channel:5;
   
     /* Sampling time individually for each channel */
   
     uint8_t sample_time:3;
   } adc_channel_t;
   
   /* This structure will be used while setting channels to specified by the
    * "channel-sample time" pairs' values
    */
   
   struct adc_sample_time_s
   {
     adc_channel_t *channel;                /* Array of channels */
     uint8_t        channels_nbr:5;         /* Number of channels in array */
     bool           all_same:1;             /* All channels will get the
                                             * same value of the sample time */
     uint8_t        all_ch_sample_time:3;   /* Sample time for all channels */
   };
   </pre>
   
   2.  I also needed to find a way to allow for differential inputs. I did not 
see any STM32 drivers that actually implemented differential mode. Passing the 
mode in the structure, like the nrf52 does, seemed like a good way for the 
board level to indicate to the lower level driver that the channels needs to be 
configured in differential mode. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to