Skip to content
Snippets Groups Projects
Commit 0fcc8dd9 authored by Martin Vítek's avatar Martin Vítek
Browse files

Add SW

parent 64c756cd
No related branches found
No related tags found
No related merge requests found
cmake_minimum_required(VERSION 3.0)
project(servo_headlight_control)
set(AVR_UPLOADTOOL avrdude)
set(AVR_PROGRAMMER usbasp)
set(AVR_UPLOADTOOL_PORT usb)
set(AVR_MCU atmega8)
set(AVR_H_FUSE 0xC9)
set(AVR_L_FUSE 0x1F)
#set(CMAKE_BUILD_TYPE RelWithDebInfo)
set(CMAKE_BUILD_TYPE Release)
set(MCU_SPEED "3686400UL")
set(WITH_MCU OFF)
set(WITH_MCU OFF CACHE BOOL "Add the mCU type to the target file name." FORCE)
find_package(avr)
add_definitions("-DF_CPU=${MCU_SPEED}")
add_definitions("-fpack-struct")
add_definitions("-fshort-enums")
add_definitions("-Wall")
add_definitions("-funsigned-char")
add_definitions("-funsigned-bitfields")
add_definitions("-ffunction-sections")
add_definitions("-c")
add_definitions("-std=c++14")
set(SOURCE_FILES
main.cpp
)
include_directories(libs/src)
add_subdirectory(libs rk)
add_avr_executable(servo_headlight_control ${SOURCE_FILES})
avr_target_link_libraries(servo_headlight_control rk)
#include <avr/io.h>
#include "usart.h"
static usart_regs registers
{
&UCSRA,
&UCSRB,
&UCSRC,
&UDR,
&UBRRL,
&UBRRH,
};
usart uart(registers);
int main(void)
{
uart.set_operating_mode(uart.ASYNCHRONOUS_NORMAL);
uart.set_baudrate(115200);
uart.set_data_bits(8);
uart.set_stop_bits(1);
uart.set_parity(uart.PARITY_NONE);
uart.enable_trasmitter();
uart.transmit_string("\nServo headlight control\n");
for(;;)
{
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment