Adafruit NeoTrellis M4 Library
Adafruit_NeoTrellisM4.h
Go to the documentation of this file.
1 
5 #ifndef _ADAFRUIT_NEOTRELLIS_M4_H_
6 #define _ADAFRUIT_NEOTRELLIS_M4_H_
7 
8 #include <Adafruit_Keypad.h>
9 #include <Adafruit_NeoPixel.h>
10 #include <Adafruit_NeoPixel_ZeroDMA.h>
11 #include <Arduino.h>
12 
13 #include "MIDIUSB.h"
14 
15 #ifndef ADAFRUIT_TRELLIS_M4_EXPRESS
16 #error "This library is only for the Adafruit NeoTrellis M4!!"
17 #endif
18 
21 class Adafruit_NeoTrellisM4 : public Adafruit_Keypad,
22  public Adafruit_NeoPixel_ZeroDMA {
23  public:
25  void begin(void);
26  void tick(void);
27 
28  void autoUpdateNeoPixels(boolean flag);
29  void setPixelColor(uint32_t pixel, uint32_t color);
30  void fill(uint32_t color);
31 
34  uint8_t num_keys(void) {
35  return _num_keys;
36  }
37 
38  void enableUSBMIDI(boolean f);
39  void enableUARTMIDI(boolean f);
40  void setUARTMIDIchannel(uint8_t c);
41  void setUSBMIDIchannel(uint8_t c);
42  void noteOn(byte pitch, byte velocity);
43  void noteOff(byte pitch, byte velocity);
44  void pitchBend(int value);
45  void controlChange(byte control, byte value);
46  void sendMIDI(void);
47  void programChange(byte channel, byte program);
48 
49  private:
50  int _num_keys, _rows, _cols;
51  boolean _pending_midi, _auto_update, _midi_usb, _midi_uart;
52  int _midi_channel_usb, _midi_channel_uart;
53 };
54 
55 #endif
void tick(void)
Check the keypads to determine whather they were just pressed/released. x.
Definition: Adafruit_NeoTrellisM4.cpp:113
void setPixelColor(uint32_t pixel, uint32_t color)
Set one neopixel with a 24-bit color (RGB in 888 format)
Definition: Adafruit_NeoTrellisM4.cpp:74
void enableUARTMIDI(boolean f)
Whether to send MIDI messages over the UART port.
Definition: Adafruit_NeoTrellisM4.cpp:146
void pitchBend(int value)
Send pitch bend MIDI message.
Definition: Adafruit_NeoTrellisM4.cpp:229
void controlChange(byte control, byte value)
Send control change MIDI message.
Definition: Adafruit_NeoTrellisM4.cpp:253
void autoUpdateNeoPixels(boolean flag)
Whether we should automatically update the neopixels whenever we set/fill the colors. Auto-update is easier to use, but is slower.
Definition: Adafruit_NeoTrellisM4.cpp:88
NeoTrellis M4 helper library that handles DMA NeoPixel, Keypad scanning, and some basic MIDI messages...
Definition: Adafruit_NeoTrellisM4.h:21
void sendMIDI(void)
Flush any pending MIDI messages for sending.
Definition: Adafruit_NeoTrellisM4.cpp:286
uint8_t num_keys(void)
Getter for how many keys are available on this NeoTrellis.
Definition: Adafruit_NeoTrellisM4.h:34
void setUSBMIDIchannel(uint8_t c)
Configure the MIDI channel to use when using USB.
Definition: Adafruit_NeoTrellisM4.cpp:161
void begin(void)
Initialize the NeoTrellis, start the keypad scanner and turn all neopixels off. x.
Definition: Adafruit_NeoTrellisM4.cpp:57
void noteOn(byte pitch, byte velocity)
Send MIDI note on.
Definition: Adafruit_NeoTrellisM4.cpp:182
void setUARTMIDIchannel(uint8_t c)
Configure the MIDI channel to use when using UART.
Definition: Adafruit_NeoTrellisM4.cpp:171
void programChange(byte channel, byte program)
Send program change MIDI message.
Definition: Adafruit_NeoTrellisM4.cpp:276
void noteOff(byte pitch, byte velocity)
Send MIDI note off.
Definition: Adafruit_NeoTrellisM4.cpp:206
void enableUSBMIDI(boolean f)
Whether to send MIDI messages over the USB port.
Definition: Adafruit_NeoTrellisM4.cpp:136
void fill(uint32_t color)
Fill the neopixels with a 24-bit color (RGB in 888 format)
Definition: Adafruit_NeoTrellisM4.cpp:98