HWA
Bare metal programming with style
ctd_1.h
Go to the documentation of this file.
1 
2 /* This file is part of the HWA project.
3  * Copyright (c) 2012,2015 Christophe Duparquet.
4  * All rights reserved. Read LICENSE.TXT for details.
5  */
6 
34 #define hw_class__ctd
35 
36 #define HW_BITS__ctd , _hw_bits_ctd
37 #define _hw_bits_ctd(...) 16
38 
39 /* Return the counting register of a _ctd
40  */
41 #define hw__ctd_reg , _hw_ctd_reg
42 #define _hw_ctd_reg(o,a) HW_XOR(o,count) /* HW_CODR is blued */
43 
44 
45 #ifndef __ASSEMBLER__
46 
47 typedef struct {
48 
49  /* Hardware registers
50  */
51  hwa_r8_t ccra ;
52  hwa_r8_t ccrb ;
53  hwa_r16_t ocr0 ;
54  hwa_r16_t ocr1 ;
55  hwa_r16_t icr0 ; /* can store top count value */
56  hwa_r8_t ccrc ;
57  hwa_r16_t count ;
58  hwa_r8_t imsk ;
59  hwa_r8_t ifr ;
60 
61  /* Registers used for high-level configuration
62  */
63  struct {
64  uint8_t clock, direction, top, overflow ;
65  } config ;
66 
67  /* Registers used for configuration resolution
68  */
69  struct {
70  uint8_t cs, wgm ;
71  } solved ;
72 
73  hwa_occ_t compare0 ;
74  hwa_occ_t compare1 ;
75  hwa_ica_t capture0 ;
76 
77 } hwa_ctd_t ;
78 
79 #endif