Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix UART example compilation #3

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ This is an ongoing project. I will try to add more examples, e.g. Timers, interr

# What can you do?

If you have nice examples and projects, please contribiute to this repository.
If you have nice examples and projects, please contribute to this repository.

# Donations

Expand Down
1 change: 1 addition & 0 deletions examples/blink/blink.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
//In this example, I assume there is one LED's available on PD3
*/

//#include "blink.h"
#include "stm8s003.h"
#include "gpio.h"
#include "clock.h"
Expand Down
3 changes: 2 additions & 1 deletion examples/uart/Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
PNAME = uart
IDIR = ../include
IDIR = ../../include
ODIR = bin
CC = sdcc
CFLAGS = -I$(IDIR)

all:
mkdir -p $(ODIR)
$(CC) $(PNAME).c -lstm8 -mstm8 $(CFLAGS) --out-fmt-ihx -o"./$(ODIR)/"
packihx < bin/$(PNAME).ihx > bin/$(PNAME).hex

.PHONY: clean

Expand Down
5 changes: 3 additions & 2 deletions examples/uart/uart.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "clock.h"
#include "stm8s003.h"
#include <string.h> //for strlen()

Expand Down Expand Up @@ -28,8 +29,8 @@ int main() {
CLK_CKDIVR = 0x00;
CLK_PCKENR1 = 0xFF; // Enable peripherals

PC_DDR = 0x08; // Put TX line on
PC_CR1 = 0x08;
//PC_DDR = 0x08; // Put TX line on
//PC_CR1 = 0x08;

USART1_CR2 = USART_CR2_TEN; // Allow TX & RX
USART1_CR3 &= ~(USART_CR3_STOP1 | USART_CR3_STOP2); // 1 stop bit
Expand Down
10 changes: 4 additions & 6 deletions include/clock.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,17 +65,15 @@
/********** FUNCTION PROTOTYPES *********/

/**
* @brief: This functions calculates necessary cycles for exact delay.
* This function should not be called by user! It will be called when
* clock is changed by user.
* @brief: The following functions calculate necessary cycles for exact delay.
* This function should not be called by user! It will be called when clock is changed by user.
* @retval: None
*/
static void CLK_Caluclate_Delay_Cycles();
//static void CLK_Calculate_Delay_Cycles();

void CLK_Set_HSE_Freq(unsigned long freq);

void CLK_Init(unsigned char clk_src, unsigned char ps
, unsigned char cpu_div);
void CLK_Init(unsigned char clk_src, unsigned char ps, unsigned char cpu_div);

/**
* @brief: Delay for milliseconds
Expand Down
5 changes: 3 additions & 2 deletions include/dance.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ extern dance_t* d_head;
extern dance_t* d_tail;

/**
*@brief Generate a
*@brief Generate an LED "dance" in the defined direction. Functions below
* are helpers to turn different sets of LEDs on and off.
*
*
*/
Expand All @@ -41,4 +42,4 @@ void DNC_AllOnOff(dance_t* head, unsigned char cycles, int* baseDelay,
void DNC_AllOffOn(dance_t* head, unsigned char cycles, int* baseDelay,
int incDelay);

#endif
#endif