comparison include/matrix_gpio_mapping.h @ 16:670be80463a3 matrix_gpio

- analog matrixIn/matrixOut are now mapped as floats from 0 to 1 - use of an external PRU code can be enabled with -P <filename> - 16 channels of programmable GPIO can be accessed straight from render() either writing directly to the matrixGpio[] array or using digitalWrite(), digitalRead(), setDigitalDirection() macros from Utilities.h .
author Giulio Moro <giuliomoro@yahoo.it>
date Mon, 27 Apr 2015 13:01:57 +0100
parents
children 85e8b08a7471
comparison
equal deleted inserted replaced
15:901d205d1a3c 16:670be80463a3
1 #ifndef MATRIX_GPIO_MAPPING_H
2 #define MATRIX_GPIO_MAPPING_H
3
4 #define NUM_MATRIX_GPIOS 16
5 extern short int matrixGpioPins[NUM_MATRIX_GPIOS];
6 //GPIO_INPUT and GPIO_OUTPUT values when calling the setDigitalDirection() macro.
7 //TODO: these are inverted with respect to INPUT_PIN and OUTPUT_PIN defined in GPIOcontrol.h,
8 //which might lead to unexpected results in case someone uses those in place of these or viceversa
9 #define GPIO_INPUT 1
10 #define GPIO_OUTPUT 0
11
12 //mapping GPIO numbers to header pins
13 //if you want to use different pins/ordering, define here new pins. The ordering here is NOT binding
14 #define P8_07_GPIO_NO 66
15 #define P8_08_GPIO_NO 67
16 #define P8_09_GPIO_NO 69
17 #define P8_10_GPIO_NO 68
18 #define P8_11_GPIO_NO 45
19 #define P8_12_GPIO_NO 44
20 #define P9_12_GPIO_NO 60
21 #define P9_14_GPIO_NO 50
22 #define P8_15_GPIO_NO 47
23 #define P8_16_GPIO_NO 46
24 #define P9_16_GPIO_NO 51
25 #define P8_18_GPIO_NO 65
26 #define P8_27_GPIO_NO 86
27 #define P8_28_GPIO_NO 88
28 #define P8_29_GPIO_NO 87
29 #define P8_30_GPIO_NO 89
30
31 //mapping pin headers to bits in the matrixGpio word.
32 //used in the declaration of short int matrixGpioPins[NUM_MATRIX_GPIOS] below, which is used in PRU::prepareGPIO to export the pins
33 //if you want to use different pins, declare them above and use them here
34 //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
35 #define GPIO_NO_BIT_0 P8_07_GPIO_NO
36 #define GPIO_NO_BIT_1 P8_08_GPIO_NO
37 #define GPIO_NO_BIT_2 P8_09_GPIO_NO
38 #define GPIO_NO_BIT_3 P8_10_GPIO_NO
39 #define GPIO_NO_BIT_4 P8_11_GPIO_NO
40 #define GPIO_NO_BIT_5 P8_12_GPIO_NO
41 #define GPIO_NO_BIT_6 P9_12_GPIO_NO
42 #define GPIO_NO_BIT_7 P9_14_GPIO_NO
43 #define GPIO_NO_BIT_8 P8_15_GPIO_NO
44 #define GPIO_NO_BIT_9 P8_16_GPIO_NO
45 #define GPIO_NO_BIT_10 P9_16_GPIO_NO
46 #define GPIO_NO_BIT_11 P8_18_GPIO_NO
47 #define GPIO_NO_BIT_12 P8_27_GPIO_NO
48 #define GPIO_NO_BIT_13 P8_28_GPIO_NO
49 #define GPIO_NO_BIT_14 P8_29_GPIO_NO
50 #define GPIO_NO_BIT_15 P8_30_GPIO_NO
51
52 //mapping bits in the matrixGpio word to pin headers, so that pin header name can be used instead of but number
53 //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
54 #define P8_07 0
55 #define P8_08 1
56 #define P8_09 2
57 #define P8_10 3
58 #define P8_11 4
59 #define P8_12 5
60 #define P9_12 6
61 #define P9_14 7
62 #define P8_15 8
63 #define P8_16 9
64 #define P9_16 10
65 #define P8_18 11
66 #define P8_27 12
67 #define P8_28 13
68 #define P8_29 14
69 #define P8_30 15
70
71 #endif