Skip to content

Commit ac2cffe

Browse files
committed
cmake support
1 parent bd33b74 commit ac2cffe

File tree

7 files changed

+45
-6
lines changed

7 files changed

+45
-6
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
debug*
2-
.vscode/
2+
.vscode/
3+
build/

CMakeLists.txt

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
cmake_minimum_required(VERSION 3.16)
2+
3+
# set the project name
4+
project(audio_driver)
5+
6+
# lots of warnings and all warnings as errors
7+
## add_compile_options(-Wall -Wextra )
8+
set(CMAKE_CXX_STANDARD 17)
9+
10+
file(GLOB_RECURSE SRC_LIST_C CONFIGURE_DEPENDS "${PROJECT_SOURCE_DIR}/src/*.c" )
11+
12+
# define libraries
13+
add_library (audio_driver ${SRC_LIST_C})
14+
15+
# prevent compile errors
16+
target_compile_options(audio_driver PRIVATE -DUSE_DEFAULT_STDLIB)
17+
18+
# define location for header files
19+
target_include_directories(audio_driver PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_SOURCE_DIR}/src/libhelix-mp3 ${CMAKE_CURRENT_SOURCE_DIR}/src/libhelix-aac )
20+

README.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

44
I was never quite happy with my [AudioKit project](https://github.com/pschatzmann/arduino-audiokit), that was a quick and dirty adaptation of the Espressif IDF Drivers for Arduino.
55

6-
In this project I finally implemented some clean and simple C++ classes. This reduced the complexity considerably and increased the flexibility tremendously!
6+
In this project I finally implemented some clean and simple C++ classes. This __reduced the complexity__ considerably and __increased the flexibility__ tremendously!
77

8-
The goal of this project is to provide an easy API to configure different audio codec chips. After setting up the codec, you can use the I2S functionality provided by your microcontroller.
8+
The goal of this project is to provide an __easy API to configure different audio codec chips__. After setting up the codec, you can use the I2S functionality provided by your microcontroller.
99

1010
Supported audio codec chips are e.g
1111

@@ -52,6 +52,8 @@ git clone https://github.com/pschatzmann/arduino-audio-driver.git
5252
5353
```
5454

55+
I recommend to use git because you can easily update to the latest version just by executing the git pull command in the project folder.
56+
5557

5658

5759

src/Driver/es7243/es7243.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#include <string.h>
2626
#include "es7243.h"
2727
#include "Utils/etc.h"
28-
#include "Arduino.h"
28+
#include "Utils/etc.h"
2929

3030
#define MCLK_PULSES_NUMBER (20)
3131
#define ES_ASSERT(a, format, b, ...) \

src/Driver/tas5805m/tas5805m.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#include <stdint.h>
2626
#include "tas5805m.h"
2727
#include "tas5805m_reg_cfg.h"
28-
#include "Arduino.h"
28+
#include "Utils/etc.h"
2929

3030
#define TAS5805M_ADDR 0x5c
3131
//#define TAS5805M_RST_GPIO get_pa_enable_gpio()

src/Utils/etc.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
#include "Arduino.h"
21
#include "etc.h"
32

43
void arduino_pin_mode(int pin, int mode){

src/Utils/etc.h

+17
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,26 @@
11
#pragma once
22

3+
#ifdef ARDUINO
4+
# include "Arduino.h"
5+
#else
6+
7+
#define HIGH 0x1
8+
#define LOW 0x0
9+
10+
#define INPUT 0x0
11+
#define OUTPUT 0x1
12+
#define INPUT_PULLUP 0x2
13+
void pinMode(int, int);
14+
void digitalWrite(int, int);
15+
void delay(uint32_t);
16+
#endif
17+
318
#ifdef __cplusplus
419
extern "C" {
520
#endif
621

22+
23+
724
// pinMode gives linker error if called from c for Nano BLE Sense
825
void arduino_pin_mode(int pin, int mode);
926

0 commit comments

Comments
 (0)