diff --git a/README.md b/README.md index 38567a42c3044555341f4c167790cd7acef8fcdf..8d11d6053aa9ee7e658b417e5291b9f65461503e 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,35 @@ ## 1. ADC +# How to Use +1. Connect outermost pins of the potentiometer to 3V und GND on the board. +2. Connect middle pin of potentiometer to GPIO pin PC1, +3. Add ADC.c to your CMake target: ECOS_ADD_EXECUTABLE(app main.c src/ADC.c <other sources>) +4. Include ADC.h where you want to use the ADC. +5. Run adc_init() once before first usage. +6. Every call to adc_get(11) will now return an unsiged integer between 0 and 4096 telling you the current position of the potetiometer. + +# Possible edits +In total 16 of the GPIO pins are connected to the ADC. If PC1 is already in use in your design or you have two potentiometers, you can use different pins as ADC. For this, uncomment the respective line in the init function and call adc_get() with the respective channel ID. + +Connections are as follows: +- ADC Channel 0 <> GPIO PA0 +- ADC Channel 1 <> GPIO PA1 +- ADC Channel 2 <> GPIO PA2 +- ADC Channel 3 <> GPIO PA3 +- ADC Channel 4 <> GPIO PA4 +- ADC Channel 5 <> GPIO PA5 +- ADC Channel 6 <> GPIO PA6 +- ADC Channel 7 <> GPIO PA7 +- ADC Channel 8 <> GPIO PB0 +- ADC Channel 9 <> GPIO PB1 +- ADC Channel 10 <> GPIO PC0 +- ADC Channel 11 <> GPIO PC1 +- ADC Channel 12 <> GPIO PC2 +- ADC Channel 13 <> GPIO PC3 +- ADC Channel 14 <> GPIO PC4 +- ADC Channel 15 <> GPIO PC5 + ## 2. DCMotor ## 3. ExternButton