Go to file
Thatcher Chamberlin 90ed5cea80 Squashed commit of the following:
commit d21b9279462a63f292c8a6ef7d72f60bf83ea6df
Author: Thatcher Chamberlin <j.thatcher.c@gmail.com>
Date:   Sun Jan 29 11:12:31 2023 -0500

    Switched from WAVs to MP3s

commit 8a407aa29a6b636d8afe407089a80fc5a3f6e1b2
Author: Thatcher Chamberlin <j.thatcher.c@gmail.com>
Date:   Fri Jan 27 07:35:00 2023 -0500

    Re-added -j flag

commit 654b56be791ba7e9ab7407a084601a0b4f8f9619
Author: Thatcher Chamberlin <j.thatcher.c@gmail.com>
Date:   Mon Jan 23 20:40:08 2023 -0500

    Cleaned up build.mk

commit 112175c3fe8168860908c5fcd1b2b8fea0493231
Author: Thatcher Chamberlin <j.thatcher.c@gmail.com>
Date:   Mon Jan 23 20:36:18 2023 -0500

    Changed used variable names to match generated variable names

commit 0dfe30e5b66185671eb85930c8a7f63b1880f0c7
Author: Thatcher Chamberlin <j.thatcher.c@gmail.com>
Date:   Sun Jan 22 20:10:25 2023 -0500

    Zeroth cut at a better sound build system that makes better use of the .o/.cpp build system

commit f8131f371535e636b02b6aaef853154efff837aa
Author: Thatcher Chamberlin <j.thatcher.c@gmail.com>
Date:   Thu Jan 12 23:42:14 2023 -0500

    Removed parallel make - this is the only way I found to get wav->txt to run before the .txt files are included elsewhere

commit 934a42c0abd31e59bbebd6193a1db25e773d01ae
Author: Thatcher Chamberlin <j.thatcher.c@gmail.com>
Date:   Thu Jan 12 23:41:56 2023 -0500

    Deleted some reference code

commit 9d6a4c6638b6f74bd27f87af35451ad06de4cea8
Author: Thatcher Chamberlin <j.thatcher.c@gmail.com>
Date:   Thu Jan 12 23:39:02 2023 -0500

    Fixed include error and absolute paths of generated .txt files

commit ffc5d7178d8f4bbf4e76c91623c1aba85d83c1e7
Author: Thatcher Chamberlin <j.thatcher.c@gmail.com>
Date:   Thu Jan 12 23:38:29 2023 -0500

    Added txt to the windows-only branch

commit 1fea961998365c1483e23644cef60793cfe10e45
Author: Thatcher Chamberlin <j.thatcher.c@gmail.com>
Date:   Thu Jan 12 22:09:43 2023 -0500

    Renamed wav objects for consistency

commit e8d47b082a425074f0f16a29d0e54726aac1fa68
Author: Thatcher Chamberlin <j.thatcher.c@gmail.com>
Date:   Thu Jan 12 18:26:18 2023 -0500

    Changed out.raw to out.sbc and commented out the usage of the sbcinfo command

commit 2a0ff6569dd81f74f9f30714de8309013b4f8d9a
Author: Thatcher Chamberlin <j.thatcher.c@gmail.com>
Date:   Tue Jan 10 20:37:29 2023 -0500

    Added hash to out.raw so that `make -j` doesn't fail

commit 80b2c18d5d848c216a76398ab615dace029506fd
Author: Thatcher Chamberlin <j.thatcher.c@gmail.com>
Date:   Tue Jan 10 18:13:41 2023 -0500

    Deleted .txt sounds and fixed Make system to make them!

commit 319732a808d72dc70e03ebf8ce993ffdf7a01327
Author: Thatcher Chamberlin <j.thatcher.c@gmail.com>
Date:   Tue Jan 10 17:34:04 2023 -0500

    Standardized out.raw name

commit e48edd26d6a103e8b51c804416a3281122cde974
Author: Thatcher Chamberlin <j.thatcher.c@gmail.com>
Date:   Tue Jan 10 17:28:14 2023 -0500

    Added .wav files to tracking

