|
|
@ -1,3 +1,4 @@ |
|
|
|
#include "driver/gpio.h" |
|
|
|
#include "esp_gatts_api.h" |
|
|
|
#include "esp_log.h" |
|
|
|
#include "esp_system.h" |
|
|
@ -17,6 +18,12 @@ |
|
|
|
static char bluetooth_tx_buffer[profile_b_buffer_size] = {0}; |
|
|
|
static char bluetooth_rx_buffer[profile_b_buffer_size] = {0}; |
|
|
|
|
|
|
|
#define GPIO_OUTPUT_IO_RED 3 |
|
|
|
#define GPIO_OUTPUT_IO_GREEN 4 |
|
|
|
#define GPIO_OUTPUT_IO_BLUE 5 |
|
|
|
|
|
|
|
#define GPIO_OUTPUT_PIN_SEL ((1ULL << GPIO_OUTPUT_IO_GREEN) | (1ULL << GPIO_OUTPUT_IO_BLUE) | (1ULL << GPIO_OUTPUT_IO_RED)) |
|
|
|
|
|
|
|
bluetooth_processer_t s_bluetooth_processer = { |
|
|
|
.bluetooth_processer_rx_buf = bluetooth_rx_buffer, |
|
|
|
.bluetooth_processer_rx_buf_size = sizeof(bluetooth_rx_buffer), |
|
|
@ -48,12 +55,26 @@ bluetooth_processer_t s_bluetooth_processer = { |
|
|
|
.motor_drive_turn_flag = false, |
|
|
|
}; |
|
|
|
|
|
|
|
void gpio_rgb_init() { |
|
|
|
gpio_config_t gpio_grb_led_structer; |
|
|
|
|
|
|
|
gpio_grb_led_structer.intr_type = GPIO_INTR_DISABLE; |
|
|
|
gpio_grb_led_structer.mode = GPIO_MODE_OUTPUT; |
|
|
|
gpio_grb_led_structer.pin_bit_mask = GPIO_OUTPUT_PIN_SEL; |
|
|
|
gpio_grb_led_structer.pull_down_en = 0; |
|
|
|
gpio_grb_led_structer.pull_up_en = 0; |
|
|
|
|
|
|
|
gpio_config(&gpio_grb_led_structer); |
|
|
|
} |
|
|
|
|
|
|
|
void app_main(void) { |
|
|
|
constructor_bluetooth_processer(&s_bluetooth_processer); |
|
|
|
ble_spp_server_demo_app_main(&s_bluetooth_processer); |
|
|
|
timer_group_init(TIMER_GROUP_0, TIMER_0, false, timer_group0_interval_num, timer_interval_ms); |
|
|
|
motor_drive_uart_init(); |
|
|
|
gpio_rgb_init(); |
|
|
|
|
|
|
|
gpio_set_level(GPIO_OUTPUT_IO_GREEN,1); |
|
|
|
while (true) { |
|
|
|
bluetooth_gatts_try_process_data(); |
|
|
|
// if (s_bluetooth_processer.auto_report_flag) { |
|
|
|