diff options
Diffstat (limited to 'stm/boards')
-rw-r--r-- | stm/boards/NETDUINO_PLUS_2/mpconfigboard.h | 9 | ||||
-rw-r--r-- | stm/boards/PYBOARD3/mpconfigboard.h | 11 | ||||
-rw-r--r-- | stm/boards/PYBOARD4/mpconfigboard.h | 11 | ||||
-rw-r--r-- | stm/boards/STM32F4DISC/mpconfigboard.h | 11 | ||||
-rwxr-xr-x | stm/boards/make-pins.py | 20 |
5 files changed, 35 insertions, 27 deletions
diff --git a/stm/boards/NETDUINO_PLUS_2/mpconfigboard.h b/stm/boards/NETDUINO_PLUS_2/mpconfigboard.h index 9c407d9cd4..2c0e4b74c0 100644 --- a/stm/boards/NETDUINO_PLUS_2/mpconfigboard.h +++ b/stm/boards/NETDUINO_PLUS_2/mpconfigboard.h @@ -18,14 +18,11 @@ #define MICROPY_HW_ENABLE_SERVO (1) #define MICROPY_HW_ENABLE_AUDIO (0) -#define USRSW_PORT (GPIOB) -#define USRSW_PIN (GPIO_Pin_11) +// USRSW is pulled low. Pressing the button makes the input go high. +#define USRSW_PIN (pin_B11) #define USRSW_PUPD (GPIO_PuPd_NOPULL) -#define USRSW_EXTI_PIN (EXTI_PinSource11) -#define USRSW_EXTI_PORT (EXTI_PortSourceGPIOB) -#define USRSW_EXTI_LINE (EXTI_Line11) -#define USRSW_EXTI_IRQN (EXTI15_10_IRQn) #define USRSW_EXTI_EDGE (EXTI_Trigger_Rising) +#define USRSW_PRESSED (1) /* LED */ #define PYB_LED1_PORT (GPIOA) // Blue LED diff --git a/stm/boards/PYBOARD3/mpconfigboard.h b/stm/boards/PYBOARD3/mpconfigboard.h index 1632445741..88573e2b16 100644 --- a/stm/boards/PYBOARD3/mpconfigboard.h +++ b/stm/boards/PYBOARD3/mpconfigboard.h @@ -14,14 +14,11 @@ #define MICROPY_HW_ENABLE_SERVO (1) #define MICROPY_HW_ENABLE_AUDIO (0) -#define USRSW_PORT (GPIOA) -#define USRSW_PIN (GPIO_Pin_13) +// USRSW has no pullup or pulldown, and pressing the switch makes the input go low +#define USRSW_PIN (pin_A13) #define USRSW_PUPD (GPIO_PuPd_UP) -#define USRSW_EXTI_PIN (EXTI_PinSource13) -#define USRSW_EXTI_PORT (EXTI_PortSourceGPIOA) -#define USRSW_EXTI_LINE (EXTI_Line13) -#define USRSW_EXTI_IRQN (EXTI15_10_IRQn) -#define USRSW_EXTI_EDGE (EXTI_Trigger_Rising) +#define USRSW_EXTI_EDGE (EXTI_Trigger_Falling) +#define USRSW_PRESSED (0) /* LED */ #define PYB_LED1_PORT (GPIOA) diff --git a/stm/boards/PYBOARD4/mpconfigboard.h b/stm/boards/PYBOARD4/mpconfigboard.h index 3cb00b4027..88c3944312 100644 --- a/stm/boards/PYBOARD4/mpconfigboard.h +++ b/stm/boards/PYBOARD4/mpconfigboard.h @@ -14,14 +14,11 @@ #define MICROPY_HW_ENABLE_SERVO (1) #define MICROPY_HW_ENABLE_AUDIO (0) -#define USRSW_PORT (GPIOB) -#define USRSW_PIN (GPIO_Pin_3) +// USRSW has no pullup or pulldown, and pressing the switch makes the input go low +#define USRSW_PIN (pin_B3) #define USRSW_PUPD (GPIO_PuPd_UP) -#define USRSW_EXTI_PIN (EXTI_PinSource3) -#define USRSW_EXTI_PORT (EXTI_PortSourceGPIOB) -#define USRSW_EXTI_LINE (EXTI_Line3) -#define USRSW_EXTI_IRQN (EXTI3_IRQn) -#define USRSW_EXTI_EDGE (EXTI_Trigger_Rising) +#define USRSW_EXTI_EDGE (EXTI_Trigger_Falling) +#define USRSW_PRESSED (0) /* LED */ #define PYB_LED1_PORT (GPIOA) diff --git a/stm/boards/STM32F4DISC/mpconfigboard.h b/stm/boards/STM32F4DISC/mpconfigboard.h index 2708504cb0..1e26f730ec 100644 --- a/stm/boards/STM32F4DISC/mpconfigboard.h +++ b/stm/boards/STM32F4DISC/mpconfigboard.h @@ -14,14 +14,11 @@ #define MICROPY_HW_ENABLE_SERVO (0) #define MICROPY_HW_ENABLE_AUDIO (0) -#define USRSW_PORT (GPIOA) -#define USRSW_PIN (GPIO_Pin_0) +// USRSW is pulled low. Pressing the button makes the input go high. +#define USRSW_PIN (pin_A0) #define USRSW_PUPD (GPIO_PuPd_NOPULL) -#define USRSW_EXTI_PIN (EXTI_PinSource0) -#define USRSW_EXTI_PORT (EXTI_PortSourceGPIOA) -#define USRSW_EXTI_LINE (EXTI_Line0) -#define USRSW_EXTI_IRQN (EXTI0_IRQn) -#define USRSW_EXTI_EDGE (EXTI_Trigger_Falling) +#define USRSW_EXTI_EDGE (EXTI_Trigger_Rising) +#define USRSW_PRESSED (1) /* LED */ #define PYB_LED1_PORT (GPIOD) diff --git a/stm/boards/make-pins.py b/stm/boards/make-pins.py index 0bc9118b08..b39a2b9ddd 100755 --- a/stm/boards/make-pins.py +++ b/stm/boards/make-pins.py @@ -133,6 +133,13 @@ class Pin(object): self.alt_fn_count, self.alt_fn_name())) print('') + def print_header(self, hdr_file): + hdr_file.write('extern const pin_obj_t pin_{:s};\n'. + format(self.pin_name())) + if self.alt_fn_count > 0: + hdr_file.write('extern const pin_af_obj_t pin_{:s}_af[];\n'. + format(self.pin_name())) + class Pins(object): @@ -191,6 +198,12 @@ class Pins(object): print('') self.print_named('board', self.board_pins) + def print_header(self, hdr_filename): + with open(hdr_filename, 'wb') as hdr_file: + for pin in self.pins: + if pin.board_name: + pin.print_header(hdr_file) + def main(): parser = argparse.ArgumentParser( @@ -215,6 +228,12 @@ def main(): help="Specifies beginning portion of generated pins file", default="stm32f4xx-prefix.c" ) + parser.add_argument( + "-r", "--hdr", + dest="hdr_filename", + help="Specifies name of generated pin header file", + default="build/pins.h" + ) args = parser.parse_args(sys.argv[1:]) pins = Pins() @@ -235,6 +254,7 @@ def main(): with open(args.prefix_filename, 'r') as prefix_file: print(prefix_file.read()) pins.print() + pins.print_header(args.hdr_filename) if __name__ == "__main__": |