Commit 333d4c8b authored by Werner Sembach's avatar Werner Sembach
Browse files

Add Documentation

parent 2eb48a33
...@@ -13,7 +13,7 @@ INCLUDE(ezs_ecos_stm32) ...@@ -13,7 +13,7 @@ INCLUDE(ezs_ecos_stm32)
add_definitions("-D EZS_DUMB_SERIAL") add_definitions("-D EZS_DUMB_SERIAL")
include_directories(${PROJECT_SOURCE_DIR}/BSP/stm32f411e-discovery) include_directories(${PROJECT_SOURCE_DIR}/BSP/stm32f411e-discovery)
include_directories(${PROJECT_SOURCE_DIR}/stm32f4/include) include_directories(${PROJECT_SOURCE_DIR}/STM32F4xx_HAL_Driver/include)
include_directories(${PROJECT_SOURCE_DIR}/CMSIS/Include) include_directories(${PROJECT_SOURCE_DIR}/CMSIS/Include)
include_directories(${PROJECT_SOURCE_DIR}/CMSIS/Device/ST/STM32F4xx/Include) include_directories(${PROJECT_SOURCE_DIR}/CMSIS/Device/ST/STM32F4xx/Include)
include_directories(${PROJECT_SOURCE_DIR}/inc) include_directories(${PROJECT_SOURCE_DIR}/inc)
...@@ -35,91 +35,91 @@ set(LIBEZS_SOURCES ...@@ -35,91 +35,91 @@ set(LIBEZS_SOURCES
BSP/Components/l3gd20/l3gd20.c BSP/Components/l3gd20/l3gd20.c
#HAL #HAL
stm32f4/src/stm32f4xx_ll_adc.c STM32F4xx_HAL_Driver/src/stm32f4xx_ll_adc.c
stm32f4/src/stm32f4xx_hal_tim.c STM32F4xx_HAL_Driver/src/stm32f4xx_hal_tim.c
stm32f4/src/stm32f4xx_hal_rtc.c STM32F4xx_HAL_Driver/src/stm32f4xx_hal_rtc.c
stm32f4/src/stm32f4xx_hal_ltdc.c STM32F4xx_HAL_Driver/src/stm32f4xx_hal_ltdc.c
stm32f4/src/stm32f4xx_hal_nand.c STM32F4xx_HAL_Driver/src/stm32f4xx_hal_nand.c
stm32f4/src/stm32f4xx_hal_dac_ex.c STM32F4xx_HAL_Driver/src/stm32f4xx_hal_dac_ex.c
stm32f4/src/stm32f4xx_hal_cryp_ex.c STM32F4xx_HAL_Driver/src/stm32f4xx_hal_cryp_ex.c
stm32f4/src/stm32f4xx_hal_gpio.c STM32F4xx_HAL_Driver/src/stm32f4xx_hal_gpio.c
stm32f4/src/stm32f4xx_hal_dma2d.c STM32F4xx_HAL_Driver/src/stm32f4xx_hal_dma2d.c
stm32f4/src/stm32f4xx_hal_flash_ramfunc.c STM32F4xx_HAL_Driver/src/stm32f4xx_hal_flash_ramfunc.c
stm32f4/src/stm32f4xx_hal_adc.c STM32F4xx_HAL_Driver/src/stm32f4xx_hal_adc.c
stm32f4/src/stm32f4xx_ll_i2c.c STM32F4xx_HAL_Driver/src/stm32f4xx_ll_i2c.c
stm32f4/src/stm32f4xx_hal_cortex.c STM32F4xx_HAL_Driver/src/stm32f4xx_hal_cortex.c
stm32f4/src/stm32f4xx_hal_sdram.c STM32F4xx_HAL_Driver/src/stm32f4xx_hal_sdram.c
stm32f4/src/stm32f4xx_hal_tim_ex.c STM32F4xx_HAL_Driver/src/stm32f4xx_hal_tim_ex.c
stm32f4/src/stm32f4xx_ll_spi.c STM32F4xx_HAL_Driver/src/stm32f4xx_ll_spi.c
stm32f4/src/stm32f4xx_hal_i2c.c STM32F4xx_HAL_Driver/src/stm32f4xx_hal_i2c.c
stm32f4/src/stm32f4xx_hal_can.c STM32F4xx_HAL_Driver/src/stm32f4xx_hal_can.c
stm32f4/src/stm32f4xx_hal_smartcard.c STM32F4xx_HAL_Driver/src/stm32f4xx_hal_smartcard.c
stm32f4/src/stm32f4xx_ll_rng.c STM32F4xx_HAL_Driver/src/stm32f4xx_ll_rng.c
stm32f4/src/stm32f4xx_hal_pwr_ex.c STM32F4xx_HAL_Driver/src/stm32f4xx_hal_pwr_ex.c
stm32f4/src/stm32f4xx_hal.c STM32F4xx_HAL_Driver/src/stm32f4xx_hal.c
stm32f4/src/stm32f4xx_hal_dcmi.c STM32F4xx_HAL_Driver/src/stm32f4xx_hal_dcmi.c
stm32f4/src/stm32f4xx_ll_fsmc.c STM32F4xx_HAL_Driver/src/stm32f4xx_ll_fsmc.c
stm32f4/src/stm32f4xx_hal_wwdg.c STM32F4xx_HAL_Driver/src/stm32f4xx_hal_wwdg.c
stm32f4/src/stm32f4xx_hal_pwr.c STM32F4xx_HAL_Driver/src/stm32f4xx_hal_pwr.c
stm32f4/src/stm32f4xx_hal_dma.c STM32F4xx_HAL_Driver/src/stm32f4xx_hal_dma.c
stm32f4/src/stm32f4xx_ll_rcc.c STM32F4xx_HAL_Driver/src/stm32f4xx_ll_rcc.c
stm32f4/src/stm32f4xx_hal_pcd.c STM32F4xx_HAL_Driver/src/stm32f4xx_hal_pcd.c
stm32f4/src/stm32f4xx_hal_dsi.c STM32F4xx_HAL_Driver/src/stm32f4xx_hal_dsi.c
stm32f4/src/stm32f4xx_ll_usart.c STM32F4xx_HAL_Driver/src/stm32f4xx_ll_usart.c
stm32f4/src/stm32f4xx_ll_sdmmc.c STM32F4xx_HAL_Driver/src/stm32f4xx_ll_sdmmc.c
stm32f4/src/stm32f4xx_hal_dma_ex.c STM32F4xx_HAL_Driver/src/stm32f4xx_hal_dma_ex.c
stm32f4/src/stm32f4xx_ll_usb.c STM32F4xx_HAL_Driver/src/stm32f4xx_ll_usb.c
stm32f4/src/stm32f4xx_hal_sai.c STM32F4xx_HAL_Driver/src/stm32f4xx_hal_sai.c
stm32f4/src/stm32f4xx_hal_i2c_ex.c STM32F4xx_HAL_Driver/src/stm32f4xx_hal_i2c_ex.c
stm32f4/src/stm32f4xx_hal_cec.c STM32F4xx_HAL_Driver/src/stm32f4xx_hal_cec.c
stm32f4/src/stm32f4xx_hal_pccard.c STM32F4xx_HAL_Driver/src/stm32f4xx_hal_pccard.c
stm32f4/src/stm32f4xx_hal_sram.c STM32F4xx_HAL_Driver/src/stm32f4xx_hal_sram.c
stm32f4/src/stm32f4xx_hal_hash.c STM32F4xx_HAL_Driver/src/stm32f4xx_hal_hash.c
stm32f4/src/stm32f4xx_hal_sai_ex.c STM32F4xx_HAL_Driver/src/stm32f4xx_hal_sai_ex.c
stm32f4/src/stm32f4xx_ll_tim.c STM32F4xx_HAL_Driver/src/stm32f4xx_ll_tim.c
stm32f4/src/stm32f4xx_hal_i2s_ex.c STM32F4xx_HAL_Driver/src/stm32f4xx_hal_i2s_ex.c
stm32f4/src/stm32f4xx_hal_flash.c STM32F4xx_HAL_Driver/src/stm32f4xx_hal_flash.c
stm32f4/src/stm32f4xx_hal_fmpi2c.c STM32F4xx_HAL_Driver/src/stm32f4xx_hal_fmpi2c.c
stm32f4/src/stm32f4xx_hal_rtc_ex.c STM32F4xx_HAL_Driver/src/stm32f4xx_hal_rtc_ex.c
stm32f4/src/stm32f4xx_hal_crc.c STM32F4xx_HAL_Driver/src/stm32f4xx_hal_crc.c
stm32f4/src/stm32f4xx_hal_rcc_ex.c STM32F4xx_HAL_Driver/src/stm32f4xx_hal_rcc_ex.c
stm32f4/src/stm32f4xx_hal_sd.c STM32F4xx_HAL_Driver/src/stm32f4xx_hal_sd.c
stm32f4/src/stm32f4xx_ll_gpio.c STM32F4xx_HAL_Driver/src/stm32f4xx_ll_gpio.c
stm32f4/src/stm32f4xx_hal_cryp.c STM32F4xx_HAL_Driver/src/stm32f4xx_hal_cryp.c
stm32f4/src/stm32f4xx_ll_exti.c STM32F4xx_HAL_Driver/src/stm32f4xx_ll_exti.c
stm32f4/src/stm32f4xx_hal_nor.c STM32F4xx_HAL_Driver/src/stm32f4xx_hal_nor.c
stm32f4/src/stm32f4xx_ll_dma.c STM32F4xx_HAL_Driver/src/stm32f4xx_ll_dma.c
stm32f4/src/stm32f4xx_hal_fmpi2c_ex.c STM32F4xx_HAL_Driver/src/stm32f4xx_hal_fmpi2c_ex.c
stm32f4/src/stm32f4xx_hal_mmc.c STM32F4xx_HAL_Driver/src/stm32f4xx_hal_mmc.c
stm32f4/src/stm32f4xx_hal_spi.c STM32F4xx_HAL_Driver/src/stm32f4xx_hal_spi.c
stm32f4/src/stm32f4xx_hal_uart.c STM32F4xx_HAL_Driver/src/stm32f4xx_hal_uart.c
stm32f4/src/stm32f4xx_ll_dma2d.c STM32F4xx_HAL_Driver/src/stm32f4xx_ll_dma2d.c
stm32f4/src/stm32f4xx_hal_dfsdm.c STM32F4xx_HAL_Driver/src/stm32f4xx_hal_dfsdm.c
stm32f4/src/stm32f4xx_hal_iwdg.c STM32F4xx_HAL_Driver/src/stm32f4xx_hal_iwdg.c
stm32f4/src/stm32f4xx_ll_pwr.c STM32F4xx_HAL_Driver/src/stm32f4xx_ll_pwr.c
stm32f4/src/stm32f4xx_hal_rcc.c STM32F4xx_HAL_Driver/src/stm32f4xx_hal_rcc.c
stm32f4/src/stm32f4xx_hal_irda.c STM32F4xx_HAL_Driver/src/stm32f4xx_hal_irda.c
stm32f4/src/stm32f4xx_ll_lptim.c STM32F4xx_HAL_Driver/src/stm32f4xx_ll_lptim.c
stm32f4/src/stm32f4xx_ll_fmc.c STM32F4xx_HAL_Driver/src/stm32f4xx_ll_fmc.c
stm32f4/src/stm32f4xx_hal_dcmi_ex.c STM32F4xx_HAL_Driver/src/stm32f4xx_hal_dcmi_ex.c
stm32f4/src/stm32f4xx_hal_ltdc_ex.c STM32F4xx_HAL_Driver/src/stm32f4xx_hal_ltdc_ex.c
stm32f4/src/stm32f4xx_ll_rtc.c STM32F4xx_HAL_Driver/src/stm32f4xx_ll_rtc.c
stm32f4/src/stm32f4xx_hal_hcd.c STM32F4xx_HAL_Driver/src/stm32f4xx_hal_hcd.c
stm32f4/src/stm32f4xx_ll_utils.c STM32F4xx_HAL_Driver/src/stm32f4xx_ll_utils.c
stm32f4/src/stm32f4xx_ll_dac.c STM32F4xx_HAL_Driver/src/stm32f4xx_ll_dac.c
stm32f4/src/stm32f4xx_hal_qspi.c STM32F4xx_HAL_Driver/src/stm32f4xx_hal_qspi.c
stm32f4/src/stm32f4xx_hal_i2s.c STM32F4xx_HAL_Driver/src/stm32f4xx_hal_i2s.c
stm32f4/src/stm32f4xx_hal_spdifrx.c STM32F4xx_HAL_Driver/src/stm32f4xx_hal_spdifrx.c
stm32f4/src/stm32f4xx_hal_rng.c STM32F4xx_HAL_Driver/src/stm32f4xx_hal_rng.c
stm32f4/src/stm32f4xx_hal_adc_ex.c STM32F4xx_HAL_Driver/src/stm32f4xx_hal_adc_ex.c
stm32f4/src/stm32f4xx_ll_crc.c STM32F4xx_HAL_Driver/src/stm32f4xx_ll_crc.c
stm32f4/src/stm32f4xx_hal_pcd_ex.c STM32F4xx_HAL_Driver/src/stm32f4xx_hal_pcd_ex.c
stm32f4/src/stm32f4xx_hal_flash_ex.c STM32F4xx_HAL_Driver/src/stm32f4xx_hal_flash_ex.c
stm32f4/src/stm32f4xx_hal_lptim.c STM32F4xx_HAL_Driver/src/stm32f4xx_hal_lptim.c
stm32f4/src/stm32f4xx_hal_dac.c STM32F4xx_HAL_Driver/src/stm32f4xx_hal_dac.c
stm32f4/src/stm32f4xx_hal_eth.c STM32F4xx_HAL_Driver/src/stm32f4xx_hal_eth.c
stm32f4/src/stm32f4xx_hal_usart.c STM32F4xx_HAL_Driver/src/stm32f4xx_hal_usart.c
stm32f4/src/stm32f4xx_hal_hash_ex.c STM32F4xx_HAL_Driver/src/stm32f4xx_hal_hash_ex.c
#Device #Device
CMSIS/Device/ST/STM32F4xx/Source/Templates/system_stm32f4xx.c CMSIS/Device/ST/STM32F4xx/Source/Templates/system_stm32f4xx.c
......
# DIY, Ainigma und Ich
## Tagebuch eines Projects
### Tag -3
Es war an einem stürmischen Sommertag (Freitag 25.8)
ich war im Kino
### Tag 1
Planung
Was ich insgesamt tun will:
Die Zahnzäder sind zu groß - finde ich mit meinen begrenzten möglichkeiten auf dieser einsamen Insel eine Möglichkeit sie zu verkleinern? Ich weiß es nicht. Ein schrumpfstrahler wäre eine Möglichkeit
Meine Stromquelle ist ausgesprochen unhandlich, ich sollte einen Weg finden sie transportabler zu halten
Der gesamte Aufbau sollte am Ende in eine Kiste passen
alle einzelteile festmontieren
Code aufräumen + doku
Hardware finden und vernichten ähm bestellen
Haushaltswaage
sortier platine ätzen
wernermitbringen:
waage
ladegerät und akku
kiste mitbringen
Heute:
Codeaufräumen
nach Akkus schauen
kleinere Zahnräder basteln
getan:
code aufgeräumt (it' pretty *.*)
Code den wir Dokumentieren für das "kochbuch" bestimmt
Sachen kosten geld (entscheidung entweder metall getriebe oder akku)
libEZS: utility funktionen von i4 hiwis
HAL update
...@@ -26,7 +26,8 @@ void main_thread(cyg_addrword_t arg) { ...@@ -26,7 +26,8 @@ void main_thread(cyg_addrword_t arg) {
servo_set(SERVO_0, 0); servo_set(SERVO_0, 0);
dc_set(0, 0); dc_set(0, 0);
while (1) { while (true) {
//check if solved
if(button_pressed && spring_broken && upside_down) { if(button_pressed && spring_broken && upside_down) {
ezs_printf("CONGRATULATIONS! YOU FINALLY MADE IT!\n"); ezs_printf("CONGRATULATIONS! YOU FINALLY MADE IT!\n");
servo_set(SERVO_0, 255); servo_set(SERVO_0, 255);
...@@ -34,17 +35,15 @@ void main_thread(cyg_addrword_t arg) { ...@@ -34,17 +35,15 @@ void main_thread(cyg_addrword_t arg) {
} }
button_pressed = button_get(); button_pressed = button_get();
double degree_max = get_degree_max(); double degree_max = get_degree_max();
upside_down = (degree_max > 90);
ezs_printf("Degree Max: %4.1f\n", degree_max); //spring riddle can only be solved if button is pressed
if(button_pressed) {
if(degree_max > 90) if (!spring_broken) {
upside_down = true; spring_broken = simulate_spring();
else }
upside_down = false;
if(button_pressed && !spring_broken) {
spring_broken = simulate_spring();
} }
else { else {
block_spring(); block_spring();
......
...@@ -50,6 +50,7 @@ extern "C" void all_init() { ...@@ -50,6 +50,7 @@ extern "C" void all_init() {
ezs_printf("================================\n\n"); ezs_printf("================================\n\n");
} }
//debug output
extern "C" void print_gyro() { extern "C" void print_gyro() {
float xyz_gyro[3]; float xyz_gyro[3];
BSP_GYRO_GetXYZ(xyz_gyro); BSP_GYRO_GetXYZ(xyz_gyro);
...@@ -66,6 +67,7 @@ extern "C" void print_degree() { ...@@ -66,6 +67,7 @@ extern "C" void print_degree() {
ezs_printf("Degree Short/Long/Max: %12.1f, %12.1f, %12.1f\n", get_degree_short(), get_degree_long(), get_degree_max()); ezs_printf("Degree Short/Long/Max: %12.1f, %12.1f, %12.1f\n", get_degree_short(), get_degree_long(), get_degree_max());
} }
//get tilt in degrees
extern "C" double get_degree_short() { extern "C" double get_degree_short() {
int16_t xyz_accelero[3]; int16_t xyz_accelero[3];
BSP_ACCELERO_GetXYZ(xyz_accelero); BSP_ACCELERO_GetXYZ(xyz_accelero);
...@@ -90,31 +92,36 @@ extern "C" double get_degree_max() { ...@@ -90,31 +92,36 @@ extern "C" double get_degree_max() {
return fabs(neigung_zu_lang_deg); return fabs(neigung_zu_lang_deg);
} }
//returns true if spring is in "broken" state
// TODO: make parameters possible in a cool way
// get array with (thresold, direction, power, solved)
extern "C" bool simulate_spring() { extern "C" bool simulate_spring() {
//returns true if spring is in "broken" state
uint16_t adc_value = adc_get(11); uint16_t adc_value = adc_get(11);
if (adc_value < 256) { if (adc_value < 256) {
//potty protection deadzone //potty protection deadzone
dc_set(0, 0); dc_set(0, 0);
} }
else if(adc_value > 4096 - 256) { else if(adc_value > (4096 - 256)) {
//spring is "broken" //spring is "broken"
dc_set(0, 0); dc_set(0, 0);
return true; return true;
} }
else { else {
//main simulation
dc_set(DC_RIGHT, adc_value / 4096.0 * 255); dc_set(DC_RIGHT, adc_value / 4096.0 * 255);
} }
return false; return false;
} }
// turns the motor real fast if in certain position
// TODO: make that position a parameter
extern "C" void block_spring() { extern "C" void block_spring() {
uint16_t adc_value = adc_get(11); uint16_t adc_value = adc_get(11);
if(adc_value > 2048) { if(adc_value > 2048) {
dc_set(DC_RIGHT, 255); dc_set(DC_RIGHT, 255);
} }
else if(adc_value > 2048 - 256) { else if(adc_value > (2048 - 256)) {
uint8_t speed = adc_value - (2048 - 256) / 256.0 * 255; uint8_t speed = adc_value - (2048 - 256) / 256.0 * 255;
dc_set(DC_RIGHT, speed); dc_set(DC_RIGHT, speed);
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment