Skip to content

Commit

Permalink
Remove mp_raises because their API changed and it doesn't belong here.
Browse files Browse the repository at this point in the history
  • Loading branch information
tannewt committed Aug 16, 2018
1 parent 1140ff6 commit 4922fb5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
9 changes: 1 addition & 8 deletions samd/events.c
Expand Up @@ -27,7 +27,6 @@
#include <stdint.h>

#include "samd/events.h"
#include "py/runtime.h"

uint8_t find_async_event_channel(void) {
int8_t channel;
Expand All @@ -37,23 +36,17 @@ uint8_t find_async_event_channel(void) {
}
}
if (channel < 0) {
mp_raise_RuntimeError("All event channels in use");
return EVSYS_CHANNELS;
}
return channel;
}

#ifdef SAMD21
#define EVSYS_SYNCH_NUM EVSYS_CHANNELS
#endif
uint8_t find_sync_event_channel(void) {
uint8_t channel;
for (channel = 0; channel < EVSYS_SYNCH_NUM; channel++) {
if (event_channel_free(channel)) {
break;
}
}
if (channel >= EVSYS_SYNCH_NUM) {
mp_raise_RuntimeError("All sync event channels in use");
}
return channel;
}
5 changes: 5 additions & 0 deletions samd/events.h
Expand Up @@ -32,6 +32,11 @@

#include "include/sam.h"


#ifdef SAMD21
#define EVSYS_SYNCH_NUM EVSYS_CHANNELS
#endif

void turn_on_event_system(void);
void reset_event_system(void);
uint8_t find_async_event_channel(void);
Expand Down

0 comments on commit 4922fb5

Please sign in to comment.