archive old bbnow driver
This commit is contained in:
+10
-4
@@ -7,8 +7,10 @@
|
|||||||
#include "blk_box_drivers/ssegs.hpp"
|
#include "blk_box_drivers/ssegs.hpp"
|
||||||
#include "blk_box_drivers/tft.hpp"
|
#include "blk_box_drivers/tft.hpp"
|
||||||
#include "blk_box_drivers/nvs.hpp"
|
#include "blk_box_drivers/nvs.hpp"
|
||||||
#include "blk_box_drivers/radio.hpp"
|
// #include "blk_box_drivers/radio.hpp"
|
||||||
#include "blk_box_drivers/bbnow.hpp"
|
// #include "blk_box_drivers/.hpp"
|
||||||
|
#include "blk_box_drivers/wifi.hpp"
|
||||||
|
#include "bbnow_driver.hpp"
|
||||||
|
|
||||||
void init_blk_box(BlkBoxInitConfig cfg) {
|
void init_blk_box(BlkBoxInitConfig cfg) {
|
||||||
init_main_i2c();
|
init_main_i2c();
|
||||||
@@ -19,6 +21,10 @@ void init_blk_box(BlkBoxInitConfig cfg) {
|
|||||||
init_tft();
|
init_tft();
|
||||||
|
|
||||||
init_nvs();
|
init_nvs();
|
||||||
init_radio();
|
// TODO: should I move everything over to the Class/Namespace style??
|
||||||
init_espnow();
|
|
||||||
|
ESP_ERROR_CHECK(Wifi::init());
|
||||||
|
ESP_ERROR_CHECK(BBNowDriver::init());
|
||||||
|
// init_radio();
|
||||||
|
// init_espnow();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#include "blk_box_drivers/bbnow_old.hpp"
|
#include "blk_box_drivers/bbnow_old.hpp"
|
||||||
|
#include "bbnow_pub.hpp"
|
||||||
#include "esp_now.h"
|
#include "esp_now.h"
|
||||||
#include "esp_log.h"
|
#include "esp_log.h"
|
||||||
#include "esp_mac.h"
|
#include "esp_mac.h"
|
||||||
@@ -150,7 +151,7 @@ static void bbnow_handle_received(const BBNowQueueItem& item) {
|
|||||||
}
|
}
|
||||||
ESP_LOGI(TAG, "received PUB packet: type=%d", static_cast<int>(pkt->packet_type));
|
ESP_LOGI(TAG, "received PUB packet: type=%d", static_cast<int>(pkt->packet_type));
|
||||||
if (pkt->packet_type == BBNowPubPacketType::DISCOVERY) {
|
if (pkt->packet_type == BBNowPubPacketType::DISCOVERY) {
|
||||||
ESP_LOGI(TAG, " DISCOVERY expantion=%d", static_cast<int>(pkt->packet_data.discovery.expantion_type));
|
ESP_LOGI(TAG, " DISCOVERY expantion=%d", static_cast<int>(std::get<BlkBoxNowPubDiscoveryData>(pkt->packet_data).expantion_type));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
#include "blk_box_drivers/radio.hpp"
|
#include "blk_box_drivers/radio.hpp"
|
||||||
#include "blk_box_drivers/bbnow.hpp"
|
#include "blk_box_drivers/bbnow_old.hpp"
|
||||||
#include "esp_wifi.h"
|
#include "esp_wifi.h"
|
||||||
|
|
||||||
void init_radio() {
|
void init_radio() {
|
||||||
|
|||||||
@@ -1,3 +1,36 @@
|
|||||||
#include "blk_box_drivers/wifi.hpp"
|
#include "blk_box_drivers/wifi.hpp"
|
||||||
|
|
||||||
|
#include "esp_event.h"
|
||||||
|
#include "esp_netif.h"
|
||||||
|
#include "esp_wifi.h"
|
||||||
|
|
||||||
|
esp_err_t Wifi::init()
|
||||||
|
{
|
||||||
|
esp_err_t err;
|
||||||
|
|
||||||
|
err = esp_netif_init();
|
||||||
|
if (err != ESP_OK) {
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
err = esp_event_loop_create_default();
|
||||||
|
if (err != ESP_OK && err != ESP_ERR_INVALID_STATE) {
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
esp_netif_create_default_wifi_sta();
|
||||||
|
|
||||||
|
wifi_init_config_t config = WIFI_INIT_CONFIG_DEFAULT();
|
||||||
|
|
||||||
|
err = esp_wifi_init(&config);
|
||||||
|
if (err != ESP_OK) {
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
err = esp_wifi_set_mode(WIFI_MODE_STA);
|
||||||
|
if (err != ESP_OK) {
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
return esp_wifi_start();
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,6 +1,12 @@
|
|||||||
#ifndef _WIFI_HPP
|
#ifndef _WIFI_HPP
|
||||||
#define _WIFI_HPP
|
#define _WIFI_HPP
|
||||||
|
|
||||||
|
#include "esp_err.h"
|
||||||
|
|
||||||
|
class Wifi {
|
||||||
|
public:
|
||||||
|
static esp_err_t init();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif /* _WIFI_HPP */
|
#endif /* _WIFI_HPP */
|
||||||
|
|||||||
Reference in New Issue
Block a user