1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-18 12:52:44 +01:00

[Chronos]

* changed display driver interface from uint8_t* to char*
* fixed hardware timer interrupt
* ported cc1100 driver
* added simple test application for radio

[msb430]
* fixex config and flashrom

[cc110x_ng]
* removed dependency from sysconfig
This commit is contained in:
Oliver Hahm 2010-12-09 13:24:24 +01:00
parent a356dc2494
commit cf3b704bc5
7 changed files with 43 additions and 27 deletions

View File

@ -2,13 +2,15 @@
#include <cpu.h>
#include <irq.h>
#include <cc1100_ng.h>
#include <arch_cc1100.h>
#warning CC430_CC1100 NOT WORKING
/* TODO: defines... */
#define CC1100_GDO0 (0)
#define CC1100_GDO1 (1)
#define CC1100_GDO2 (2)
#include <cc430_.h>
#include <msp430/rf1a.h>
#define CC1100_GDO0 IOCFG0
#define CC1100_GDO1 IOCFG1
#define CC1100_GDO2 IOCFG2
int cc1100_get_gdo0(void) {
return CC1100_GDO0;
@ -35,15 +37,23 @@ void cc1100_after_send(void)
}
void cc1100_gdo0_enable(void) {
RF1AIFG &= ~RF1AIV_RFIFG0;
RF1AIE |= RF1AIV_RFIFG0;
}
void cc1100_gdo0_disable(void) {
RF1AIE &= ~RF1AIV_RFIFG0;
RF1AIFG &= ~RF1AIV_RFIFG0;
}
void cc1100_gdo2_disable(void) {
RF1AIFG &= ~RF1AIV_RFIFG2;
RF1AIE &= ~RF1AIV_RFIFG2;
}
void cc1100_gdo2_enable(void) {
RF1AIE &= ~RF1AIV_RFIFG2;
RF1AIFG |= RF1AIV_RFIFG2;
}
void cc1100_init_interrupts(void) {
@ -51,16 +61,17 @@ void cc1100_init_interrupts(void) {
restoreIRQ(state); /* Enable all interrupts */
}
interrupt (PORT2_VECTOR) __attribute__ ((naked)) cc1100_isr(void){
interrupt (CC1101_VECTOR) __attribute__ ((naked)) cc1100_isr(void){
__enter_isr();
/* Check IFG */
if (1 == 1) {
if (RF1AIFG & RF1AIV_RFIFG2) {
RF1AIFG &= ~RF1AIV_RFIFG2;
cc1100_gdo2_irq();
}
else if (2 == 2) {
if (RF1AIFG & RF1AIV_RFIFG0) {
RF1AIFG &= ~RF1AIV_RFIFG0;
RF1AIE &= ~RF1AIV_RFIFG0;
cc1100_gdo0_irq();
} else {
puts("cc1100_isr(): unexpected IFG!");
}
__exit_isr();
}

View File

@ -43,18 +43,15 @@
#include <string.h>
// driver
#include "cc430x613x.h"
#include "display.h"
#include <cc430x613x.h>
#include <display.h>
// *************************************************************************************************
// Prototypes section
void write_lcd_mem(uint8_t * lcdmem, uint8_t bits, uint8_t bitmask, uint8_t state);
void write_lcd_mem(uint8_t *lcdmem, uint8_t bits, uint8_t bitmask, uint8_t state);
void clear_line(uint8_t line);
void display_symbol(uint8_t symbol, uint8_t mode);
void display_char(uint8_t segment, uint8_t chr, uint8_t mode);
void display_chars(uint8_t segments, uint8_t * str, uint8_t mode);
// *************************************************************************************************
// Defines section
@ -285,12 +282,12 @@ uint8_t * itoa(uint32_t n, uint8_t digits, uint8_t blanks)
// *************************************************************************************************
void display_value1(uint8_t segments, uint32_t value, uint8_t digits, uint8_t blanks, uint8_t disp_mode)
{
uint8_t * str;
uint8_t* str;
str = itoa(value, digits, blanks);
// Display string in blink mode
display_chars(segments, str, disp_mode);
display_chars(segments, (char*) str, disp_mode);
}
@ -332,7 +329,7 @@ void display_symbol(uint8_t symbol, uint8_t mode)
// uint8_t mode SEG_ON, SEG_OFF, SEG_BLINK
// @return none
// *************************************************************************************************
void display_char(uint8_t segment, uint8_t chr, uint8_t mode)
void display_char(uint8_t segment, char chr, uint8_t mode)
{
uint8_t * lcdmem; // Pointer to LCD memory
uint8_t bitmask; // Bitmask for character
@ -393,8 +390,7 @@ void display_char(uint8_t segment, uint8_t chr, uint8_t mode)
// uint8_t mode SEG_ON, SEG_OFF, SEG_BLINK
// @return none
// *************************************************************************************************
void display_chars(uint8_t segments, uint8_t * str, uint8_t mode)
{
void display_chars(uint8_t segments, char *str, uint8_t mode) {
uint8_t i;
uint8_t length = 0; // Write length
uint8_t char_start = 0; // Starting point for consecutive write

View File

@ -337,8 +337,8 @@ void clear_blink_mem(void);
void set_blink_rate(uint8_t bits);
// Character / symbol draw functions
void display_char(uint8_t segment, uint8_t chr, uint8_t mode);
void display_chars(uint8_t segments, uint8_t * str, uint8_t mode);
void display_char(uint8_t segment, char chr, uint8_t mode);
void display_chars(uint8_t segments, char* str, uint8_t mode);
void display_symbol(uint8_t symbol, uint8_t mode);
// Time display function

View File

@ -28,7 +28,7 @@
SubDir TOP board msb-430-common ;
Module board : board_init.c debug_uart.c ;
Module config : config.c ;
Module board_config : board_config.c ;
UseModule board ;
SubInclude TOP cpu $(CPU) ;

View File

@ -1,8 +1,18 @@
#include <stdint.h>
#include <string.h>
#include <board-conf.h>
#include <config.h>
#include <flashrom.h>
void config_load(void) {
if (*((uint16_t*) INFOMEM) == CONFIG_KEY) {
memcpy(&sysconfig, (char*) (INFOMEM + sizeof(CONFIG_KEY)), sizeof(sysconfig));
}
else {
config_save();
}
}
uint8_t config_save(void) {
configmem_t mem = { CONFIG_KEY, sysconfig };
return (flashrom_erase((uint8_t*) INFOMEM) && flashrom_write((uint8_t*) INFOMEM, (char*) &mem, sizeof(mem)));

View File

@ -27,7 +27,7 @@
SubDir TOP board msb-430h ;
Module board_cc1100 : driver_cc1100.c ;
Module board_cc1100 : driver_cc1100.c : cc110x_spi ;
SubInclude TOP board msb-430-common ;
SubInclude TOP cpu $(CPU) ;

View File

@ -23,7 +23,7 @@ Boston, MA 02111-1307, USA. */
#include <cpu.h>
#include <irq.h>
#include <cc1100.h>
#include <cc1100_ng.h>
#include <arch_cc1100.h>
#define CC1100_GDO0 (P2IN & 0x02) // read serial I/O (GDO0)
@ -340,4 +340,3 @@ puts("cc1100_isr()");
// if (system_state.POWERDOWN != 0) END_LPM3;
__exit_isr();
}