Mercurial > hg > beaglert
comparison include/PRU.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 | 901d205d1a3c |
children | c98863e63174 |
comparison
equal
deleted
inserted
replaced
15:901d205d1a3c | 16:670be80463a3 |
---|---|
25 | 25 |
26 // Destructor | 26 // Destructor |
27 ~PRU(); | 27 ~PRU(); |
28 | 28 |
29 // Prepare the GPIO pins needed for the PRU | 29 // Prepare the GPIO pins needed for the PRU |
30 int prepareGPIO(int use_spi, int include_test_pin, int include_led); | 30 int prepareGPIO(int use_spi, int use_matrix_gpio, int include_test_pin, int include_led); |
31 | 31 |
32 // Clean up the GPIO at the end | 32 // Clean up the GPIO at the end |
33 void cleanupGPIO(); | 33 void cleanupGPIO(); |
34 | 34 |
35 // Initialise and open the PRU | 35 // Initialise and open the PRU |
36 int initialise(int pru_num, int frames_per_buffer, int spi_channels, | 36 int initialise(int pru_num, int frames_per_buffer, int spi_channels, |
37 bool xenomai_test_pin = false); | 37 bool xenomai_test_pin = false); |
38 | 38 |
39 // Run the code image in pru_rtaudio_bin.h | 39 // Run the code image in pru_rtaudio_bin.h |
40 int start(); | 40 int start(char * const filename); |
41 | 41 |
42 // Loop: read and write data from the PRU | 42 // Loop: read and write data from the PRU |
43 void loop(); | 43 void loop(); |
44 | 44 |
45 // Wait for an interrupt from the PRU indicate it is finished | 45 // Wait for an interrupt from the PRU indicate it is finished |
54 | 54 |
55 private: | 55 private: |
56 int pru_number; // Which PRU we use | 56 int pru_number; // Which PRU we use |
57 bool running; // Whether the PRU is running | 57 bool running; // Whether the PRU is running |
58 bool spi_enabled; // Whether SPI ADC and DAC are used | 58 bool spi_enabled; // Whether SPI ADC and DAC are used |
59 bool matrix_gpio_enabled; // Whether Matrix GPIO is used | |
59 bool gpio_enabled; // Whether GPIO has been prepared | 60 bool gpio_enabled; // Whether GPIO has been prepared |
60 bool led_enabled; // Whether a user LED is enabled | 61 bool led_enabled; // Whether a user LED is enabled |
61 bool gpio_test_pin_enabled; // Whether the test pin was also enabled | 62 bool gpio_test_pin_enabled; // Whether the test pin was also enabled |
62 int spi_num_channels; // How many channels to use for SPI ADC/DAC | 63 int spi_num_channels; // How many channels to use for SPI ADC/DAC |
63 | 64 |
64 volatile uint32_t *pru_buffer_comm; | 65 volatile uint32_t *pru_buffer_comm; |
65 uint16_t *pru_buffer_spi_dac; | 66 uint16_t *pru_buffer_spi_dac; |
66 uint16_t *pru_buffer_spi_adc; | 67 uint16_t *pru_buffer_spi_adc; |
68 uint32_t *pru_buffer_matrix_gpio; | |
67 int16_t *pru_buffer_audio_dac; | 69 int16_t *pru_buffer_audio_dac; |
68 int16_t *pru_buffer_audio_adc; | 70 int16_t *pru_buffer_audio_adc; |
69 unsigned int spi_buffer_frames; | 71 unsigned int spi_buffer_frames; |
72 unsigned int matrix_gpio_buffer_frames; | |
70 unsigned int audio_buffer_frames; | 73 unsigned int audio_buffer_frames; |
71 | 74 |
72 int xenomai_gpio_fd; // File descriptor for /dev/mem for fast GPIO | 75 int xenomai_gpio_fd; // File descriptor for /dev/mem for fast GPIO |
73 uint32_t *xenomai_gpio; // Pointer to GPIO registers | 76 uint32_t *xenomai_gpio; // Pointer to GPIO registers |
74 }; | 77 }; |