From eb73b7edb80c59e7ca6477d933730d7553490ab6 Mon Sep 17 00:00:00 2001 From: Julian T Date: Tue, 15 Oct 2019 12:05:13 +0200 Subject: =?UTF-8?q?Tilf=C3=B8jede=20ting?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sem1/osc/mm8/mm8.ino | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 sem1/osc/mm8/mm8.ino (limited to 'sem1/osc/mm8') diff --git a/sem1/osc/mm8/mm8.ino b/sem1/osc/mm8/mm8.ino new file mode 100644 index 0000000..f47306d --- /dev/null +++ b/sem1/osc/mm8/mm8.ino @@ -0,0 +1,47 @@ +// Spg kernel +#include + +#define PRIO 10 +#define STACK 100 + +char stackFast[STACK]; +struct k_t *semFast, *fastTask; + +void fast() { + /* Gotta go fast(10 Hz) */ + k_set_sem_timer(semFast, 1000); + for(;;) { + k_wait(semFast, 0); + k_eat_ticks(90); + } +} + +void setup() { + pinMode(13, OUTPUT); + + PORTB |= 0x20; + delay(1000); + PORTB &= 0xDF; + delay(200); + + k_init(1, 1, 0); + + fastTask = k_crt_task(fast, PRIO, stackFast, STACK); + semFast = k_crt_sem(0, 2); + + k_start(1); + PORTB |= 0x20; +} + +void loop() {} + +extern "C" { + + void k_breakout() { + if( pRun->nr == 0 ) { + PORTB |= 0x20; + } else { + PORTB &= 0xDF; + } + } +} -- cgit v1.2.3