summaryrefslogtreecommitdiff
path: root/code/main/teensy_player
diff options
context:
space:
mode:
Diffstat (limited to 'code/main/teensy_player')
-rw-r--r--code/main/teensy_player/player.yaml46
-rw-r--r--code/main/teensy_player/prj.conf1
-rw-r--r--code/main/teensy_player/src/main.c30
3 files changed, 16 insertions, 61 deletions
diff --git a/code/main/teensy_player/player.yaml b/code/main/teensy_player/player.yaml
deleted file mode 100644
index df8f963..0000000
--- a/code/main/teensy_player/player.yaml
+++ /dev/null
@@ -1,46 +0,0 @@
-sample:
- name: Blinky Sample
-tests:
- sample.basic.blinky:
- tags:
- - LED
- - gpio
- filter: dt_enabled_alias_with_parent_compat("led0", "gpio-leds")
- depends_on: gpio
- harness: led
- integration_platforms:
- - frdm_k64f
-
-manifest:
- remotes:
- # short names for project URLs
- projects:
- # a list of projects managed by west
- defaults:
- # default project attributes
- self:
- # configuration related to the manifest repository itself,
- # i.e. the repository containing west.yml
- version: "<schema-version>"
- group-filter:
- # a list of project groups to enable or disable
- remotes:
- - name: remote1
- url-base: https://git.example.com/base1
- - name: remote2
- url-base: https://git.example.com/base2
- projects:
- - name: proj1
- description: the first example project
- remote: remote1
- path: extra/project-1
- - name: proj2
- description: |
- A multi-line description of the second example
- project.
- repo-path: my-path
- remote: remote2
- revision: v1.3
- - name: proj3
- url: https://github.com/user/project-three
- revision: abcde413a111
diff --git a/code/main/teensy_player/prj.conf b/code/main/teensy_player/prj.conf
index 456b0fc..db01a00 100644
--- a/code/main/teensy_player/prj.conf
+++ b/code/main/teensy_player/prj.conf
@@ -3,3 +3,4 @@ CONFIG_USB_DEVICE_INITIALIZE_AT_BOOT=y
CONFIG_PRINTK=y
CONFIG_SERIAL=y
CONFIG_UART_INTERRUPT_DRIVEN=y
+CONFIG_PWM=y
diff --git a/code/main/teensy_player/src/main.c b/code/main/teensy_player/src/main.c
index 5b04ac2..3f84f88 100644
--- a/code/main/teensy_player/src/main.c
+++ b/code/main/teensy_player/src/main.c
@@ -7,8 +7,10 @@
#include <zephyr/drivers/pwm.h>
#include <string.h>
-/* size of stack area used by each thread */
-#define GEN_THRESD_STACKSIZE 1024
+/* Stack sizes (now only one size)*/
+/* To figure out how much is necessary: */
+/* https://zephyr-docs.listenai.com/guides/debug_tools/thread-analyzer.html */
+#define GENERAL_THREAD_STACKSIZE 1024
/*the pinout configuration*/
/*https://docs.zephyrproject.org/latest/boards/pjrc/teensy4/doc/index.html*/
@@ -18,23 +20,21 @@
#define m1pwm1 DT_ALIAS(GPIO4_6) /*pin 4*/
#define m1pwm2 DT_ALIAS(GPIO4_5) /*pin 3*/
/*encoder pins*/
-#define m1encoA 32 /*pin 32*//*encoder number 1*/
-#define Nm1encoA INT_TO_POINTER(0) /*gives encoder number N*/
-#define m1encoB 31 /*pin 31*//*encoder number 2*/
-#define Nm1encoB INT_TO_POINTER(1) /*gives encoder number N*/
-
+#define m1encoA 32 /*pin 32 && encoder number 0*/
+#define Nm1encoA INT_TO_POINTER(0)
+#define m1encoB 31 /*pin 31 && encoder number 1*/
+#define Nm1encoB INT_TO_POINTER(1)
/*set priorities*/
-#define ENC_ISR_PRIO 1 /* set encoder interrupt service routine*/
-
+#define ENC_ISR_PRIO 1
-/*variables*/
/*encoders/PWM/PID*/
#define NUM_ENCODERS 2 /*how many encoder pins there are*/
-volatile int encCount[NUM_ENCODERS] = {0}; /*sets all encoder counts to 0 changes of state*/
+volatile int encCount[NUM_ENCODERS] = {0};
/*misc*/
-#define MY_IRQ_FLAGS 0 /*no IRQ flags*/
+#define NO_IRQ_FLAGS 0
+#define PWM_PERIOD_µS 1600 /*The lengt of an full PWM cycle in microseconds*/
void ENCO_ISR(void *encN){
/*adds one to the encoder where a change of state is detected*/
@@ -46,9 +46,9 @@ void ENCO_ISR(void *encN){
}
void ENC_ISR_installer(void){
- /*sets up the interupts for the encoder at same priority, need to configure FIFO in case of simultaneous call*/
- IRQ_CONNECT(m1encoA, ENC_ISR_PRIO, ENCO_ISR, '0', MY_IRQ_FLAGS);
- IRQ_CONNECT(m1encoB, ENC_ISR_PRIO, ENCO_ISR, '1', MY_IRQ_FLAGS);
+ /*sets up the interrupts for the encoder at same priority, need to configure FIFO in case of simultaneous call*/
+ IRQ_CONNECT(m1encoA, ENC_ISR_PRIO, ENCO_ISR, '0', NO_IRQ_FLAGS);
+ IRQ_CONNECT(m1encoB, ENC_ISR_PRIO, ENCO_ISR, '1', NO_IRQ_FLAGS);
}
int main(void){}