NUCLEO-L031K6-BSP

This crate implements a BSP for the ST NUCLEO-L031K6 development board. It is intended to ease development while relieving the programmer of tracking peripheral and pin combinations, as well as providing helper methods for instantiating peripherals.

An example of crate usage can be found in src/main.rs

Requirements

Building this (and the dependent crates) requires Rust v1.30 or later.

Setup

We need to we need to get OpenOCD on our machine. If you already have it, feel free to skip this step.

Example Code

The current example code initializes the board: ```rust let mut p = cortex_m::Peripherals::take().unwrap(); let d = hal::stm32l0x1::Peripherals::take().unwrap();

let mut board = bsp::init::(d.PWR, d.FLASH, d.RCC); ```

Starts a system clock: rust let ticks = board.rcc.cfgr.context().unwrap().sysclk().0; board.systick_start(&mut p.SYST, SystClkSource::Core, ticks / 1000);

And initializes the D12 and D13 pins: ```rust let pins = board.pins(d.GPIOA, d.GPIOB, d.GPIOC);

let mut userled = board.userled(pins.d13); let inputline = pins.d12.intoinput::(); ```

It then enters a loop with a few simple conditional check. If the D12 pin is set to HIGH, then the D13 (LED) pin state toggles at a frequency of 5hz. If D12 is set to LOW, then nothing will happen.

To test the example code, flash a board using the setup instructions above, and short the D12 and 3.3v pins on your ST NUCLEO-L031K6.