New functions
This commit is contained in:
parent
815d9c94ba
commit
18c6fc5220
6
Makefile
6
Makefile
@ -9,14 +9,14 @@ STCGALOPTS ?=
|
|||||||
STCGALPORT ?= /dev/ttyUSB0
|
STCGALPORT ?= /dev/ttyUSB0
|
||||||
STCGALPROT ?= auto
|
STCGALPROT ?= auto
|
||||||
FLASHFILE ?= main.ihx
|
FLASHFILE ?= main.ihx
|
||||||
SYSCLK ?= 11056
|
#SYSCLK ?= 11056
|
||||||
FOSC ?=11056000L
|
#FOSC ?=11056000L
|
||||||
CFLAGS ?= -DWITH_ALT_LED9 -DWITHOUT_LEDTABLE_RELOC -DSHOW_TEMP_DATE_WEEKDAY
|
CFLAGS ?= -DWITH_ALT_LED9 -DWITHOUT_LEDTABLE_RELOC -DSHOW_TEMP_DATE_WEEKDAY
|
||||||
|
|
||||||
LIBSRC = uart_init.c uart_send_chr.c uart_send_str.c \
|
LIBSRC = uart_init.c uart_send_chr.c uart_send_str.c \
|
||||||
rotary_encoder_stat.c \
|
rotary_encoder_stat.c \
|
||||||
sevenseg_dec.c sevenseg_dec_inv.c \
|
sevenseg_dec.c sevenseg_dec_inv.c \
|
||||||
int_to_bcd.c
|
int_to_bcd.c getbutton.c
|
||||||
|
|
||||||
LIBOBJ =$(patsubst %.c,%.rel, $(LIBSRC))
|
LIBOBJ =$(patsubst %.c,%.rel, $(LIBSRC))
|
||||||
LIBNAME=mc8051fun.lib
|
LIBNAME=mc8051fun.lib
|
||||||
|
26
mc8051fun.h
26
mc8051fun.h
@ -18,9 +18,33 @@ int8_t rotary_encoder_stat(uint8_t b);
|
|||||||
extern uint8_t sevenseg_dec[10];
|
extern uint8_t sevenseg_dec[10];
|
||||||
extern uint8_t sevenseg_dec_inv[10];
|
extern uint8_t sevenseg_dec_inv[10];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Minimum frequency is 15 Hz @ FOSC of 11 Mhz
|
||||||
|
*/
|
||||||
|
#define default_timer16_init_val(freq) ((65536L)-FOSC/12L/freq)
|
||||||
|
#define default_timer8_init_val(freq) ((256L)-FOSC/12L/freq)
|
||||||
|
|
||||||
|
#define at89xx_6t_timer16_init_val(freq) ((65536L)-FOSC/6L/freq)
|
||||||
|
#define at89xx_6t_timer8_init_val(freq) ((256L)-FOSC/6L/freq)
|
||||||
|
|
||||||
|
|
||||||
|
#define STC15XX 1 // STC15xx family
|
||||||
|
#define AT89XX 2 // AT89XX family
|
||||||
|
#define AT89XX_6T 3 // AT89C89C52 in 6T mode
|
||||||
|
|
||||||
|
#if MCU==AT89XX_6T
|
||||||
|
#define timer8_init_val(freq) at89xx_6t_timer8_init_val(freq)
|
||||||
|
#define timer16_init_val(freq) at89xx_6t_timer16_init_val(freq)
|
||||||
|
#else
|
||||||
|
#define timer8_init_val(freq) default_timer8_init_val(freq)
|
||||||
|
#define timer16_init_val(freq) default_timer16_init_val(freq)
|
||||||
|
#endif
|
||||||
|
|
||||||
#define timer_init_val(freq) ((65536)-FOSC/12L/freq)
|
|
||||||
|
|
||||||
uint16_t int_to_bcd(uint16_t i);
|
uint16_t int_to_bcd(uint16_t i);
|
||||||
|
int getbutton(uint8_t pinval, uint8_t *button);
|
||||||
|
extern uint8_t getbutton_time;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user