aboutsummaryrefslogtreecommitdiff
path: root/include/btsel.h
blob: 9d2c676c9318b31aba3d0c180306e62518c49657 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#pragma once

// Header file for detecting bootsel button presses.

#define PASTER(x, y) x##y
#define CONCAT(x, y) PASTER(x, y)

typedef void (*bootsel_cb_t)(void);
#define On_BootSelPress()                                              \
  static void __local_on_bootsel__(void);                              \
  __attribute__((                                                      \
      __section__(".bootsel_callbacks"))) static volatile bootsel_cb_t \
      __bootsel__position = __local_on_bootsel__;                       \
  static void __local_on_bootsel__()

#undef PASTER
#undef CONCAT

void enable_bootsel_button(void);