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 "MIDIUSB.h"
9 #include <Adafruit_Keypad.h>
10 #include <Adafruit_NeoPixel.h>
11 #include <Adafruit_NeoPixel_ZeroDMA.h>
12 #include <Arduino.h>
13 
14 #ifndef ADAFRUIT_TRELLIS_M4_EXPRESS
15 #error "This library is only for the Adafruit NeoTrellis M4!!"
16 #endif
17 
20 class Adafruit_NeoTrellisM4 : public Adafruit_Keypad,
21  public Adafruit_NeoPixel_ZeroDMA {
22 
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) { return _num_keys; }
35 
36  void enableUSBMIDI(boolean f);
37  void enableUARTMIDI(boolean f);
38  void setUARTMIDIchannel(uint8_t c);
39  void setUSBMIDIchannel(uint8_t c);
40  void noteOn(byte pitch, byte velocity);
41  void noteOff(byte pitch, byte velocity);
42  void pitchBend(int value);
43  void controlChange(byte control, byte value);
44  void sendMIDI(void);
45  void programChange(byte channel, byte program);
46 
47 private:
48  int _num_keys, _rows, _cols;
49  boolean _pending_midi, _auto_update, _midi_usb, _midi_uart;
50  int _midi_channel_usb, _midi_channel_uart;
51 };
52 
53 #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:144
void pitchBend(int value)
Send pitch bend MIDI message.
Definition: Adafruit_NeoTrellisM4.cpp:227
void controlChange(byte control, byte value)
Send control change MIDI message.
Definition: Adafruit_NeoTrellisM4.cpp:251
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:20
void sendMIDI(void)
Flush any pending MIDI messages for sending.
Definition: Adafruit_NeoTrellisM4.cpp:284
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:159
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:180
void setUARTMIDIchannel(uint8_t c)
Configure the MIDI channel to use when using UART.
Definition: Adafruit_NeoTrellisM4.cpp:169
void programChange(byte channel, byte program)
Send program change MIDI message.
Definition: Adafruit_NeoTrellisM4.cpp:274
void noteOff(byte pitch, byte velocity)
Send MIDI note off.
Definition: Adafruit_NeoTrellisM4.cpp:204
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