New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
imxrt: ADC driver #1868
imxrt: ADC driver #1868
Conversation
18482f3
to
51c370e
Compare
Thank you for the PR! There are some coding style issues causing this to fail CI. Have a look at
To fix them. I will review this is the AM when I am fresh. |
I did some modifications in existing headers and was hoping it could be acceptable. I'm not sure I'm up for the task at reorganizing those headers, if there isn't a tool that does the bulk job. |
Based on LPC17xx_40xx and STM32 drivers.
51c370e
to
132f78c
Compare
Hi Thomas, |
Hi @acassis , Please see my earlier reply to David: davids5: There are some coding style issues causing this to fail CI. I did minor modifications in those files and my hope was that I would not have to fix the whole of them. Otherwise, is there any recommended tool or at least recommended layout? |
Thomas, there is not a tool to do the job for you, but I use nxstyle to spot the issues: |
Hi @thomasactia |
All right, I took a stab at the style problems. nxstyle produces no more errors. |
@thomasactia - Thank you for fixing the the CS violations. On the topic of: ADSTS in ADC_CFG differs in IMXRT1060/1050 to the 1020 The RT got a case of #ifdef rash when the 1020 came in. We have a very clean chip version separation on the STM32F7 and it should be used as template for how to keep the code clean. We will have to clean this up, before the RT turns into a fix-it-break-it party. It is early enough to catch it now before it gets out of hand as the STM32 did over the years. Duplication is preferred some times, also using logical #if defing based on the IP features as apposed to chips. Kinetis uses this approach. In the former case there would be a hardware/rt1020_adc.h hardware/rt1050-01060_adc.h selected in the rt_adc.h file. There may even be a common c file that includes the chip specific code. In the latter case. The code get's #if defined(RT_HAS_ADSTS), then the hardware file just lites define that for the the specific chip. The header file looks like: and the versioning comes from It is explained here It takes a lot of work, but it makes for really clean code. The best part is that every time a chip gets added all the files do not change. |
Based on LPC17xx_40xx and STM32 drivers.
Summary
ADC driver for the i.MX RT family.
Impact
Option to enable ADC driver for IMX RT chips. Default configured for the IMXRT1060 EVK.
ADC configuration is not tuned, but we have tested that it works.
Testing
Tested multiple channels on both ADCs with IMXRT1060 on custom board.
NOTE
ADSTS in ADC_CFG differs in IMXRT1060/1050 compared to 1020.
This PR changes the define names to correspond to the 1060/1050 names.
This needs to be split / done in a better way.