-
-
Notifications
You must be signed in to change notification settings - Fork 12
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 #52 from esp-cpp/feature/sms
Sega Master System / Game Gear support via SMSPlus
- Loading branch information
Showing
102 changed files
with
19,817 additions
and
687 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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,14 @@ | ||
#pragma once | ||
|
||
#include "freertos/FreeRTOS.h" | ||
#include "freertos/queue.h" | ||
|
||
#include "format.hpp" | ||
#include "i2s_audio.h" | ||
#include "task.hpp" | ||
|
||
namespace hal { | ||
void init_audio_task(); | ||
void set_audio_sample_count(size_t count); | ||
void push_audio(const void* audio); | ||
} // namespace hal |
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
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,16 @@ | ||
#pragma once | ||
|
||
#include "freertos/FreeRTOS.h" | ||
#include "freertos/queue.h" | ||
|
||
#include "format.hpp" | ||
#include "spi_lcd.h" | ||
#include "task.hpp" | ||
|
||
namespace hal { | ||
void init_video_task(); | ||
void set_display_size(size_t width, size_t height); | ||
void set_native_size(size_t width, size_t height, int pitch = -1); | ||
void set_palette(const uint16_t* palette, size_t size = 256); | ||
void push_frame(const void* frame); | ||
} // namespace hal |
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,65 @@ | ||
#include "audio_task.hpp" | ||
|
||
using namespace hal; | ||
|
||
static size_t audio_sample_count = 0; | ||
static std::shared_ptr<espp::Task> audio_task_; | ||
static QueueHandle_t audio_queue_; | ||
|
||
static bool audio_task(std::mutex &m, std::condition_variable& cv); | ||
|
||
void hal::init_audio_task() { | ||
static bool initialized = false; | ||
if (initialized) { | ||
return; | ||
} | ||
// audio_queue_ = xQueueCreate(1, sizeof(uint16_t*)); | ||
// audio_task_ = std::make_shared<espp::Task>(espp::Task::Config{ | ||
// .name = "audio task", | ||
// .callback = audio_task, | ||
// .stack_size_bytes = 4*1024, | ||
// .priority = 20, | ||
// .core_id = 1 | ||
// }); | ||
// audio_task_->start(); | ||
initialized = true; | ||
} | ||
|
||
void hal::set_audio_sample_count(size_t count) { | ||
audio_sample_count = count; | ||
} | ||
|
||
void hal::push_audio(const void* audio) { | ||
// if (audio_queue_ == nullptr) { | ||
// fmt::print("audio queue is null, make sure to call init_audio_task() first\n"); | ||
// return; | ||
// } | ||
// xQueueSend(audio_queue_, &audio, 10 / portTICK_PERIOD_MS); | ||
// we got a valid audio frame, so let's play it | ||
const uint8_t* audio_ptr = (const uint8_t*)audio; | ||
// multiply by 2 since we're 16-bit | ||
audio_play_frame(audio_ptr, audio_sample_count*2); | ||
} | ||
|
||
static bool audio_task(std::mutex &m, std::condition_variable& cv) { | ||
const void *_audio_ptr; | ||
if (xQueuePeek(audio_queue_, &_audio_ptr, 100 / portTICK_PERIOD_MS) != pdTRUE) { | ||
// we couldn't get anything from the queue, return | ||
return false; | ||
} | ||
if (_audio_ptr == nullptr) { | ||
// make sure we clear the queue | ||
xQueueReceive(audio_queue_, &_audio_ptr, 10 / portTICK_PERIOD_MS); | ||
// we got a nullptr, return | ||
return false; | ||
} | ||
// we got a valid audio frame, so let's play it | ||
const uint8_t* audio_ptr = (const uint8_t*)_audio_ptr; | ||
// multiply by 2 since we're 16-bit | ||
audio_play_frame(audio_ptr, audio_sample_count*2); | ||
|
||
// we don't have to worry here since we know there was an item in the queue | ||
// since we peeked earlier. | ||
xQueueReceive(audio_queue_, &_audio_ptr, 10 / portTICK_PERIOD_MS); | ||
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
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
Oops, something went wrong.