forked from unfrozen/stm8_libs
-
Notifications
You must be signed in to change notification settings - Fork 2
/
lib_pins.h
34 lines (30 loc) · 776 Bytes
/
lib_pins.h
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
/*
* File name: lib_pins.h
* Date first: 11/04/2018
* Date last: 11/14/2018
*
* Description: STM8 Library to simplify pin usage.
*
* Author: Richard Hodges
*
* Copyright (C) 2018 Richard Hodges. All rights reserved.
* Permission is hereby granted for any use.
*
******************************************************************************
*
* Structured pin definition
*/
typedef struct {
volatile char *reg_base; /* port ODR register */
char reg_mask; /* bit to use */
} IO_PIN;
/* Define one pin and a callback function */
typedef struct {
IO_PIN *pin;
void (*callback)(void);
} IO_CALL;
/* Define one pin and a callback function that gets int */
typedef struct {
IO_PIN *pin;
void (*callback)(int);
} IO_CALL_INT;