Just another C++ hardware abstraction Layer 😅
std::hardware
design and Silica
- ❌ - Broken or not implemented
- ❓ - Not tested
- ✅ - Works
Target | F030 | F042 | F103 | F401 | F405 | F407 | F429 | ATmega328p |
---|---|---|---|---|---|---|---|---|
Compiles | ✅ | ❓ | ❓ | ✅ | ❌ | ✅ | ❓ | ❓ |
Blinks LED | ✅ | ❓ | ❓ | ❓ | ❌ | ✅ | ❓ | ❓ |
Delay works | ❓ | ❓ | ❓ | ❓ | ❌ | ✅ | ❓ | ❌ |
Interrupts | ✅ | ❓ | ❓ | ❓ | ❌ | ✅ | ❓ | ❓ |
#include <halpp/gpio.hpp>
#include <halpp/systick.hpp>
#include <halpp/interrupt.hpp>
int main()
{
hal::init();
hal::afio.enable();
#if defined(STM32F407)
hal::port<'D'>.enable();
hal::port<'E'>.enable();
auto pin = hal::port<'D'>.get_pin(1);
auto int_pin = hal::port<'E'>.get_pin(4);
#else
hal::port<'A'>.enable();
auto pin = hal::port<'A'>.get_pin(0);
auto int_pin = hal::port<'A'>.get_pin(5);
#endif
pin->mode(hal::pin_mode::OUTPUT_50M);
pin->reset();
int_pin->mode(hal::pin_mode::INPUT);
int_pin->interrupt(hal::FALLING, [&pin](){
pin->toggle();
});
while(1);
}