Skip to content

Commit be107e1

Browse files
Merge pull request electro-smith#200 from electro-smith/petal_work
Petal Breakout work
2 parents 0929460 + 699b190 commit be107e1

1 file changed

Lines changed: 29 additions & 13 deletions

File tree

src/daisy_petal.cpp

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,18 @@ using namespace daisy;
88

99
// Hardware related defines.
1010
// Switches
11-
#define SW_1_PIN 9
12-
#define SW_2_PIN 10
13-
#define SW_3_PIN 11
14-
#define SW_4_PIN 14
15-
#define SW_5_PIN 0
16-
#define SW_6_PIN 27
17-
#define SW_7_PIN 8
11+
#define SW_1_PIN 8
12+
#define SW_2_PIN 9
13+
#define SW_3_PIN 10
14+
#define SW_4_PIN 13
15+
#define SW_5_PIN 25
16+
#define SW_6_PIN 26
17+
#define SW_7_PIN 7
1818

1919
// Encoder
20-
#define ENC_A_PIN 29
21-
#define ENC_B_PIN 28
22-
#define ENC_CLICK_PIN 15
20+
#define ENC_A_PIN 28
21+
#define ENC_B_PIN 27
22+
#define ENC_CLICK_PIN 14
2323

2424
// Knobs
2525
#define PIN_EXPRESSION 15
@@ -148,6 +148,11 @@ float DaisyPetal::GetKnobValue(Knob k)
148148
return knob[idx].Value();
149149
}
150150

151+
float DaisyPetal::GetExpression()
152+
{
153+
return expression.Value();
154+
}
155+
151156
void DaisyPetal::DebounceControls()
152157
{
153158
encoder.Debounce();
@@ -161,12 +166,21 @@ void DaisyPetal::DebounceControls()
161166
void DaisyPetal::ClearLeds()
162167
{
163168
// Using Color
164-
Color c;
165-
c.Init(Color::PresetColor::OFF);
169+
// Color c;
170+
// c.Init(Color::PresetColor::OFF);
171+
// for(size_t i = 0; i < RING_LED_LAST; i++)
172+
// {
173+
// ring_led[i].SetColor(c);
174+
// }
166175
for(size_t i = 0; i < RING_LED_LAST; i++)
167176
{
168-
ring_led[i].SetColor(c);
177+
SetRingLed(static_cast<RingLed>(i), 0.0f, 0.0f, 0.0f);
169178
}
179+
for(size_t i = 0; i < FOOTSWITCH_LED_LAST; i++)
180+
{
181+
SetFootswitchLed(static_cast<FootswitchLed>(i), 0.0f);
182+
}
183+
170184
}
171185

172186
void DaisyPetal::UpdateLeds()
@@ -274,6 +288,8 @@ void DaisyPetal::InitAnalogControls()
274288
cfg[KNOB_6].InitSingle(seed.GetPin(PIN_KNOB_6));
275289
// Special case for Expression
276290
cfg[KNOB_LAST].InitSingle(seed.GetPin(PIN_EXPRESSION));
291+
292+
seed.adc.Init(cfg, KNOB_LAST + 1);
277293
// Make an array of pointers to the knob.
278294
for(int i = 0; i < KNOB_LAST; i++)
279295
{

0 commit comments

Comments
 (0)