Revision 1d5bcc82

View differences:

Makefile
27 27
AMIROLLD_DIR := $(dir $(lastword $(MAKEFILE_LIST)))
28 28

  
29 29
# include paths
30
AMIROLLD_INC = $(AMIROLLD_DIR:/=) \
31
               $(AMIROLLD_DIR)include
32

  
33
AMIROLLD_SRCDIR = $(AMIROLLD_DIR)source
30
AMIROLLD_INC = $(AMIROLLD_DIR) \
31
               $(sort $(dir $(wildcard $(AMIROLLD_DIR)include/?*/)))
34 32

  
35 33
# C sources
36
AMIROLLD_CSRC = $(wildcard $(AMIROLLD_SRCDIR)/*.c)
34
AMIROLLD_CSRC = $(wildcard $(AMIROLLD_DIR)source/*/*/*.c)
37 35

  
include/A3906/alld_A3906.h
1
/*
2
AMiRo-LLD is a compilation of low-level hardware drivers for the Autonomous Mini Robot (AMiRo) platform.
3
Copyright (C) 2016..2019  Thomas Schöpping et al.
4

  
5
This program is free software: you can redistribute it and/or modify
6
it under the terms of the GNU Lesser General Public License as published by
7
the Free Software Foundation, either version 3 of the License, or
8
(at your option) any later version.
9

  
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
GNU Lesser General Public License for more details.
14

  
15
You should have received a copy of the GNU Lesser General Public License
16
along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
*/
18

  
19
/**
20
 * @file    alld_A3906.h
21
 *
22
 * @addtogroup lld_motor
23
 * @{
24
 */
25

  
26
#ifndef AMIROLLD_A3906_H
27
#define AMIROLLD_A3906_H
28

  
29
#include <amiro-lld.h>
30

  
31
#if defined(AMIROLLD_CFG_A3906)
32

  
33
#if (AMIROLLD_CFG_A3906 == 1)
34
  #include "v1/alld_A3906_v1.h"
35
#else
36
  #error "invalid value assigned to AMIROLLD_CFG_A3906 in alldconf.h"
37
#endif
38

  
39
#endif /* defined(AMIROLLD_CFG_A3906) */
40

  
41
#endif /* AMIROLLD_A3906_H */
42

  
43
/** @} */
include/A3906/v1/alld_A3906_v1.h
1
/*
2
AMiRo-LLD is a compilation of low-level hardware drivers for the Autonomous Mini Robot (AMiRo) platform.
3
Copyright (C) 2016..2019  Thomas Schöpping et al.
4

  
5
This program is free software: you can redistribute it and/or modify
6
it under the terms of the GNU Lesser General Public License as published by
7
the Free Software Foundation, either version 3 of the License, or
8
(at your option) any later version.
9

  
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
GNU Lesser General Public License for more details.
14

  
15
You should have received a copy of the GNU Lesser General Public License
16
along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
*/
18

  
19
/**
20
 * @file    alld_A3906_v1.h
21
 * @brief   Motor driver macros and structures.
22
 *
23
 * @addtogroup lld_motor
24
 * @{
25
 */
26

  
27
#ifndef AMIROLLD_A3906_V1_H
28
#define AMIROLLD_A3906_V1_H
29

  
30
#include <amiro-lld.h>
31

  
32
#if (defined(AMIROLLD_CFG_A3906) && (AMIROLLD_CFG_A3906 == 1)) || defined(__DOXYGEN__)
33

  
34
/******************************************************************************/
35
/* CONSTANTS                                                                  */
36
/******************************************************************************/
37

  
38
/**
39
 * @brief Active state of power pin.
40
 */
41
#define A3906_LLD_POWER_PIN_ACTIVE_STATE  APAL_GPIO_ACTIVE_HIGH
42

  
43
/******************************************************************************/
44
/* SETTINGS                                                                   */
45
/******************************************************************************/
46

  
47
/******************************************************************************/
48
/* CHECKS                                                                     */
49
/******************************************************************************/
50

  
51
/******************************************************************************/
52
/* DATA STRUCTURES AND TYPES                                                  */
53
/******************************************************************************/
54

  
55
/**
56
 * @brief A3906 driver struct.
57
 */
58
typedef struct {
59
  const apalControlGpio_t* power_pin;   /**< @brief GPIO to enable/disable power of the A3906. */
60
} A3906Driver;
61

  
62
/**
63
 * @brief Power state of the A3906.
64
 */
65
typedef enum {
66
  A3906_LLD_POWER_OFF = 0x00,   /**< 'power off' state  */
67
  A3906_LLD_POWER_ON  = 0x01,   /**< 'power on' state   */
68
} a3906_lld_power_t;
69

  
70
/******************************************************************************/
71
/* MACROS                                                                     */
72
/******************************************************************************/
73

  
74
/******************************************************************************/
75
/* EXTERN DECLARATIONS                                                        */
76
/******************************************************************************/
77

  
78
#ifdef __cplusplus
79
extern "C" {
80
#endif
81
  apalExitStatus_t a3906_lld_set_power(const A3906Driver* const a3906, const a3906_lld_power_t power_state);
82
  apalExitStatus_t a3906_lld_get_power(const A3906Driver* const a3906, a3906_lld_power_t* const power_state);
83
  apalExitStatus_t a3906_lld_set_pwm(apalPWMDriver_t* pwm, const apalPWMchannel_t channel, const apalPWMwidth_t width);
84
#ifdef __cplusplus
85
}
86
#endif
87

  
88
/******************************************************************************/
89
/* INLINE FUNCTIONS                                                           */
90
/******************************************************************************/
91

  
92
#endif /* defined(AMIROLLD_CFG_USE_A3906) && (AMIROLLD_CFG_USE_A3906 == 1) */
93

  
94
#endif /* AMIROLLD_A3906_V1_H */
95

  
96
/** @} */
include/AT24C01B/alld_AT24C01B.h
1
/*
2
AMiRo-LLD is a compilation of low-level hardware drivers for the Autonomous Mini Robot (AMiRo) platform.
3
Copyright (C) 2016..2019  Thomas Schöpping et al.
4

  
5
This program is free software: you can redistribute it and/or modify
6
it under the terms of the GNU Lesser General Public License as published by
7
the Free Software Foundation, either version 3 of the License, or
8
(at your option) any later version.
9

  
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
GNU Lesser General Public License for more details.
14

  
15
You should have received a copy of the GNU Lesser General Public License
16
along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
*/
18

  
19
/**
20
 * @file    alld_AT24C01B.h
21
 *
22
 * @addtogroup lld_eeprom
23
 * @{
24
 */
25

  
26
#ifndef AMIROLLD_AT24C01B_H
27
#define AMIROLLD_AT24C01B_H
28

  
29
#include <amiro-lld.h>
30

  
31
#if defined(AMIROLLD_CFG_AT24C01B)
32

  
33
#if (AMIROLLD_CFG_AT24C01B == 1)
34
  #include "v1/alld_AT24C01B_v1.h"
35
#else
36
  #error "invalid value assigned to AMIROLLD_CFG_AT24C01B in alldconf.h"
37
#endif
38

  
39
#endif /* defined(AMIROLLD_CFG_AT24C01B) */
40

  
41
#endif /* AMIROLLD_AT24C01B_H */
42

  
43
/** @} */
include/AT24C01B/v1/alld_AT24C01B_v1.h
1
/*
2
AMiRo-LLD is a compilation of low-level hardware drivers for the Autonomous Mini Robot (AMiRo) platform.
3
Copyright (C) 2016..2019  Thomas Schöpping et al.
4

  
5
This program is free software: you can redistribute it and/or modify
6
it under the terms of the GNU Lesser General Public License as published by
7
the Free Software Foundation, either version 3 of the License, or
8
(at your option) any later version.
9

  
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
GNU Lesser General Public License for more details.
14

  
15
You should have received a copy of the GNU Lesser General Public License
16
along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
*/
18

  
19
/**
20
 * @file    alld_AT24C01B_v1.h
21
 * @brief   EEPROM macros and structures.
22
 *
23
 * @addtogroup lld_eeprom
24
 * @{
25
 */
26

  
27
#ifndef AMIROLLD_AT24C01B_V1_H
28
#define AMIROLLD_AT24C01B_V1_H
29

  
30
#include <amiro-lld.h>
31

  
32
#if (defined(AMIROLLD_CFG_AT24C01B) && (AMIROLLD_CFG_AT24C01B == 1)) || defined(__DOXYGEN__)
33

  
34
/******************************************************************************/
35
/* CONSTANTS                                                                  */
36
/******************************************************************************/
37

  
38
/**
39
 * @brief Memory size of the EEPROM in bits.
40
 */
41
#define AT24C01B_LLD_SIZE_BITS              1024
42

  
43
/**
44
 * @brief Memory size of the EEPROM in bytes
45
 */
46
#define AT24C01B_LLD_SIZE_BYTES             128
47

  
48

  
49
/**
50
 * @brief Size of a page in bytes
51
 */
52
#define AT24C01B_LLD_PAGE_SIZE_BYTES        8
53

  
54
/**
55
 * @brief  Time in microseconds a write operation takes to complete (I2C will not respond).
56
 * @note   The system should wait slightly longer.
57
 */
58
#define AT24C01B_LLD_WRITECYCLETIME_US      5000
59

  
60
/**
61
 * @brief Maximum I2C frequency.
62
 */
63
#define AT24C01B_LLD_I2C_MAXFREQUENCY       400000
64

  
65
/**
66
 * @brief Maximum I2C frequency at 5V.
67
 */
68
#define AT24C01B_LLD_I2C_MAXFREQUENCY_5V    1000000
69

  
70

  
71
/******************************************************************************/
72
/* SETTINGS                                                                   */
73
/******************************************************************************/
74

  
75
/******************************************************************************/
76
/* CHECKS                                                                     */
77
/******************************************************************************/
78

  
79
/******************************************************************************/
80
/* DATA STRUCTURES AND TYPES                                                  */
81
/******************************************************************************/
82

  
83
/**
84
 * @brief The AT24C01B driver struct
85
 */
86
typedef struct {
87
  apalI2CDriver_t* i2cd;  /**< @brief The I2C Driver */
88
  apalI2Caddr_t addr;     /**< @brief The address of the AT24C01B for I2C communication, which is defined by the wiring of the A0, A1, A2 pins */
89
} AT24C01BDriver;
90

  
91
/**
92
 * @brief Bitmasks for the I2C address, including the wiring of the A0, A1, A2 pins.
93
 */
94
enum {
95
  AT24C01B_LLD_I2C_ADDR_FIXED       = 0x0050u,
96
  AT24C01B_LLD_I2C_ADDR_A0          = 0x0001u,
97
  AT24C01B_LLD_I2C_ADDR_A1          = 0x0002u,
98
  AT24C01B_LLD_I2C_ADDR_A2          = 0x0004u,
99
};
100

  
101
/******************************************************************************/
102
/* MACROS                                                                     */
103
/******************************************************************************/
104

  
105
/******************************************************************************/
106
/* EXTERN DECLARATIONS                                                        */
107
/******************************************************************************/
108

  
109
#ifdef __cplusplus
110
extern "C" {
111
#endif
112
  apalExitStatus_t at24c01b_lld_poll_ack(const AT24C01BDriver* const at24c01b, const apalTime_t timeout);
113
  apalExitStatus_t at24c01b_lld_read_current_address(const AT24C01BDriver* const at24c01b, uint8_t* const data, const uint8_t num, const apalTime_t timeout);
114
  apalExitStatus_t at24c01b_lld_read(const AT24C01BDriver* const at24c01b, const uint8_t addr, uint8_t* const data, const uint8_t num, const apalTime_t timeout);
115
  apalExitStatus_t at24c01b_lld_write_byte(const AT24C01BDriver* const at24c01b, const uint8_t addr, const uint8_t data, const apalTime_t timeout);
116
  apalExitStatus_t at24c01b_lld_write_page(const AT24C01BDriver* const at24c01b, const uint8_t addr, const uint8_t* const data, const uint8_t num, const apalTime_t timeout);
117
#ifdef __cplusplus
118
}
119
#endif
120

  
121
/******************************************************************************/
122
/* INLINE FUNCTIONS                                                           */
123
/******************************************************************************/
124

  
125
#endif /* defined(AMIROLLD_CFG_AT24C01B) && (AMIROLLD_CFG_AT24C01B == 1) */
126

  
127
#endif /* AMIROLLD_AT24C01BN_V1_H */
128

  
129
/** @} */
include/AT42QT1050/alld_AT42QT1050.h
1
/*
2
AMiRo-LLD is a compilation of low-level hardware drivers for the Autonomous Mini Robot (AMiRo) platform.
3
Copyright (C) 2016..2019  Thomas Schöpping et al.
4

  
5
This program is free software: you can redistribute it and/or modify
6
it under the terms of the GNU Lesser General Public License as published by
7
the Free Software Foundation, either version 3 of the License, or
8
(at your option) any later version.
9

  
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
GNU Lesser General Public License for more details.
14

  
15
You should have received a copy of the GNU Lesser General Public License
16
along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
*/
18

  
19
/**
20
 * @file    alld_AT42QT1050.h
21
 *
22
 * @addtogroup lld_touch
23
 * @{
24
 */
25

  
26
#ifndef AMIROLLD_AT42QT1050_H
27
#define AMIROLLD_AT42QT1050_H
28

  
29
#include <amiro-lld.h>
30

  
31
#if defined(AMIROLLD_CFG_AT42QT1050)
32

  
33
#if (AMIROLLD_CFG_AT42QT1050 == 1)
34
  #include "v1/alld_AT42QT1050_v1.h"
35
#else
36
  #error "invalid value assigned to AMIROLLD_CFG_AT42QT1050 in alldconf.h"
37
#endif
38

  
39
#endif /* defined(AMIROLLD_CFG_AT42QT1050) */
40

  
41
#endif /* AMIROLLD_AT42QT1050_H */
42

  
43
/** @} */
include/AT42QT1050/v1/alld_AT42QT1050_v1.h
1
/*
2
AMiRo-LLD is a compilation of low-level hardware drivers for the Autonomous Mini Robot (AMiRo) platform.
3
Copyright (C) 2016..2019  Thomas Schöpping et al.
4

  
5
This program is free software: you can redistribute it and/or modify
6
it under the terms of the GNU Lesser General Public License as published by
7
the Free Software Foundation, either version 3 of the License, or
8
(at your option) any later version.
9

  
10
This program is distributed in the hope that it will be useful,
11
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
GNU Lesser General Public License for more details.
14

  
15
You should have received a copy of the GNU Lesser General Public License
16
along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
*/
18

  
19
/**
20
 * @file    alld_AT42QT1050_v1.h
21
 * @brief   Touch sensor macros and structures.
22
 *
23
 * @addtogroup lld_touch
24
 * @{
25
 */
26

  
27
#ifndef AMIROLLD_AT42QT1050_V1_H
28
#define AMIROLLD_AT42QT1050_V1_H
29

  
30
#include <amiro-lld.h>
31

  
32
#if (defined(AMIROLLD_CFG_AT42QT1050) && (AMIROLLD_CFG_AT42QT1050 == 1)) || defined(__DOXYGEN__)
33

  
34
/******************************************************************************/
35
/* CONSTANTS                                                                  */
36
/******************************************************************************/
37

  
38
/**
39
 * @brief   Maximum I2C frequency.
40
 */
41
#define AT42QT1050_LLD_I2C_MAXFREQUENCY         400000
42

  
43
/**
44
 * @brief   A falling edge indicats an interrupt.
45
 */
46
#define AT42QT1050_LLD_INT_EDGE                 APAL_GPIO_EDGE_FALLING
47

  
48
/**
49
 * @brief   Number of touch keys supported by AT42QT1050.
50
 */
51
#define AT42QT1050_LLD_NUM_KEYS                 5
52

  
53
/**
54
 * @brief   Maximum time (in microseconds) to acquire all key signals before the overflow bit of the detection status register is set.
55
 */
56
#define AT42QT1050_LLD_MAX_KEY_ACQUIRATION_TIME 8000
57

  
58
/**
59
 * @brief   The chip ID as can be read from the according register (constant).
60
 */
61
#define AT42QT1050_LLD_CHIPID                   0x46
62

  
63
/******************************************************************************/
64
/* SETTINGS                                                                   */
65
/******************************************************************************/
66

  
67
/******************************************************************************/
68
/* CHECKS                                                                     */
69
/******************************************************************************/
70

  
71
/******************************************************************************/
72
/* DATA STRUCTURES AND TYPES                                                  */
73
/******************************************************************************/
74

  
75
/**
76
 * @brief   The AT42QT1050Driver sruct.
77
 */
78
typedef struct {
79
  apalI2CDriver_t* i2cd;
80
  apalI2Caddr_t addr;
81
} AT42QT1050Driver;
82

  
83
/**
84
 * @brief   Possible I2C address configurations.
85
 */
86
enum {
87
  AT42QT1050_LLD_I2C_ADDRSEL_LOW  = 0x0041u,  /**< ADDR_SEL pin is pulled low. */
88
  AT42QT1050_LLD_I2C_ADDRSEL_HIGH = 0x0046u,  /**< ADDR_SEL pin is pulled high. */
89
};
90

  
91
/**
92
 * @brief   Available register addresses of the AT42Q1050.
93
 */
94
typedef enum {