Merge branch 'master' of ssh://ukleos.des-mesh.net/home/git/ukleos
Conflicts: board/msb-430-common/Jamfile
This commit is contained in:
commit
79ca45df9c
@ -2,7 +2,7 @@ SubDir TOP board chronos ;
|
||||
|
||||
HDRS += $(TOP)/board/$(CPU)/include ;
|
||||
|
||||
Module board : debug_uart.c board_init.c ;
|
||||
Module board : putchar.c board_init.c ;
|
||||
UseModule board ;
|
||||
|
||||
SubInclude TOP board $(BOARD) drivers ;
|
||||
|
||||
@ -1,21 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include "board.h"
|
||||
|
||||
#define UART1_TX TXBUF1
|
||||
#define UART1_WAIT_TXDONE() while( (UTCTL1 & TXEPT) == 0 ) { _NOP(); }
|
||||
|
||||
|
||||
int putchar(int c)
|
||||
{
|
||||
// UART1_TX = c;
|
||||
// UART1_WAIT_TXDONE();
|
||||
//
|
||||
// if (c == 10) {
|
||||
// UART1_TX = 13;
|
||||
// UART1_WAIT_TXDONE();
|
||||
// }
|
||||
|
||||
return c;
|
||||
}
|
||||
|
||||
|
||||
@ -5,3 +5,5 @@ HDRS += $(TOP)/board/$(CPU)/drivers/include ;
|
||||
Module board_display : display.c display1.c ;
|
||||
Module board_cc110x : cc430-cc110x.c : cc110x_cc430 ;
|
||||
Module board_buzzer : buzzer.c : hwtimer ;
|
||||
|
||||
Module display_putchar : display_putchar.c : board_display ;
|
||||
|
||||
42
board/chronos/drivers/display_putchar.c
Normal file
42
board/chronos/drivers/display_putchar.c
Normal file
@ -0,0 +1,42 @@
|
||||
#include <stdio.h>
|
||||
#include <display.h>
|
||||
#include <string.h>
|
||||
|
||||
extern int toupper(int c);
|
||||
extern void (*_putchar)(int c);
|
||||
|
||||
static char display_buf[11];
|
||||
|
||||
void putchar_to_display();
|
||||
|
||||
void init_display_putchar() {
|
||||
memset(display_buf, '\0', 11);
|
||||
_putchar = putchar_to_display;
|
||||
}
|
||||
|
||||
void putchar_to_display(int c) {
|
||||
if (c == '\n') {
|
||||
display_buf[4] = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
if (display_buf[4]) {
|
||||
memset(display_buf, '\0', 11);
|
||||
} else {
|
||||
display_buf[0] = display_buf[1];
|
||||
display_buf[1] = display_buf[2];
|
||||
display_buf[2] = display_buf[3];
|
||||
display_buf[3] = display_buf[5];
|
||||
display_buf[5] = display_buf[6];
|
||||
display_buf[6] = display_buf[7];
|
||||
display_buf[7] = display_buf[8];
|
||||
display_buf[8] = display_buf[9];
|
||||
}
|
||||
|
||||
display_buf[9] = toupper(c);
|
||||
|
||||
clear_display_all();
|
||||
|
||||
display_chars(LCD_SEG_L1_3_0, display_buf, SEG_ON);
|
||||
display_chars(LCD_SEG_L2_5_0, display_buf+4, SEG_ON);
|
||||
}
|
||||
6
board/chronos/drivers/include/display_putchar.h
Normal file
6
board/chronos/drivers/include/display_putchar.h
Normal file
@ -0,0 +1,6 @@
|
||||
#ifndef __DISPLAY_PUTCHAR_H
|
||||
#define __DISPLAY_PUTCHAR_H
|
||||
|
||||
void init_display_putchar();
|
||||
|
||||
#endif /* __DISPLAY_PUTCHAR_H */
|
||||
11
board/chronos/putchar.c
Normal file
11
board/chronos/putchar.c
Normal file
@ -0,0 +1,11 @@
|
||||
static void _dummy(int c) {
|
||||
}
|
||||
|
||||
void (*_putchar)(int c) = _dummy;
|
||||
|
||||
int putchar(int c)
|
||||
{
|
||||
_putchar(c);
|
||||
return c;
|
||||
}
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
|
||||
SubDir TOP board msb-430-common ;
|
||||
|
||||
Module board : board_init.c debug_uart.c ;
|
||||
Module board : board_init.c uart1.c ;
|
||||
Module board_config : board_config.c : flashrom ;
|
||||
UseModule board ;
|
||||
|
||||
|
||||
7
board/msb-430-common/putchar.c
Normal file
7
board/msb-430-common/putchar.c
Normal file
@ -0,0 +1,7 @@
|
||||
#include <stdio.h>
|
||||
|
||||
void (_putchar(int)) = uart1_putchar;
|
||||
|
||||
void putchar(int c) {
|
||||
_putchar(c);
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
SubDir TOP projects hi_earth ;
|
||||
|
||||
Module hi_earth : main.c : board_display hwtimer auto_init ;
|
||||
Module hi_earth : main.c : auto_init display_putchar ;
|
||||
|
||||
UseModule hi_earth ;
|
||||
|
||||
@ -1,61 +1,9 @@
|
||||
//******************************************************************************
|
||||
// eZ430 chronos hello world
|
||||
// Description: initializes lcd module and shows the string 'hi earth' on the
|
||||
// lcd display becuase 'hello world' is too long
|
||||
// Author: Felix Genicio
|
||||
//******************************************************************************
|
||||
|
||||
#include <cc430x613x.h>
|
||||
#include <string.h>
|
||||
#include <display.h>
|
||||
#include <hwtimer.h>
|
||||
|
||||
void display1(void);
|
||||
void display2(void);
|
||||
#include <stdio.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
lcd_init();
|
||||
|
||||
clear_display_all();
|
||||
|
||||
uint8_t i = 0;
|
||||
uint16_t j;
|
||||
printf("Hi Earth\n");
|
||||
|
||||
while(1) {
|
||||
if (i) {
|
||||
i = 0;
|
||||
display1();
|
||||
}
|
||||
else {
|
||||
i = 1;
|
||||
display2();
|
||||
}
|
||||
for (j = 1; j < 10; j++) {
|
||||
hwtimer_wait(3333);
|
||||
}
|
||||
display_symbol(5, SEG_ON);
|
||||
/*
|
||||
for (j = 1; j != 0; j++) {
|
||||
if (i) {
|
||||
display_symbol(LCD_ICON_BEEPER1, SEG_ON);
|
||||
}
|
||||
else {
|
||||
display_symbol(5, SEG_OFF);
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
void display1(void) {
|
||||
display_chars(LCD_SEG_L1_3_0, "HI", SEG_ON);
|
||||
display_chars(LCD_SEG_L2_5_0, " EARTH", SEG_OFF);
|
||||
}
|
||||
|
||||
void display2(void) {
|
||||
display_chars(LCD_SEG_L1_3_0, "HI", SEG_OFF);
|
||||
display_chars(LCD_SEG_L2_5_0, (char*) itoa(TA0R, 6, 0), SEG_ON);
|
||||
// display_chars(LCD_SEG_L2_5_0, (uint8_t*) " EARTH", SEG_ON);
|
||||
}
|
||||
|
||||
|
||||
@ -10,6 +10,16 @@
|
||||
extern void main(void);
|
||||
|
||||
void auto_init(void) {
|
||||
#ifdef MODULE_BOARD_DISPLAY
|
||||
extern void lcd_init();
|
||||
lcd_init();
|
||||
DEBUG("DISP OK");
|
||||
#endif
|
||||
#ifdef MODULE_DISPLAY_PUTCHAR
|
||||
extern void init_display_putchar();
|
||||
init_display_putchar();
|
||||
DEBUG("DISP OK");
|
||||
#endif
|
||||
#ifdef MODULE_HWTIMER
|
||||
DEBUG("Auto init hwtimer module.\n");
|
||||
hwtimer_init();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user