Skip to content

Commit e461608

Browse files
committed
cpu/atmega*: changes for new GPIO API
1 parent 9024fba commit e461608

17 files changed

Lines changed: 245 additions & 162 deletions

File tree

cpu/atmega1281/include/periph_cpu.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ enum {
4040
PORT_E = 4, /**< port E */
4141
PORT_F = 5, /**< port F */
4242
PORT_G = 6, /**< port G */
43+
GPIO_EXP_PORT = 7 /**< first GPIO expander port */
4344
};
4445

4546
/**

cpu/atmega1284p/include/periph_cpu.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,15 @@
2929
extern "C" {
3030
#endif
3131

32-
/**
33-
* @brief Define a CPU specific GPIO pin generator macro
34-
*/
35-
#define GPIO_PIN(x, y) ((x << 4) | y)
36-
3732
/**
3833
* @brief Available ports on the ATmega1284p family
3934
*/
4035
enum {
4136
PORT_A = 0, /**< port A */
4237
PORT_B = 1, /**< port B */
4338
PORT_C = 2, /**< port C */
44-
PORT_D = 3 /**< port D */
39+
PORT_D = 3, /**< port D */
40+
GPIO_EXP_PORT = 4 /**< first GPIO expander port */
4541
};
4642

4743
/**

cpu/atmega128rfa1/include/periph_cpu.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,12 @@ extern "C" {
3232
* @{
3333
*/
3434
enum {
35-
PORT_B = 1, /**< port B */
36-
PORT_D = 3, /**< port D */
37-
PORT_E = 4, /**< port E */
38-
PORT_F = 5, /**< port F */
39-
PORT_G = 6, /**< port G */
35+
PORT_B = 1, /**< port B */
36+
PORT_D = 3, /**< port D */
37+
PORT_E = 4, /**< port E */
38+
PORT_F = 5, /**< port F */
39+
PORT_G = 6, /**< port G */
40+
GPIO_EXP_PORT = 7 /**< first GPIO expander port */
4041
};
4142
/** @} */
4243

cpu/atmega2560/include/periph_cpu.h

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,18 @@ extern "C" {
3131
* @brief Available ports on the ATmega2560 family
3232
*/
3333
enum {
34-
PORT_A = 0, /**< port A */
35-
PORT_B = 1, /**< port B */
36-
PORT_C = 2, /**< port C */
37-
PORT_D = 3, /**< port D */
38-
PORT_E = 4, /**< port E */
39-
PORT_F = 5, /**< port F */
40-
PORT_G = 6, /**< port G */
41-
PORT_H = 7, /**< port H */
42-
PORT_J = 8, /**< port J */
43-
PORT_K = 9, /**< port K */
44-
PORT_L = 10 /**< port L */
34+
PORT_A = 0, /**< port A */
35+
PORT_B = 1, /**< port B */
36+
PORT_C = 2, /**< port C */
37+
PORT_D = 3, /**< port D */
38+
PORT_E = 4, /**< port E */
39+
PORT_F = 5, /**< port F */
40+
PORT_G = 6, /**< port G */
41+
PORT_H = 7, /**< port H */
42+
PORT_J = 8, /**< port J */
43+
PORT_K = 9, /**< port K */
44+
PORT_L = 10, /**< port L */
45+
GPIO_EXP_PORT = 11 /**< first GPIO expander port */
4546
};
4647

4748
/**

cpu/atmega256rfr2/include/periph_cpu.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,12 @@ extern "C" {
3232
* @{
3333
*/
3434
enum {
35-
PORT_B = 1, /**< port B */
36-
PORT_D = 3, /**< port D */
37-
PORT_E = 4, /**< port E */
38-
PORT_F = 5, /**< port F */
39-
PORT_G = 6, /**< port G */
35+
PORT_B = 1, /**< port B */
36+
PORT_D = 3, /**< port D */
37+
PORT_E = 4, /**< port E */
38+
PORT_F = 5, /**< port F */
39+
PORT_G = 6, /**< port G */
40+
GPIO_EXP_PORT = 7 /**< first GPIO expander port */
4041
};
4142
/** @} */
4243

cpu/atmega328p/include/periph_cpu.h

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,14 @@
2727
extern "C" {
2828
#endif
2929

30-
/**
31-
* @brief Define a CPU specific GPIO pin generator macro
32-
*/
33-
#define GPIO_PIN(x, y) ((x << 4) | y)
34-
3530
/**
3631
* @brief Available ports on the ATmega328p family
3732
*/
3833
enum {
3934
PORT_B = 1, /**< port B */
4035
PORT_C = 2, /**< port C */
41-
PORT_D = 3 /**< port D */
36+
PORT_D = 3, /**< port D */
37+
GPIO_EXP_PORT = 4 /**< first GPIO expander port */
4238
};
4339

4440
/**

cpu/atmega32u4/include/periph_cpu.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ enum {
3434
PORT_C = 2, /**< port C */
3535
PORT_D = 3, /**< port D */
3636
PORT_E = 4, /**< port E */
37-
PORT_F = 5 /**< port F */
37+
PORT_F = 5, /**< port F */
38+
GPIO_EXP_PORT = 6 /**< first GPIO expander port */
3839
};
3940

4041
/**

cpu/atmega_common/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ config CPU_COMMON_ATMEGA
2121
select HAS_PERIPH_CPUID
2222
select HAS_PERIPH_EEPROM
2323
select HAS_PERIPH_GPIO
24+
select HAS_PERIPH_GPIO_EXP
2425
select HAS_PERIPH_GPIO_IRQ
2526
select HAS_PERIPH_PM
2627
select HAS_PERIPH_TIMER_PERIODIC

cpu/atmega_common/Makefile.dep

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ USEMODULE += atmega_common
77
# peripheral drivers are linked into the final binary
88
USEMODULE += atmega_common_periph
99

10+
# 8 bit GPIO pin mask required
11+
USEMODULE += gpio_mask_8bit
12+
1013
# the atmel port uses stdio_uart by default
1114
ifeq (,$(filter stdio_% slipdev_stdio,$(USEMODULE)))
1215
USEMODULE += stdio_uart

cpu/atmega_common/Makefile.features

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ FEATURES_PROVIDED += atmega_pcint0
44
FEATURES_PROVIDED += cpp
55
FEATURES_PROVIDED += periph_cpuid
66
FEATURES_PROVIDED += periph_eeprom
7-
FEATURES_PROVIDED += periph_gpio periph_gpio_irq
7+
FEATURES_PROVIDED += periph_gpio periph_gpio_irq periph_gpio_exp
88
FEATURES_PROVIDED += periph_pm
99
FEATURES_PROVIDED += periph_timer_periodic
1010
FEATURES_PROVIDED += periph_wdt

0 commit comments

Comments
 (0)