2020-08-09 15:03:02 -04:00
|
|
|
#include "pebcom.h"
|
|
|
|
|
2022-01-07 16:55:03 -05:00
|
|
|
#include <pebble.h>
|
|
|
|
|
2022-04-02 06:51:06 -04:00
|
|
|
Object doVibe(Object* params, int length, struct Environment* env)
|
2022-01-07 16:55:03 -05:00
|
|
|
{
|
2022-04-02 06:51:06 -04:00
|
|
|
Object patternList = params[0];
|
|
|
|
int l = listLength(&patternList);
|
|
|
|
uint32_t pattern[l];
|
|
|
|
if (l > 0) {
|
2020-08-09 15:03:02 -04:00
|
|
|
int i = 0;
|
2022-01-07 16:55:03 -05:00
|
|
|
Object* pl = &patternList;
|
2020-08-09 15:03:02 -04:00
|
|
|
FOR_POINTER_IN_LIST(pl) {
|
2022-01-07 16:55:03 -05:00
|
|
|
if (POINTER->type == TYPE_NUMBER) {
|
2020-08-09 15:03:02 -04:00
|
|
|
pattern[i] = POINTER->number;
|
|
|
|
}
|
|
|
|
i++;
|
|
|
|
}
|
2022-01-07 16:55:03 -05:00
|
|
|
vibes_enqueue_custom_pattern(
|
2022-04-02 06:51:06 -04:00
|
|
|
(VibePattern) {.durations = pattern, .num_segments = l});
|
2022-03-31 10:29:06 -04:00
|
|
|
return trueObject();
|
2020-08-09 15:03:02 -04:00
|
|
|
} else {
|
|
|
|
return errorObject(NOT_A_LIST);
|
|
|
|
}
|
|
|
|
}
|