forked from Nazrax/DreamMaskV4
-
Notifications
You must be signed in to change notification settings - Fork 0
/
types.h
36 lines (31 loc) · 766 Bytes
/
types.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
35
36
#ifndef _TYPES_H_
#define _TYPES_H_
#include <stdint.h>
typedef enum {false, true} bool_t;
typedef enum { DOWN, UP } button_state_t;
typedef enum { PA, PB, PC, PD } button_port_t;
typedef struct {
unsigned int subseconds:10;
unsigned char seconds:6;
unsigned char minutes:6;
unsigned char hours:5;
uint16_t tseconds;
} myclock_t;
typedef struct
{
unsigned int bit0:1;
unsigned int bit1:1;
unsigned int bit2:1;
unsigned int bit3:1;
unsigned int bit4:1;
unsigned int bit5:1;
unsigned int bit6:1;
unsigned int bit7:1;
} _io_reg;
typedef struct {
uint32_t update_time, down_time; // 64 bits
button_state_t current, old, new; // 16 bits
uint8_t pin; // 8 bits
button_port_t port; // 8 bits
} button_t; // 96 bits / 12 bytes
#endif