commit 6a8c25eef4bf2ac477316629b37322188ba75762
Author: Thatcher Chamberlin <j.thatcher.c@gmail.com>
Date:   Tue Jan 10 17:26:33 2023 -0500

    Force ffmpeg overwrite

commit 03b50a544d579dadc573fb75e138ee0561d733f2
Author: Thatcher Chamberlin <j.thatcher.c@gmail.com>
Date:   Tue Jan 10 08:45:41 2023 -0500

    Removed extraneous slashes

commit b4670dc68a274d572005d093e471e4a1c982ed16
Author: Thatcher Chamberlin <j.thatcher.c@gmail.com>
Date:   Tue Jan 10 08:44:41 2023 -0500

    Added explicit verbosity

commit 2c8cdeea6ecbfbffc7cc4dc4ccb1bd4ac50c7f8a
Author: Thatcher Chamberlin <j.thatcher.c@gmail.com>
Date:   Tue Jan 10 08:11:02 2023 -0500

    Annotate xxd command args

commit 51d97b1033afcb561b89586fd7d8ffd78a35d43a
Author: Thatcher Chamberlin <j.thatcher.c@gmail.com>
Date:   Tue Jan 10 08:04:04 2023 -0500

    Added -aq audio quality flag to keep file sizes the same

commit 1e2b28a42fa6752d181b69fa655a165195d8e8d6
Author: Thatcher Chamberlin <j.thatcher.c@gmail.com>
Date:   Tue Jan 10 08:03:48 2023 -0500

    Fixed -ar audio rate flag

commit 4b19a367acc4fc6ee47777bbf5560de2fbbf86e7
Author: Thatcher Chamberlin <j.thatcher.c@gmail.com>
Date:   Mon Jan 9 21:50:40 2023 -0500

    Annotated ffmpeg args

commit 363ad5ceffc7580843728cff2ae87450233a473c
Author: Thatcher Chamberlin <j.thatcher.c@gmail.com>
Date:   Mon Jan 9 21:12:21 2023 -0500

    Modified Makefile (system) to auto-build wav files from txt files

    NOTE: this is kind of the opposite of what we want, so the next step
    will be to reverse to order and build txt files from wave files each time
    instead

commit 462a57a3ca2e328f3208c75468f68af4c946d42c
Author: Thatcher Chamberlin <j.thatcher.c@gmail.com>
Date:   Mon Jan 9 20:46:43 2023 -0500

    Added missing quotes

commit 965a4b96d274b1e0b1aeb3fec400a55743765d25
Author: Thatcher Chamberlin <j.thatcher.c@gmail.com>
Date:   Mon Jan 9 20:43:01 2023 -0500

    Updated convert.sh help message

commit ef84de0b949e76e37b81db15da57f924777c30dd
Author: Thatcher Chamberlin <j.thatcher.c@gmail.com>
Date:   Mon Jan 9 20:42:41 2023 -0500

    Added output name to convert.sh
2023-01-29 11:16:07 -05:00
.devcontainer Initial commit for the Development Container config 2023-01-07 15:50:09 +00:00
.github Merge pull request #10 from open-morphs/add-github-action-containers 2023-01-07 13:24:37 +11:00
apps Fixed a typo where 'playback' was sometimes spelled 'palyback' 2023-01-01 13:18:59 -05:00
config Squashed commit of the following: 2023-01-29 11:16:07 -05:00
include/rtos add first commit 2022-08-15 17:20:27 +08:00
platform Update hal_key.h 2022-12-30 22:23:34 +11:00
rtos add first commit 2022-08-15 17:20:27 +08:00
scripts Squashed commit of the following: 2023-01-29 11:16:07 -05:00
services Squashed commit of the following: 2023-01-29 11:16:07 -05:00
tests/anc_usb add first commit 2022-08-15 17:20:27 +08:00
thirdparty Add missing .a files 2022-12-27 10:51:10 +11:00
utils Add missing .a files 2022-12-27 10:51:10 +11:00
.gitignore Initial commit for the Development Container config 2023-01-07 15:50:09 +00:00
Dockerfile Refactor Dockerfile - see description 2023-01-06 19:11:56 +00:00
Makefile add first commit 2022-08-15 17:20:27 +08:00
README.md Spelling changes 2023-01-07 20:41:25 -05:00
backup.sh Added backup.sh script 2023-01-04 20:55:59 -05:00
build.sh Add docker 2022-09-25 18:17:03 +10:00
clear.sh Add docker 2022-09-25 18:17:03 +10:00
convert.sh Squashed commit of the following: 2023-01-29 11:16:07 -05:00
docker-compose.yml Removed the "command: bash" line so that ./start_dev.sh works 2023-01-06 15:02:46 -05:00
download.sh Update README.md 2022-12-30 22:33:47 +11:00
notes.txt upstream 2022-12-27 10:27:11 +11:00
start_dev.sh Add docker build env 2022-09-25 17:55:03 +10:00
uart_log.sh Set execute bits 2022-09-25 17:23:47 +10:00

README.md

PineBuds Open Source SDK

This is just the SDK from the wiki (so far), with dockerfile setup to make building easier, and my reverse engineered bestool integrated. The docker image will build bestool for you first, then drop you into the dev container for building and flashing the buds.

Usage

To use this setup to build & flash your PineBuds you will need a system with docker setup at the minimum. Docker is used to (1) make this all much more reprodicible and easier to debug and (2) so that we dont mess with your host system at all. In order to program the buds from inside of the docker container; privileged mode is used. So do be a tad more careful than usual.


./start_dev.sh # This will cause docker to start your working environment; this should take roughly 1-3 minutes depending on your network speed to the GCC hosting server

# Now you will be inside of the container, and your prompt will look akin to "root@ec5410d0a265:/usr/src#"

./build.sh # This will run make and build the output program. If you have weird build errors try running clean.sh or rm -rf'ing the out folder first

# Now that the firmware has finished building; if there are no errors you can load it to your buds

# You may want to back up the firmware currently on the buds - it will be deleted when the new firmware is loaded on:
./backup.sh

# You may need to take the buds out of the case, wait three seconds, place them back. This wakes them up and the programmer needs to catch this reboot.

# You can try the helper script by running
./download.sh

# Or do it manually by :

# Assuming that your serial ports are 0 and 1, run the following to commands to program each bud in series.
bestool write-image out/open_source/open_source.bin --port /dev/ttyACM0
bestool write-image out/open_source/open_source.bin --port /dev/ttyACM1

Changelist from stock open source SDK

  • Long hold (5 ish seconds) the button on the back when buds are in the case to force a device reboot (so it can be programmed)
  • Use the resistor in the buds to pick Left/Right rather than TWS master/slave pairing
  • Pressing the button on the back while in the case no longer triggers DFU mode
  • Debugging baud rate raised to 2000000 to match stock firmware
  • Fixed TWS operation such that putting either bud into the case correctly switches to the other bud
  • Working (mostly) audio controls using the touch button on the buds
  • Turned off showing up as a HID keyboard, as not sure why you would; but it stops android nagging me about a new keyboard

Current bud tap codes

Both pods active

Right Ear:

  • Single tap : Play/Pause
  • Double tap : Next track
  • Hold : Toggle ANC(Currently non functional, WIP)
  • Triple tap : Volume Up

Left Ear:

  • Single tap : Play/Pause
  • Double tap : Previous track
  • Hold : Toggle ANC(Currently non functional, WIP)
  • Triple tap : Volume Down

Single pod active

  • Single tap : Play/Pause
  • Double tap : Next track
  • Hold : Previous track
  • Triple tap : Volume Up
  • Quad tap : Volume Down

Changing audio alerts

The audio alerts are stored in:

config/_default_cfg_src_/res/en/

You can convert these .txt files to .wav files by using the script convert.sh with the -T flag, the resulting file will be named output.wav. If you want to change the alert to a custom sound use the -W flag on your wav file and then move the resulting SOUND.txt file to the place you want to replace (eg. config/_default_cfg_src_/res/en/SOUND_POWER_ON.txt)