diff options
| Commit | 020e313927208f637596edaafee4d1059038e46e (patch) | |
|---|---|---|
| Author | 2024-05-20 16:02:28 +0300 | |
| Committer | 2024-05-20 16:02:28 +0300 | |
| Files | fbdbaffc3dafb6e25e246efe9b73faf61d3e46c3 | |
| uni-projects-020e313927208f637596edaafee4d1059038e46e.tar uni-projects-020e313927208f637596edaafee4d1059038e46e.tar.gz uni-projects-020e313927208f637596edaafee4d1059038e46e.zip | ||
| Parent | adf061ff7688ae5fcf23e5ec0eda3822f0328350 (diff) | |
[iot/goam] Successful example writing on screen
3 files changed, 30 insertions, 2 deletions
| -rw-r--r-- | Year 3/Internet of things/goam/main/display.c | 20 | ||||
| -rw-r--r-- | Year 3/Internet of things/goam/main/display.h | 6 | ||||
| -rw-r--r-- | Year 3/Internet of things/goam/main/main.c | 6 |
diff --git a/Year 3/Internet of things/goam/main/display.c b/Year 3/Internet of things/goam/main/display.c index 081e113..e7435fe 100644 --- a/Year 3/Internet of things/goam/main/display.c +++ b/Year 3/Internet of things/goam/main/display.c @@ -66,12 +66,32 @@ static void send(const unsigned char* data, size_t size) { static const unsigned char startup[] = { 0x00, 0x8D, 0x14, 0xAF }; +const unsigned char pattern[] = { + 0x20, // horizontal address mode + 0b00, + 0x21, // set column start/end + 0, 127, + 0x22, //set page start/end + 0, 7, + 0x40, 0b101010, 0xFF +}; + void display_init() { i2c_init(); send_primitive(startup, 4, false); + send_primitive(pattern, 8, false); ESP_LOGI(TAG, "Initialized display"); } void display_invertion(enum Inversion inv_byte) { send((const unsigned char*)&inv_byte, 1); } + +const unsigned char off = 0xAE, on = 0xAF; + +void display_example() { + // MUST be separated, for some reason + send_primitive(&off, 1, false); + send_primitive(pattern + 8, 3, false); + send_primitive(&on, 1, false); +} diff --git a/Year 3/Internet of things/goam/main/display.h b/Year 3/Internet of things/goam/main/display.h index 1bc9ea5..0584727 100644 --- a/Year 3/Internet of things/goam/main/display.h +++ b/Year 3/Internet of things/goam/main/display.h @@ -7,3 +7,9 @@ enum Inversion { INVERSE = 0xA7 }; void display_invertion(enum Inversion inv_byte); + + + +/* clang-format on */ + +void display_example(); diff --git a/Year 3/Internet of things/goam/main/main.c b/Year 3/Internet of things/goam/main/main.c index 95ba622..0378413 100644 --- a/Year 3/Internet of things/goam/main/main.c +++ b/Year 3/Internet of things/goam/main/main.c @@ -112,6 +112,7 @@ void app_main(void) buttons_init(); add_push_button(BTN_SHOOT_PIN, take_photo, NULL); + // This is really slow wifi_init(); webserver_init(); wifi_start(); // Automatically starts server too @@ -123,14 +124,15 @@ void app_main(void) // TODO: move before notification wait display_init(); + display_example(); for (int i = 0; true; i++) { /* ptc06_reset(); */ /* printf("%d seconds, %d\n", i, gpio_get_level(GPIO_INPUT_CAMERA)); */ - display_invertion(INVERSE); + /* display_invertion(INVERSE); */ vTaskDelay(1000 / portTICK_PERIOD_MS); - display_invertion(NORMAL); + /* display_invertion(NORMAL); */ vTaskDelay(1000 / portTICK_PERIOD_MS); } |
