Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
flow3r firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
flow3r
flow3r firmware
Commits
00b80bec
Commit
00b80bec
authored
1 year ago
by
dx
Browse files
Options
Downloads
Patches
Plain Diff
docs/api/audio: add a few more functions
Also rename the arg of mp_input_set_source() from enable to source
parent
bbd61fde
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#5814
failed
1 year ago
Stage: check
Stage: build
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
docs/api/audio.rst
+44
-0
44 additions, 0 deletions
docs/api/audio.rst
usermodule/mp_audio.c
+1
-1
1 addition, 1 deletion
usermodule/mp_audio.c
with
45 additions
and
1 deletion
docs/api/audio.rst
+
44
−
0
View file @
00b80bec
...
...
@@ -97,6 +97,50 @@ the "headphone" variant is chosen, else the "speaker" variant is chosen.
:code:`audio_{headphones_/speaker_/}set_{maximum/minimum}_volume_` and 0 if
in a fake mute condition.
.. py:function:: headphones_line_in_set_hardware_thru(enable : bool)
.. py:function:: speaker_line_in_set_hardware_thru(enable : bool)
.. py:function:: line_in_set_hardware_thru(enable : bool)
These route whatever is on the line in port directly to the headphones or
speaker respectively (enable = 1), or don't (enable = 0). Is affected by mute
and coarse hardware volume settings, however software fine volume is not
applied.
Good for testing, might deprecate later, idk~
.. py:function:: input_set_source(source : int)
.. py:function:: input_get_source() -> int
The codec can transmit audio data from different sources. This function
enables one or no source as provided by the ``INPUT_SOURCE_*`` constants.
Note: The onboard digital mic turns on an LED on the top board if it receives
a clock signal which is considered a good proxy for its capability of reading
data.
.. py:data:: INPUT_SOURCE_NONE
.. py:data:: INPUT_SOURCE_LINE_IN
.. py:data:: INPUT_SOURCE_HEADSET_MIC
.. py:data:: INPUT_SOURCE_ONBOARD_MIC
.. py:function:: headset_set_gain_dB(gain_dB : int)
.. py:function:: headset_get_gain_dB() -> int
Hardware preamp gain, 0dB-50dB. TODO: figure out if int/float inconsistency
is a good thing here compared to all other _dB functions.
.. py:function:: input_thru_set_volume_dB(vol_dB : float)
.. py:function:: input_thru_get_volume_dB() -> float
.. py:function:: input_thru_set_mute(mute : bool)
.. py:function:: input_thru_get_mute() -> bool
You can route whatever source is selected with input_set_source() to
the audio output. Use these to control volume and mute.
.. py:function:: codec_i2c_write(reg : int, data : int)
Write audio codec register. Obviously very unsafe. Have fun.
Headphone port policy
---------------------
...
...
This diff is collapsed.
Click to expand it.
usermodule/mp_audio.c
+
1
−
1
View file @
00b80bec
...
...
@@ -215,7 +215,7 @@ STATIC mp_obj_t mp_line_in_set_hardware_thru(mp_obj_t enable) {
STATIC
MP_DEFINE_CONST_FUN_OBJ_1
(
mp_line_in_set_hardware_thru_obj
,
mp_line_in_set_hardware_thru
);
STATIC
mp_obj_t
mp_input_set_source
(
mp_obj_t
enabl
e
)
{
STATIC
mp_obj_t
mp_input_set_source
(
mp_obj_t
sourc
e
)
{
st3m_audio_input_set_source
(
mp_obj_get_int
(
enable
));
return
mp_const_none
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment