26 lines
648 B
C
26 lines
648 B
C
#include "pebcom.h"
|
|
|
|
#include <pebble.h>
|
|
|
|
Object doVibe(Object* params, int length, struct Environment* env)
|
|
{
|
|
Object patternList = params[0];
|
|
int l = listLength(&patternList);
|
|
uint32_t pattern[l];
|
|
if (l > 0) {
|
|
int i = 0;
|
|
Object* pl = &patternList;
|
|
FOR_POINTER_IN_LIST(pl) {
|
|
if (POINTER->type == TYPE_NUMBER) {
|
|
pattern[i] = POINTER->number;
|
|
}
|
|
i++;
|
|
}
|
|
vibes_enqueue_custom_pattern(
|
|
(VibePattern) {.durations = pattern, .num_segments = l});
|
|
return trueObject();
|
|
} else {
|
|
return errorObject(NOT_A_LIST);
|
|
}
|
|
}
|