void start_sound() { if (!buzzer_init) { buzzer_start(); printf("********OPENED AUDIO BUFFER***********\n"); buzzer_init = 1; } }
/*---------------------------------------------------------------------------*/ static void pub_handler(const char *topic, uint16_t topic_len, const uint8_t *chunk, uint16_t chunk_len) { DBG("Pub Handler: topic='%s' (len=%u), chunk_len=%u\n", topic, topic_len, chunk_len); /* If we don't like the length, ignore */ if(/*topic_len != 23 ||*/ chunk_len != 1) { printf("Incorrect topic or chunk len. Ignored\n"); return; } /* If the format != json, ignore if(strncmp(&topic[topic_len - 4], "json", 4) != 0) { printf("Incorrect format\n"); }*/ if(strstr(topic, "/cmd/leds") != NULL) { if(chunk[0] == '1') { leds_on(LEDS_RED); } else if(chunk[0] == '0') { leds_off(LEDS_RED); } return; } #if BOARD_SENSORTAG if(strstr(topic, "/cmd/buzz") != NULL) { if(chunk[0] == '1') { buzzer_start(1000); } else if(chunk[0] == '0') { buzzer_stop(); } return; } #endif }
void auth_signal_error(void) { buzzer_start(1, CONV_MS_TO_TICKS(1000), CONV_MS_TO_TICKS(50), BUZZER_OPTION_TOGGLE_LED); timer2_delay(1050); mode_update(); }
void auth_signal_failure(void) { buzzer_start(3, CONV_MS_TO_TICKS(50), CONV_MS_TO_TICKS(50), BUZZER_OPTION_TOGGLE_LED); timer2_delay(300); mode_update(); }
void auth_signal_success(void) { buzzer_start(2, CONV_MS_TO_TICKS(50), CONV_MS_TO_TICKS(50), BUZZER_OPTION_TOGGLE_LED); timer2_delay(200); mode_update(); }
void _beep(uint16_t freq, uint16_t time) { buzzer_start(freq); sleep(time); buzzer_stop(); }