aboutsummaryrefslogtreecommitdiff
path: root/src/kern/main.c
blob: 208f5d9aba4bb5a3521687009e0572a261ff01da (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#include "arch.h"
#include "arch/arm/cortex-m4/mpu.h"
#include "arch/stm32l4xxx/peripherals/clock.h"
#include "arch/stm32l4xxx/peripherals/dma.h"
#include "arch/stm32l4xxx/peripherals/exti.h"
#include "arch/stm32l4xxx/peripherals/irq.h"
#include "arch/stm32l4xxx/peripherals/rcc.h"
#include "arch/stm32l4xxx/peripherals/spi.h"
#include "arch/stm32l4xxx/peripherals/syscfg.h"
#include "arch/stm32l4xxx/peripherals/system.h"
#include "arch/stm32l4xxx/peripherals/tim.h"
#include "drv/ir/control.h"
#include "drv/ir/ir.h"
#include "drv/ir/lg_remote_codes.h"
#include "drv/ws2812B/ws2812b.h"
#include "kern/delay.h"
#include "kern/dma/dma_manager.h"
#include "kern/gpio/gpio_manager.h"
#include "kern/gpio/sysled.h"
#include "kern/init.h"
#include "kern/log.h"
#include "kern/mem.h"
#include "kern/mpu/mpu_manager.h"
#include "kern/panic.h"
#include "kern/priv.h"
#include "kern/spi/spi_manager.h"
#include "kern/systick/systick_manager.h"
#include "user/syscall.h"
#include <assert.h>

void on_hard_fault()
{
  panic("Hard fault encountered!\n");
}

#ifdef ARCH_STM32L4

void printit(uint32_t code, const char* str)
{
  (void)code;
  klogf("%s\n", str);
}

/* Main function. This gets executed from the interrupt vector defined above. */
int main()
{
  klogf("Ir begin listening\n");
  ir_begin_listen();
  enable_ir_control();

  add_ir_code_callback(RC_HIGH, printit, "RC_HIGH");
  add_ir_code_callback(RC_TEMP_UP, printit, "RC_TEMP_UP");
  add_ir_code_callback(RC_DRY, printit, "RC_DRY");
  add_ir_code_callback(RC_LOW, printit, "RC_LOW");
  add_ir_code_callback(RC_TEMP_DOWN, printit, "RC_TEMP_DOWN");
  add_ir_code_callback(RC_COOL, printit, "RC_COOL");
  add_ir_code_callback(RC_CONTINUOUS, printit, "RC_CONTINUOUS");
  add_ir_code_callback(RC_FAN, printit, "RC_FAN");
  add_ir_code_callback(RC_SLEEP, printit, "RC_SLEEP");
  add_ir_code_callback(RC_UNITS, printit, "RC_UNITS");
  add_ir_code_callback(RC_TIMER, printit, "RC_TIMER");
  add_ir_code_callback(RC_POWER, printit, "RC_POWER");

  for (;;)
    ;
}

#endif