Compare commits

..

No commits in common. "fcbd1ae05ee1e5b7f708fac9d999f6f5c6702bf1" and "69658824356380b41d648223b77da6cd79453235" have entirely different histories.

3 changed files with 0 additions and 42 deletions

View File

@ -18,28 +18,4 @@
* If not, see <http://www.gnu.org/licenses/>.
*/
#include <stm32/stm32f4xx.h>
#include <reflow-controller/button.h>
#include <stm-periph/clock-enable-manager.h>
#include <stdint.h>
static volatile uint64_t to_active_timestamp;
void button_init()
{
rcc_manager_enable_clock(&RCC->AHB1ENR, BITMASK_TO_BITNO(BUTTON_RCC_MASK));
BUTTON_PORT->MODER &= MODER_DELETE(BUTTON_PIN);
BUTTON_PORT->PUPDR &= PUPDR_DELETE(BUTTON_PIN);
BUTTON_PORT->PUPDR |= PULLUP(BUTTON_PIN);
}
enum button_state button_read_event();
void button_deinit()
{
BUTTON_PORT->MODER &= MODER_DELETE(BUTTON_PIN);
BUTTON_PORT->PUPDR &= PUPDR_DELETE(BUTTON_PIN);
rcc_manager_disable_clock(&RCC->AHB1ENR, BITMASK_TO_BITNO(BUTTON_RCC_MASK));
}

View File

@ -21,21 +21,4 @@
#ifndef __BUTTON_H__
#define __BUTTON_H__
#define BUTTON_ACTIVE_LEVEL 0
#define BUTTON_PORT GPIOD
#define BUTTON_RCC_MASK RCC_AHB1ENR_GPIODEN
#define BUTTON_PIN 4
#define BUTTON_SHORT_ON_TIME_MS 50
#define BUTTON_LONG_ON_TIME_MS 800
enum button_state {BUTTON_IDLE = 0, BUTTON_SHORT, BUTTON_LONG};
void button_init();
enum button_state button_read_event();
void button_deinit();
#endif /* __BUTTON_H__ */

View File

@ -22,7 +22,6 @@
#define __STM32GPIOMACROS_H__
#define MODER_DELETE(pin) ~(0x3U << (pin * 2))
#define PUPDR_DELETE(pin) ~(0x3U << (pin * 2))
#define OUTPUT(pin) (0x01U << (pin * 2))
#define PULLUP(pin) (0x1U << (pin* 2))
#define ALTFUNC(pin) ((0x2) << (pin * 2))