annotate include/digital_gpio_mapping.h @ 39:638bc1ae2500 staging

Improved readibility of the DIGITAL code in the PRU, using register names instead of aliases and expanding some of the macros, removing unused macros. Binaries were not modified
author Giulio Moro <giuliomoro@yahoo.it>
date Wed, 13 May 2015 12:18:10 +0100
parents c98863e63174
children
rev   line source
giuliomoro@19 1 #ifndef DIGITAL_MAPPING_H
giuliomoro@19 2 #define DIGITAL_MAPPING_H
giuliomoro@19 3
giuliomoro@19 4 #define NUM_DIGITALS 16
giuliomoro@19 5 extern short int digitalPins[NUM_DIGITALS];
giuliomoro@19 6 //GPIO_INPUT and GPIO_OUTPUT values when calling the setDigitalDirection() macro.
giuliomoro@19 7 //TODO: these are inverted with respect to INPUT_PIN and OUTPUT_PIN defined in GPIOcontrol.h,
giuliomoro@19 8 //which might lead to unexpected results in case someone uses those in place of these or viceversa
giuliomoro@19 9 #define GPIO_INPUT 1
giuliomoro@19 10 #define GPIO_OUTPUT 0
giuliomoro@19 11 #define GPIO_HIGH 1
giuliomoro@19 12 #define GPIO_LOW 0
giuliomoro@19 13 //mapping GPIO numbers to header pins
giuliomoro@19 14 //if you want to use different pins/ordering, define here new pins. The ordering here is NOT binding
giuliomoro@19 15 #define P8_07_GPIO_NO 66
giuliomoro@19 16 #define P8_08_GPIO_NO 67
giuliomoro@19 17 #define P8_09_GPIO_NO 69
giuliomoro@19 18 #define P8_10_GPIO_NO 68
giuliomoro@19 19 #define P8_11_GPIO_NO 45
giuliomoro@19 20 #define P8_12_GPIO_NO 44
giuliomoro@19 21 #define P9_12_GPIO_NO 60
giuliomoro@19 22 #define P9_14_GPIO_NO 50
giuliomoro@19 23 #define P8_15_GPIO_NO 47
giuliomoro@19 24 #define P8_16_GPIO_NO 46
giuliomoro@19 25 #define P9_16_GPIO_NO 51
giuliomoro@19 26 #define P8_18_GPIO_NO 65
giuliomoro@19 27 #define P8_27_GPIO_NO 86
giuliomoro@19 28 #define P8_28_GPIO_NO 88
giuliomoro@19 29 #define P8_29_GPIO_NO 87
giuliomoro@19 30 #define P8_30_GPIO_NO 89
giuliomoro@19 31
giuliomoro@19 32 //mapping pin headers to bits in the digital word.
giuliomoro@19 33 //used in the declaration of short int digitalPins[NUM_DIGITALS] below, which is used in PRU::prepareGPIO to export the pins
giuliomoro@19 34 //if you want to use different pins, declare them above and use them here
giuliomoro@19 35 //The ordering here is NOT binding, but if you want to use a different ordering, please change it here as well as below and in the PRU, for consistency
giuliomoro@19 36 #define GPIO_NO_BIT_0 P8_07_GPIO_NO
giuliomoro@19 37 #define GPIO_NO_BIT_1 P8_08_GPIO_NO
giuliomoro@19 38 #define GPIO_NO_BIT_2 P8_09_GPIO_NO
giuliomoro@19 39 #define GPIO_NO_BIT_3 P8_10_GPIO_NO
giuliomoro@19 40 #define GPIO_NO_BIT_4 P8_11_GPIO_NO
giuliomoro@19 41 #define GPIO_NO_BIT_5 P8_12_GPIO_NO
giuliomoro@19 42 #define GPIO_NO_BIT_6 P9_12_GPIO_NO
giuliomoro@19 43 #define GPIO_NO_BIT_7 P9_14_GPIO_NO
giuliomoro@19 44 #define GPIO_NO_BIT_8 P8_15_GPIO_NO
giuliomoro@19 45 #define GPIO_NO_BIT_9 P8_16_GPIO_NO
giuliomoro@19 46 #define GPIO_NO_BIT_10 P9_16_GPIO_NO
giuliomoro@19 47 #define GPIO_NO_BIT_11 P8_18_GPIO_NO
giuliomoro@19 48 #define GPIO_NO_BIT_12 P8_27_GPIO_NO
giuliomoro@19 49 #define GPIO_NO_BIT_13 P8_28_GPIO_NO
giuliomoro@19 50 #define GPIO_NO_BIT_14 P8_29_GPIO_NO
giuliomoro@19 51 #define GPIO_NO_BIT_15 P8_30_GPIO_NO
giuliomoro@19 52
giuliomoro@19 53 //mapping bits in the digital word to pin headers, so that pin header name can be used instead of but number
giuliomoro@19 54 //The ordering here IS binding. If you want to use different pins/ordering, please do it above as well as here and in the PRU, for consistency
giuliomoro@19 55 #define P8_07 0
giuliomoro@19 56 #define P8_08 1
giuliomoro@19 57 #define P8_09 2
giuliomoro@19 58 #define P8_10 3
giuliomoro@19 59 #define P8_11 4
giuliomoro@19 60 #define P8_12 5
giuliomoro@19 61 #define P9_12 6
giuliomoro@19 62 #define P9_14 7
giuliomoro@19 63 #define P8_15 8
giuliomoro@19 64 #define P8_16 9
giuliomoro@19 65 #define P9_16 10
giuliomoro@19 66 #define P8_18 11
giuliomoro@19 67 #define P8_27 12
giuliomoro@19 68 #define P8_28 13
giuliomoro@19 69 #define P8_29 14
giuliomoro@19 70 #define P8_30 15
giuliomoro@19 71
giuliomoro@19 72 #endif