parent
3e98c7ce71
commit
e1487d6bb2
@ -1,26 +0,0 @@
|
||||
#include "bsl_nucleo_f042k6.hpp"
|
||||
|
||||
|
||||
Nucleo_f042k6::Nucleo_f042k6(){}
|
||||
Nucleo_f042k6::~Nucleo_f042k6(){}
|
||||
|
||||
void Nucleo_f042k6::init()
|
||||
{
|
||||
ledPin.init();
|
||||
ledPin.setMode(Pin::mode::output);
|
||||
ledPin.setSpeed(Pin::speed::fast);
|
||||
|
||||
pin_a0.init();
|
||||
pin_a0.setMode(Pin::mode::input);
|
||||
pin_a0.setSpeed(Pin::speed::slow);
|
||||
pin_a0.setPullUpDonw(Pin::pullUpDown::pullDown);
|
||||
}
|
||||
|
||||
void Nucleo_f042k6::running()
|
||||
{
|
||||
ledPin.write(true);
|
||||
delay.ms(200);
|
||||
ledPin.write(false);
|
||||
delay.ms(200);
|
||||
}
|
||||
|
@ -0,0 +1 @@
|
||||
set(LIBRARIES_LIST)
|
@ -0,0 +1,17 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "graphics.h"
|
||||
|
||||
display_s *display;
|
||||
|
||||
void init_lcd(display_s *d)
|
||||
{
|
||||
display = d;
|
||||
}
|
||||
|
||||
void print_lcd( int val)
|
||||
{
|
||||
display->print(val);
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
typedef struct display
|
||||
{
|
||||
int size_x,size_y;
|
||||
void (*print)(int);
|
||||
} display_s;
|
||||
|
||||
void init_lcd(display_s *d);
|
||||
void print_lcd(int val);
|
@ -0,0 +1,19 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "oled.h"
|
||||
|
||||
int main()
|
||||
{
|
||||
|
||||
display_s display = oled_init();
|
||||
init_lcd(&display);
|
||||
|
||||
void (*print_ptr)(int) = &oled_print;
|
||||
|
||||
(*print_ptr)(20);
|
||||
display.print(40);
|
||||
print_lcd(10);
|
||||
return 0;
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "oled.h"
|
||||
|
||||
|
||||
void oled_print(int a)
|
||||
{
|
||||
printf("Value of a is %d\n", a);
|
||||
}
|
||||
|
||||
display_s oled_init()
|
||||
{
|
||||
display_s *lcd = malloc(sizeof(display_s));
|
||||
lcd->size_x = 10;
|
||||
lcd->size_y = 20;
|
||||
lcd->print = &oled_print;
|
||||
|
||||
printf("LCD_OLED : Init Ok\n");
|
||||
return *lcd;
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
|
||||
#include "graphics.h"
|
||||
|
||||
display_s oled_init();
|
||||
void oled_print(int a);
|
||||
|
Binary file not shown.
@ -1,2 +0,0 @@
|
||||
add_subdirectory(assert)
|
||||
add_subdirectory(menu)
|
@ -1,5 +0,0 @@
|
||||
add_library(assert utils_assert.c)
|
||||
target_compile_options(assert PRIVATE ${C_FLAGS})
|
||||
target_compile_definitions(assert PRIVATE ${C_DEFS})
|
||||
target_include_directories(assert PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${CSL_INCLUDES})
|
||||
add_library(sub::assert ALIAS assert)
|
@ -1,8 +0,0 @@
|
||||
#include "utils_assert.h"
|
||||
|
||||
void assert(int check)
|
||||
{
|
||||
while(!check) {
|
||||
// dead loop here
|
||||
};
|
||||
}
|
@ -1,4 +0,0 @@
|
||||
|
||||
|
||||
|
||||
void assert(int check);
|
@ -1,5 +0,0 @@
|
||||
add_library(menu utils_menu.c)
|
||||
target_compile_options(menu PRIVATE ${C_FLAGS})
|
||||
target_compile_definitions(menu PRIVATE ${C_DEFS})
|
||||
target_include_directories(menu PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${CSL_INCLUDES})
|
||||
add_library(sub::menu ALIAS menu)
|
@ -1,54 +0,0 @@
|
||||
/**
|
||||
**************************************************************************************************
|
||||
* @file menu.h
|
||||
* @author Kerem Yollu & Edwin Koch
|
||||
* @date 08.11.2021
|
||||
* @version 1.0
|
||||
**************************************************************************************************
|
||||
* @brief Basic menu implementation for diefferent use cases
|
||||
**************************************************************************************************
|
||||
*/
|
||||
#ifndef _MENU_H
|
||||
#define _MENU_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
void menuGoUp();
|
||||
void menuGoDown();
|
||||
void menuGoLeft();
|
||||
void menuGoRight();
|
||||
|
||||
uint8_t menuGetEnter();
|
||||
uint8_t menuGetEscape();
|
||||
uint8_t menuGetReturn();
|
||||
uint8_t menuGetClear();
|
||||
|
||||
void menuSendEnter();
|
||||
void menuSendEscape();
|
||||
void menuSendReturn();
|
||||
void menuSendClear();
|
||||
|
||||
void menuPrintChar(uint8_t char);
|
||||
void menuMainMenu();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // _MENU_H
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in new issue