diff options
author | Paul Selkirk <paul@psgd.org> | 2016-05-24 18:13:26 -0400 |
---|---|---|
committer | Paul Selkirk <paul@psgd.org> | 2016-05-24 18:15:07 -0400 |
commit | ebe70741a4771698423e4c61939e88d6db66460d (patch) | |
tree | bf78c5e845c809e6dff113e0b2e46c94972317f4 /stm-init.h | |
parent | 9bb798876768f702c5940dcf67feffc6d0e9a0a4 (diff) | |
parent | 6265025f7cd7f606b6da62c7add13a6008500cf7 (diff) |
Merge branch 'master' of git.cryptech.is:sw/stm32
Diffstat (limited to 'stm-init.h')
-rw-r--r-- | stm-init.h | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -38,6 +38,25 @@ #include "cmsis_os.h" #include "stm32f4xx_hal.h" +/* Macros used to make GPIO pin setup (in stm-init.c) easier */ +#define gpio_output(output_port, output_pins, output_level) \ + /* Configure GPIO pin Output Level */ \ + HAL_GPIO_WritePin(output_port, output_pins, output_level); \ + /* Configure pin as output */ \ + GPIO_InitStruct.Pin = output_pins; \ + GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; \ + GPIO_InitStruct.Pull = GPIO_NOPULL; \ + GPIO_InitStruct.Speed = GPIO_SPEED_LOW; \ + HAL_GPIO_Init(output_port, &GPIO_InitStruct) + +#define gpio_input(input_port, input_pin, input_pull) \ + GPIO_InitStruct.Pin = input_pin; \ + GPIO_InitStruct.Mode = GPIO_MODE_INPUT; \ + GPIO_InitStruct.Pull = input_pull; \ + GPIO_InitStruct.Speed = GPIO_SPEED_LOW; \ + HAL_GPIO_Init(input_port, &GPIO_InitStruct) + + extern void stm_init(void); extern void Error_Handler(void); |