diff --git a/lib/flash_internal.c b/lib/flash_internal.c
deleted file mode 100644
index cf4dedf..0000000
--- a/lib/flash_internal.c
+++ /dev/null
@@ -1,111 +0,0 @@
-/* This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- *
- */
-/** library to read/write internal flash (code)
- * @file flash_internal.c
- * @author King Kévin
- * @date 2016
- * @note peripherals used: none
- */
-/* standard libraries */
-#include // standard integer types
-#include // general utilities
-
-/* STM32 (including CM3) libraries */
-#include // device signature utilities
-#include // flash utilities
-
-#include "flash_internal.h" // flash storage library API
-#include "global.h" // global definitions
-
-/** the flash page size (medium-density devices have 1KiB page size) */
-#define PAGE_SIZE 1024
-
-bool flash_internal_read(uint32_t address, uint8_t *buffer, size_t size)
-{
- // verify it's in the storage area
- if (addressSTORAGE_END) {
- return false;
- }
- if (buffer==NULL || size==0) {
- return false;
- }
-
- // copy data byte per byte
- // a more efficient way would be to copy words, than the remaining bytes
- for (size_t i=0; iSTORAGE_END) {
- return false;
- }
- if (buffer==NULL || size==0) {
- return false;
- }
-
- uint8_t page[PAGE_SIZE]; // the complete page to write
-
- flash_unlock(); // unlock flash to be able to write it
- // go through memory
- while (size) {
- uint32_t page_pre = address%PAGE_SIZE; // the beginning data size in the page
- address -= page_pre; // go to beginning of the page
- storage_read(address, &page[0], page_pre); // copy existing data
- if (size>=PAGE_SIZE-page_pre) { // no need to read tailing page data
- for (uint16_t i=0; i.
- *
- */
-/** library to read/write internal flash (API)
- * @file flash_internal.h
- * @author King Kévin
- * @date 2016
- * @note peripherals used: none
- */
-#pragma once
-
-#include // device signature utilities
-
-/** how much data (in bytes) should we be able to store (be sure it's available and does not overlap the firmware) */
-#define STORAGE_SIZE 2048
-/** the end of the flash area where to store data */
-#define STORAGE_END FLASH_BASE+DESIG_FLASH_SIZE
-/** the start of the flash area where to store data (be sure it's after the firmware data) */
-#define STORAGE_START STORAGE_END-STORAGE_SIZE
-
-/** read data from internal flash
- * @param[in] address start address of the data to read
- * @param[out] buffer where to store the read data
- * @param[in] size how much data to read, in bytes
- * @return if read succeeded
- */
-bool flash_internal_read(uint32_t address, uint8_t *buffer, size_t size);
-/** write data to internal flash
- * @param[in] address start address where to write data to
- * @param[in] buffer data to be written
- * @param[in] size how much data to write, in bytes
- * @return if write succeeded
- */
-bool flash_internal_write(uint32_t address, uint8_t *buffer, size_t size);
diff --git a/lib/led_ws2812b.c b/lib/led_ws2812b.c
deleted file mode 100644
index 2d9c759..0000000
--- a/lib/led_ws2812b.c
+++ /dev/null
@@ -1,165 +0,0 @@
-/* This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- *
- */
-/** library to drive a WS2812B LED chain (code)
- * @file led_ws2812b.c
- * @author King Kévin
- * @date 2016
- * @note peripherals used: SPI @ref led_ws2812b_spi, timer @ref led_ws2812b_timer, DMA @ref led_ws2812b_dma
- */
-
-/* standard libraries */
-#include // standard integer types
-#include // general utilities
-
-/* STM32 (including CM3) libraries */
-#include // real-time control clock library
-#include // general purpose input output library
-#include // SPI library
-#include // timer library
-#include // DMA library
-#include // interrupt handler
-#include // Cortex M3 utilities
-
-#include "led_ws2812b.h" // LED WS2812B library API
-#include "global.h" // common methods
-
-/** bit template to encode one byte to be shifted out by SPI to the WS2812B LEDs
- * @details For each WS2812B bit which needs to be transfered we require to transfer 3 SPI bits.
- * The first SPI bit is the high start of the WS2812B bit frame.
- * The second SPI bit determines if the WS2812B bit is a 0 or 1.
- * The third SPI bit is the last part of the WS2812B bit frame, which is always low.
- * The binary pattern is 0b100100100100100100100100
- */
-#define LED_WS2812B_SPI_TEMPLATE 0x924924
-
-uint8_t led_ws2812b_data[LED_WS2812B_LEDS*3*3+40*3/8+1] = {0}; /**< data encoded to be shifted out by SPI for the WS2812B, plus the 50us reset (~40 data bits) */
-static volatile bool transmit_flag = false; /**< flag set in software when transmission started, clear by interrupt when transmission completed */
-
-void led_ws2812b_set_rgb(uint16_t led, uint8_t red, uint8_t green, uint8_t blue)
-{
- // verify the led exists
- if (led>=LED_WS2812B_LEDS) {
- return;
- }
- // wait for transmission to complete before changing the color
- while (transmit_flag) {
- __WFI();
- }
-
- const uint8_t colors[] = {green, red, blue}; // color order for the WS2812B
- const uint8_t pattern_bit[] = {0x02, 0x10, 0x80, 0x04, 0x20, 0x01, 0x08, 0x40}; // which bit to change in the pattern
- const uint8_t pattern_byte[] = {2,2,2,1,1,0,0,0}; // in which byte in the pattern to write the pattern bit
- for (uint8_t color=0; color>16);
- led_ws2812b_data[i*3+1] = (uint8_t)(LED_WS2812B_SPI_TEMPLATE>>8);
- led_ws2812b_data[i*3+2] = (uint8_t)(LED_WS2812B_SPI_TEMPLATE>>0);
- }
- // fill remaining with with 0 to encode the reset code
- for (uint16_t i=LED_WS2812B_LEDS*3*3; i.
- *
- */
-/** library to drive a WS2812B LED chain (API)
- * @file led_ws2812b.h
- * @author King Kévin
- * @date 2016
- * @note peripherals used: SPI @ref led_ws2812b_spi, timer @ref led_ws2812b_timer, DMA @ref led_ws2812b_dma
- */
-#pragma once
-
-/** number of LEDs on the WS2812B strip */
-#define LED_WS2812B_LEDS 48
-
-/** peripheral configuration */
-/** @defgroup led_ws2812b_spi SPI peripheral used to control the WS2812B LEDs
- * @{
- */
-#define LED_WS2812B_SPI SPI1 /**< SPI peripheral */
-#define LED_WS2812B_SPI_DR SPI1_DR /**< SPI data register for the DMA */
-#define LED_WS2812B_SPI_RCC RCC_SPI1 /**< SPI peripheral clock */
-#define LED_WS2812B_SPI_PORT_RCC RCC_GPIOA /**< SPI I/O peripheral clock */
-#define LED_WS2812B_SPI_PORT GPIOA /**< SPI port */
-#define LED_WS2812B_SPI_CLK GPIO_SPI1_SCK /**< SPI clock pin (PA5), connect to PWM output */
-#define LED_WS2812B_SPI_DOUT GPIO_SPI1_MISO /**< SPI data pin (PA6), connect to WS2812B DIN */
-/** @} */
-/** @defgroup led_ws2812b_timer timer peripheral used to generate SPI clock
- * @{
- */
-#define LED_WS2812B_TIMER TIM3 /**< timer peripheral */
-#define LED_WS2812B_TIMER_RCC RCC_TIM3 /**< timer peripheral clock */
-#define LED_WS2812B_TIMER_OC TIM_OC3 /**< timer output compare used to set PWM frequency */
-#define LED_WS2812B_CLK_RCC RCC_GPIOB /**< timer port peripheral clock */
-#define LED_WS2812B_CLK_PORT GPIOB /**< timer port */
-#define LED_WS2812B_CLK_PIN GPIO_TIM3_CH3 /**< timer pin to output PWM (PB0), connect to SPI clock input */
-/** @} */
-/** @defgroup led_ws2812b_dma DMA peripheral used to send the data
- * @{
- */
-#define LED_WS2812B_DMA DMA1 /**< DMA peripheral to put data for WS2812B LED in SPI queue (only DMA1 supports SPI1_TX interrupt) */
-#define LED_WS2812B_DMA_RCC RCC_DMA1 /**< DMA peripheral clock */
-#define LED_WS2812B_DMA_CH DMA_CHANNEL3 /**< DMA channel (only DMA1 channel 3 supports SPI1_TX interrupt) */
-#define LED_WS2812B_DMA_IRQ NVIC_DMA1_CHANNEL3_IRQ /**< DMA channel interrupt signal */
-#define LED_WS2812B_DMA_ISR dma1_channel3_isr /**< DMA channel interrupt service routine */
-/** @} */
-
-/** setup WS2812B LED driver */
-void led_ws2812b_setup(void);
-/** set color of a single LED
- * @param[in] led the LED number to set the color
- * @param[in] red the red color value to set on the LED
- * @param[in] green the green color value to set on the LED
- * @param[in] blue the blue color value to set on the LED
- * @note transmission needs to be done separately
- */
-void led_ws2812b_set_rgb(uint16_t led, uint8_t red, uint8_t green, uint8_t blue);
-/** transmit color values to WS2812B LEDs
- * @return true if transmission started, false if another transmission is already ongoing
- */
-bool led_ws2812b_transmit(void);
diff --git a/lib/radio_esp8266.c b/lib/radio_esp8266.c
deleted file mode 100644
index bd66c23..0000000
--- a/lib/radio_esp8266.c
+++ /dev/null
@@ -1,175 +0,0 @@
-/* This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- *
- */
-/** library to send data using ESP8266 WiFi SoC (code)
- * @file radio_esp8266.c
- * @author King Kévin
- * @date 2016
- * @note peripherals used: USART @ref radio_esp8266_usart
- */
-
-/* standard libraries */
-#include // standard integer types
-#include // general utilities
-#include // string and memory utilities
-#include // string utilities
-
-/* STM32 (including CM3) libraries */
-#include // real-time control clock library
-#include // general purpose input output library
-#include // universal synchronous asynchronous receiver transmitter library
-#include // interrupt handler
-#include // Cortex M3 utilities
-
-#include "radio_esp8266.h" // radio header and definitions
-#include "global.h" // common methods
-
-/** @defgroup radio_esp8266_usart USART peripheral used for communication with radio
- * @{
- */
-#define RADIO_ESP8266_USART 2 /**< USART peripheral */
-/** @} */
-
-/* input and output buffers and used memory */
-static uint8_t rx_buffer[24] = {0}; /**< buffer for received data (we only expect AT responses) */
-static volatile uint16_t rx_used = 0; /**< number of byte in receive buffer */
-static uint8_t tx_buffer[256] = {0}; /**< buffer for data to transmit */
-static volatile uint16_t tx_used = 0; /**< number of bytes used in transmit buffer */
-
-volatile bool radio_esp8266_activity = false;
-volatile bool radio_esp8266_success = false;
-
-/** transmit data to radio
- * @param[in] data data to transmit
- * @param[in] length length of data to transmit
- */
-static void radio_esp8266_transmit(uint8_t* data, uint8_t length) {
- while (tx_used || !usart_get_flag(USART(RADIO_ESP8266_USART), USART_SR_TXE)) { // wait until ongoing transmission completed
- usart_enable_tx_interrupt(USART(RADIO_ESP8266_USART)); // enable transmit interrupt
- __WFI(); // sleep until something happened
- }
- usart_disable_tx_interrupt(USART(RADIO_ESP8266_USART)); // ensure transmit interrupt is disable to prevent index corruption (the ISR should already have done it)
- radio_esp8266_activity = false; // reset status because of new activity
- for (tx_used=0; tx_used0) {
- radio_esp8266_transmit((uint8_t*)command, length);
- }
-}
-
-void radio_esp8266_send(uint8_t* data, uint8_t length)
-{
- char command[16+1] = {0}; // string to create command
- int command_length = snprintf(command, LENGTH(command), "AT+CIPSEND=%u\r\n", length); // create AT command to send data
- if (command_length>0) {
- radio_esp8266_transmit((uint8_t*)command, command_length); // transmit AT command
- while (!radio_esp8266_activity || !radio_esp8266_success) { // wait for response
- __WFI(); // sleep until something happened
- }
- if (!radio_esp8266_success) { // send AT command did not succeed
- return; // don't transmit data
- }
- radio_esp8266_transmit(data, length); // transmit data
- }
-}
-
-void radio_esp8266_close(void)
-{
- radio_esp8266_transmit((uint8_t*)"AT+CIPCLOSE\r\n", 13); // send AT command to close established connection
-}
-
-/** USART interrupt service routine called when data has been transmitted or received */
-void USART_ISR(RADIO_ESP8266_USART)(void)
-{
- if (usart_get_interrupt_source(USART(RADIO_ESP8266_USART), USART_SR_TXE)) { // data has been transmitted
- if (tx_used) { // there is still data in the buffer to transmit
- usart_send(USART(RADIO_ESP8266_USART),tx_buffer[tx_used-1]); // put data in transmit register
- tx_used--; // update used size
- } else { // no data in the buffer to transmit
- usart_disable_tx_interrupt(USART(RADIO_ESP8266_USART)); // disable transmit interrupt
- }
- }
- if (usart_get_interrupt_source(USART(RADIO_ESP8266_USART), USART_SR_RXNE)) { // data has been received
- while (rx_used>=LENGTH(rx_buffer)) { // if buffer is full
- memmove(rx_buffer,&rx_buffer[1],LENGTH(rx_buffer)-1); // drop old data to make space (ring buffer are more efficient but harder to handle)
- rx_used--; // update used buffer information
- }
- rx_buffer[rx_used++] = usart_recv(USART(RADIO_ESP8266_USART)); // put character in buffer
- // if the used send a packet with these strings during the commands detection the AT command response will break (AT commands are hard to handle perfectly)
- if (rx_used>=4 && memcmp((char*)&rx_buffer[rx_used-4], "OK\r\n", 4)==0) { // OK received
- radio_esp8266_activity = true; // response received
- radio_esp8266_success = true; // command succeeded
- rx_used = 0; // reset buffer
- } else if (rx_used>=7 && memcmp((char*)&rx_buffer[rx_used-7], "ERROR\r\n", 7)==0) { // ERROR received
- radio_esp8266_activity = true; // response received
- radio_esp8266_success = false; // command failed
- rx_used = 0; // reset buffer
- }
- }
-}
diff --git a/lib/radio_esp8266.h b/lib/radio_esp8266.h
deleted file mode 100644
index 193db70..0000000
--- a/lib/radio_esp8266.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see .
- *
- */
-/** library to send data using ESP8266 WiFi SoC (API)
- * @file radio_esp8266.h
- * @author King Kévin
- * @date 2016
- * @note peripherals used: USART @ref radio_esp8266_usart
- */
-#pragma once
-
-/** a response has been returned by the radio */
-extern volatile bool radio_esp8266_activity;
-/** the last command has succeeded */
-extern volatile bool radio_esp8266_success;
-
-/** setup peripherals to communicate with radio
- * @note this is blocking to ensure we are connected to the WiFi network
- */
-void radio_esp8266_setup(void);
-/** establish TCP connection
- * @param[in] host host to connect to
- * @param[in] port TCP port to connect to
- * @note wait for activity to get success status
- */
-void radio_esp8266_tcp_open(char* host, uint16_t port);
-/** send data (requires established connection)
- * @param[in] data data to send
- * @param[in] length size of data to send
- * @note wait for activity to get success status
- */
-void radio_esp8266_send(uint8_t* data, uint8_t length);
-/** close established connection
- * @note wait for activity to get success status
- */
-void radio_esp8266_close(void);