Skip to content
Snippets Groups Projects
Commit 85ce625a authored by schneider's avatar schneider
Browse files

fix(api): code style

parent 9a909b40
No related branches found
No related tags found
No related merge requests found
Pipeline #1308 passed
......@@ -3,8 +3,10 @@
#include "api/common.h"
#include "epicardium.h"
void api_interrupt_handler_ctrl_c (api_int_id_t id) __attribute__ ((weak, alias("api_interrupt_handler_default")));
void api_interrupt_handler_bhi160 (api_int_id_t id) __attribute__ ((weak, alias("api_interrupt_handler_default")));
void api_interrupt_handler_ctrl_c(api_int_id_t id)
__attribute__((weak, alias("api_interrupt_handler_default")));
void api_interrupt_handler_bhi160(api_int_id_t id)
__attribute__((weak, alias("api_interrupt_handler_default")));
/* Timer Interrupt used for control char notification */
void TMR5_IRQHandler(void)
......@@ -23,8 +25,7 @@ void TMR5_IRQHandler(void)
API_CALL_MEM->int_id = 0;
}
__attribute__((weak))
void api_interrupt_handler_catch_all(api_int_id_t id)
__attribute__((weak)) void api_interrupt_handler_catch_all(api_int_id_t id)
{
}
......@@ -32,4 +33,3 @@ void api_interrupt_handler_default(api_int_id_t id)
{
api_interrupt_handler_catch_all(id);
}
......@@ -8,7 +8,8 @@ void api_interrupt_trigger(api_int_id_t id)
{
if (id <= API_INT_MAX) {
if (enabled[id]) {
while(API_CALL_MEM->int_id);
while (API_CALL_MEM->int_id)
;
API_CALL_MEM->int_id = id;
TMR_TO_Start(MXC_TMR5, 1, 0);
}
......
......@@ -2,6 +2,7 @@
#define _EPICARDIUM_H
#include <stdint.h>
/* clang-format off */
#define API_INT_CTRL_C 1
#define API_INT_BHI160 2
#define API_INT_MAX API_INT_BHI160
......@@ -10,7 +11,6 @@
#define API(id, def) def
#endif
/* clang-format off */
#define API_UART_WRITE 0x1
#define API_UART_READ 0x2
#define API_LEDS_SET 0x3
......
......@@ -13,7 +13,6 @@
#include "epicardium.h"
#include "api/interrupt-sender.h"
/* Task ID for the serial handler */
TaskHandle_t serial_task_id = NULL;
......
......@@ -20,7 +20,9 @@ void api_interrupt_handler_catch_all(api_int_id_t id)
// TODO: iterate over registered callbacks
if (id == API_INT_BHI160) {
if (bhi160_callback) {
mp_sched_schedule(bhi160_callback, MP_OBJ_NEW_SMALL_INT(0));
mp_sched_schedule(
bhi160_callback, MP_OBJ_NEW_SMALL_INT(0)
);
}
}
}
......@@ -41,8 +43,12 @@ STATIC mp_obj_t mp_interrupt_enable_callback(mp_obj_t id_in)
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_2(interrupt_set_callback_obj, mp_interrupt_set_callback);
STATIC MP_DEFINE_CONST_FUN_OBJ_1(interrupt_enable_callback_obj, mp_interrupt_enable_callback);
STATIC MP_DEFINE_CONST_FUN_OBJ_2(
interrupt_set_callback_obj, mp_interrupt_set_callback
);
STATIC MP_DEFINE_CONST_FUN_OBJ_1(
interrupt_enable_callback_obj, mp_interrupt_enable_callback
);
STATIC const mp_rom_map_elem_t interrupt_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_interrupt) },
......@@ -50,7 +56,9 @@ STATIC const mp_rom_map_elem_t interrupt_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_enable_callback), MP_ROM_PTR(&interrupt_enable_callback_obj) },
{ MP_ROM_QSTR(MP_QSTR_BHI160), MP_OBJ_NEW_SMALL_INT(2) },
};
STATIC MP_DEFINE_CONST_DICT(interrupt_module_globals, interrupt_module_globals_table);
STATIC MP_DEFINE_CONST_DICT(
interrupt_module_globals, interrupt_module_globals_table
);
// Define module object.
const mp_obj_module_t interrupt_module = {
......@@ -58,5 +66,6 @@ const mp_obj_module_t interrupt_module = {
.globals = (mp_obj_dict_t *)&interrupt_module_globals,
};
/* clang-format off */
// Register the module to make it available in Python
MP_REGISTER_MODULE(MP_QSTR_interrupt, interrupt_module, MODULE_INTERRUPT_ENABLED);
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment