#include "uart.h"
int main(void)
{
USART2_Init();
test_setup();
# this won't work, either: | |
# in flask_app: | |
from counter import counter_update, counter_display | |
@app.route('/counter/') | |
def counter(): |
As the code is intended for an STM32F0xx board, which requires the peripherals to be defined within the CS, | |
the idea was to have them globally accessible, wrapped in Mutex - RefCell containers. | |
This does not work for the Random Number Generator. Code: | |
static GRNG: Mutex<RefCell<Option<rand::rngs::small::SmallRng>>> = Mutex::new(RefCell::new(None)); | |
gives an error "module 'small' is private". | |
Ideas go go around this and solve the whole problem: three separate timer interrups. |
This tutorial will explain step by step how to build and deploy MicroPython on STM32F407xx and STM32F411CEU boards, using both DFU mode over USB, as well as SWD with ST-Link and OpenOCD in case you can't get the board into DFU mode (happened to me with the "black pill").
It should be applicable to other boards, such as the other "black pill" STM32F401, Nucleo boards etc., provided you can find an appropriate board definition to build.
use std::io;
#[derive(Copy, Clone, Debug)]
struct Record<'a> {
id: u16,
name: &'a str,
quantity: u16,
price: f32,
}
#![no_main]
#![no_std]
extern crate panic_halt;
use cortex_m_rt::entry;
use stm32l0::stm32l0x1;
use stm32l0xx_hal::{
pac,
A simple app to choose a random episode of a TV show :)
extern crate cursive;
use cursive::views::{SelectView, TextView, Dialog};
use cursive::align::*;
use cursive::Cursive;
use cursive::traits::*;
https://en.wikipedia.org/wiki/Sørensen–Dice_coefficient
TO DO: convert to take words as command line arguments with the following syntax: sdcoeff <word1> <word2>
Original quick draft in Python:
def get_bigrams(word):
https://en.wikibooks.org/wiki/Algorithm_Implementation/Sorting/Bubble_sort
Implemented for generic types, as long as they implement Copy and PartialOrd traits.
fn main () {
// example1: numbers
def add(*args):
if len(set([tuple([len(item) for item in arg]) for arg in args])) == 1:
return [[sum(b) for *b, in zip(*item,)] for item in [b for *b, in zip(*args,)]]
else: