-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from hpsaturn/improv_sample_minors
Improv sample minors
- Loading branch information
Showing
24 changed files
with
983 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#include "CamFreenove.h" | ||
|
||
static camera_config_t camera_config = { | ||
.pin_pwdn = -1, | ||
.pin_reset = -1, | ||
.pin_xclk = 15, | ||
.pin_sscb_sda = 4, | ||
.pin_sscb_scl = 5, | ||
.pin_d7 = 16, | ||
.pin_d6 = 17, | ||
.pin_d5 = 18, | ||
.pin_d4 = 12, | ||
.pin_d3 = 10, | ||
.pin_d2 = 8, | ||
.pin_d1 = 9, | ||
.pin_d0 = 11, | ||
|
||
.pin_vsync = 6, | ||
.pin_href = 7, | ||
.pin_pclk = 13, | ||
|
||
.xclk_freq_hz = 20000000, | ||
.ledc_timer = LEDC_TIMER_0, | ||
.ledc_channel = LEDC_CHANNEL_0, | ||
|
||
.pixel_format = PIXFORMAT_RGB565, | ||
.frame_size = FRAMESIZE_QVGA, | ||
.jpeg_quality = 0, | ||
.fb_count = 2, | ||
.fb_location = CAMERA_FB_IN_PSRAM, | ||
.grab_mode = CAMERA_GRAB_WHEN_EMPTY, | ||
.sccb_i2c_port = 0 | ||
}; | ||
|
||
bool CamFreenove::begin() { | ||
|
||
esp_err_t err = esp_camera_init(&camera_config); | ||
if (err != ESP_OK) { | ||
return false; | ||
} | ||
sensor = esp_camera_sensor_get(); | ||
return true; | ||
} | ||
|
||
bool CamFreenove::get() { | ||
fb = esp_camera_fb_get(); | ||
if (!fb) { | ||
return false; | ||
} | ||
return true; | ||
} | ||
|
||
bool CamFreenove::free() { | ||
if (fb) { | ||
esp_camera_fb_return(fb); | ||
return true; | ||
} | ||
return false; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#ifndef CAMFREENOVE_H | ||
#define CAMFREENOVE_H | ||
|
||
#include "esp_camera.h" | ||
|
||
class CamFreenove { | ||
private: | ||
public: | ||
camera_fb_t* fb; | ||
sensor_t* sensor; | ||
camera_config_t* config; | ||
bool begin(); | ||
bool get(); | ||
bool free(); | ||
}; | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
#define LGFX_USE_V1 | ||
|
||
#include <LovyanGFX.hpp> | ||
|
||
|
||
class LGFX : public lgfx::LGFX_Device | ||
{ | ||
// lgfx::Panel_ILI9341 _panel_instance; | ||
lgfx::Panel_ILI9488 _panel_instance; | ||
lgfx::Bus_Parallel16 _bus_instance; // 8ビットパラレルバスのインスタンス (ESP32のみ) | ||
|
||
public: | ||
// コンストラクタを作成し、ここで各種設定を行います。 | ||
// クラス名を変更した場合はコンストラクタも同じ名前を指定してください。 | ||
LGFX(void) | ||
{ | ||
{ // バス制御の設定を行います。 | ||
auto cfg = _bus_instance.config(); // バス設定用の構造体を取得します。 | ||
|
||
// 16位设置 | ||
cfg.port = 0; // 使用するI2Sポートを選択 (0 or 1) (ESP32のI2S LCDモードを使用します) | ||
cfg.freq_write = 20000000; // 送信クロック (最大20MHz, 80MHzを整数で割った値に丸められます) | ||
cfg.pin_wr = 35; // WR を接続しているピン番号 | ||
cfg.pin_rd = 48; // RD を接続しているピン番号 | ||
cfg.pin_rs = 36; // RS(D/C)を接続しているピン番号 | ||
|
||
cfg.pin_d0 = 47; | ||
cfg.pin_d1 = 21; | ||
cfg.pin_d2 = 14; | ||
cfg.pin_d3 = 13; | ||
cfg.pin_d4 = 12; | ||
cfg.pin_d5 = 11; | ||
cfg.pin_d6 = 10; | ||
cfg.pin_d7 = 9; | ||
cfg.pin_d8 = 3; | ||
cfg.pin_d9 = 8; | ||
cfg.pin_d10 = 16; | ||
cfg.pin_d11 = 15; | ||
cfg.pin_d12 = 7; | ||
cfg.pin_d13 = 6; | ||
cfg.pin_d14 = 5; | ||
cfg.pin_d15 = 4; | ||
|
||
_bus_instance.config(cfg); // 設定値をバスに反映します。 | ||
_panel_instance.setBus(&_bus_instance); // バスをパネルにセットします。 | ||
} | ||
|
||
{ // 表示パネル制御の設定を行います。 | ||
auto cfg = _panel_instance.config(); // 表示パネル設定用の構造体を取得します。 | ||
|
||
cfg.pin_cs = -1; // CS要拉低 | ||
cfg.pin_rst = -1; // RST和开发板RST相连 | ||
cfg.pin_busy = -1; // BUSYが接続されているピン番号 (-1 = disable) | ||
|
||
// ※ 以下の設定値はパネル毎に一般的な初期値が設定されていますので、不明な項目はコメントアウトして試してみてください。 | ||
|
||
cfg.memory_width = 320; // ドライバICがサポートしている最大の幅 | ||
cfg.memory_height = 480; // ドライバICがサポートしている最大の高さ | ||
cfg.panel_width = 320; // 実際に表示可能な幅 | ||
cfg.panel_height = 480; // 実際に表示可能な高さ | ||
cfg.offset_x = 0; // パネルのX方向オフセット量 | ||
cfg.offset_y = 0; // パネルのY方向オフセット量 | ||
cfg.offset_rotation = 0; // 回転方向の値のオフセット 0~7 (4~7は上下反転) | ||
cfg.dummy_read_pixel = 8; // ピクセル読出し前のダミーリードのビット数 | ||
cfg.dummy_read_bits = 1; // ピクセル以外のデータ読出し前のダミーリードのビット数 | ||
cfg.readable = true; // データ読出しが可能な場合 trueに設定 | ||
cfg.invert = false; // パネルの明暗が反転してしまう場合 trueに設定 | ||
cfg.rgb_order = false; // パネルの赤と青が入れ替わってしまう場合 trueに設定 | ||
cfg.dlen_16bit = true; // データ長を16bit単位で送信するパネルの場合 trueに設定 | ||
cfg.bus_shared = true; // SDカードとバスを共有している場合 trueに設定(drawJpgFile等でバス制御を行います) | ||
|
||
_panel_instance.config(cfg); | ||
} | ||
|
||
setPanel(&_panel_instance); // 使用するパネルをセットします。 | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
/* Automatically generated nanopb constant definitions */ | ||
/* Generated by nanopb-0.4.4 */ | ||
|
||
#include "comm.pb.h" | ||
#if PB_PROTO_HEADER_VERSION != 40 | ||
#error Regenerate this file with the current version of nanopb generator. | ||
#endif | ||
|
||
PB_BIND(JoystickMessage, JoystickMessage, AUTO) | ||
|
||
|
||
PB_BIND(TelemetryMessage, TelemetryMessage, AUTO) | ||
|
||
|
||
|
Oops, something went wrong.