mirror of
https://github.com/oliverschmidt/contiki.git
synced 2024-12-23 01:29:33 +00:00
LEDs now indicate bit position (instead of (1 << pos)) which is more
consistent with how everything else works
This commit is contained in:
parent
c218d1bffa
commit
4b17c144d0
@ -1,9 +1,9 @@
|
||||
#ifndef BOARD_REDBEE_DEV_H
|
||||
#define BOARD_REDBEE_DEV_H
|
||||
|
||||
#define LED_RED (1 << 23)
|
||||
#define LED_GREEN (1 << 24)
|
||||
#define LED_BLUE (1 << 25)
|
||||
#define LED_RED 23
|
||||
#define LED_GREEN 24
|
||||
#define LED_BLUE 25
|
||||
|
||||
/* XTAL TUNE parameters */
|
||||
/* see http://devl.org/pipermail/mc1322x/2009-December/000162.html */
|
||||
|
@ -1,9 +1,9 @@
|
||||
#ifndef BOARD_REDBEE_DEV_H
|
||||
#define BOARD_REDBEE_DEV_H
|
||||
|
||||
#define LED_RED (1 << 23)
|
||||
#define LED_GREEN (1 << 24)
|
||||
#define LED_BLUE (1 << 25)
|
||||
#define LED_RED 12
|
||||
#define LED_GREEN 21
|
||||
#define LED_BLUE 35
|
||||
|
||||
/* XTAL TUNE parameters */
|
||||
/* see http://devl.org/pipermail/mc1322x/2009-December/000162.html */
|
||||
|
@ -1,9 +1,9 @@
|
||||
#ifndef BOARD_REDBEE_R1_H
|
||||
#define BOARD_REDBEE_R1_H
|
||||
|
||||
#define LED_RED (1 << 8)
|
||||
#define LED_GREEN (1 << 9)
|
||||
#define LED_BLUE (1 << 10)
|
||||
#define LED_RED 8
|
||||
#define LED_GREEN 9
|
||||
#define LED_BLUE 10
|
||||
|
||||
/* XTAL TUNE parameters */
|
||||
/* see http://devl.org/pipermail/mc1322x/2009-December/000162.html */
|
||||
|
@ -16,6 +16,11 @@
|
||||
#define GPIO_PAD_PU_SEL0 ((volatile uint32_t *) 0x80000030)
|
||||
#define GPIO_PAD_PU_SEL1 ((volatile uint32_t *) 0x80000034)
|
||||
|
||||
#define GPIO_DATA_SET0 ((volatile uint32_t *) 0x80000048)
|
||||
#define GPIO_DATA_SET1 ((volatile uint32_t *) 0x8000004c)
|
||||
#define GPIO_DATA_RESET0 ((volatile uint32_t *) 0x80000050)
|
||||
#define GPIO_DATA_RESET1 ((volatile uint32_t *) 0x80000054)
|
||||
|
||||
|
||||
/* select pullup or pulldown for GPIO 0-31 (b=0-31) */
|
||||
#define gpio_sel0_pullup(b) (set_bit(reg32(GPIO_PAD_PU_SEL0),b))
|
||||
|
@ -3,16 +3,16 @@
|
||||
|
||||
#define DELAY 400000
|
||||
|
||||
#define LED_BITS LED_BLUE
|
||||
#define LED LED_BLUE
|
||||
|
||||
void main(void) {
|
||||
volatile uint32_t i;
|
||||
|
||||
*GPIO_PAD_DIR0 = LED_BITS;
|
||||
*GPIO_PAD_DIR0 = ( 1<< LED );
|
||||
|
||||
while(1) {
|
||||
|
||||
*GPIO_DATA0 = LED_BITS;
|
||||
*GPIO_DATA0 = (1 << LED );
|
||||
|
||||
for(i=0; i<DELAY; i++) { continue; }
|
||||
|
||||
|
@ -3,16 +3,16 @@
|
||||
|
||||
#define DELAY 400000
|
||||
|
||||
#define LED_BITS LED_GREEN
|
||||
#define LED LED_GREEN
|
||||
|
||||
void main(void) {
|
||||
volatile uint32_t i;
|
||||
|
||||
*GPIO_PAD_DIR0 = LED_BITS;
|
||||
*GPIO_PAD_DIR0 = ( 1<< LED );
|
||||
|
||||
while(1) {
|
||||
|
||||
*GPIO_DATA0 = LED_BITS;
|
||||
*GPIO_DATA0 = (1 << LED );
|
||||
|
||||
for(i=0; i<DELAY; i++) { continue; }
|
||||
|
||||
|
@ -3,16 +3,16 @@
|
||||
|
||||
#define DELAY 400000
|
||||
|
||||
#define LED_BITS LED_RED
|
||||
#define LED LED_RED
|
||||
|
||||
void main(void) {
|
||||
volatile uint32_t i;
|
||||
|
||||
*GPIO_PAD_DIR0 = LED_BITS;
|
||||
*GPIO_PAD_DIR0 = ( 1<< LED );
|
||||
|
||||
while(1) {
|
||||
|
||||
*GPIO_DATA0 = LED_BITS;
|
||||
*GPIO_DATA0 = (1 << LED );
|
||||
|
||||
for(i=0; i<DELAY; i++) { continue; }
|
||||
|
||||
|
@ -1,20 +1,18 @@
|
||||
#include <mc1322x.h>
|
||||
#include <board.h>
|
||||
|
||||
#include "led.h"
|
||||
|
||||
#define DELAY 400000
|
||||
|
||||
#define LED_BITS LED_WHITE
|
||||
#define LED LED_WHITE
|
||||
|
||||
void main(void) {
|
||||
volatile uint32_t i;
|
||||
|
||||
*GPIO_PAD_DIR0 = LED_BITS;
|
||||
*GPIO_PAD_DIR0 = ( 1<< LED );
|
||||
|
||||
while(1) {
|
||||
|
||||
*GPIO_DATA0 = LED_BITS;
|
||||
*GPIO_DATA0 = (1 << LED );
|
||||
|
||||
for(i=0; i<DELAY; i++) { continue; }
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
#ifndef LED_H
|
||||
#define LED_H
|
||||
|
||||
#define LED_YELLOW (LED_RED | LED_GREEN )
|
||||
#define LED_PURPLE (LED_RED | LED_BLUE)
|
||||
#define LED_CYAN ( LED_GREEN | LED_BLUE)
|
||||
#define LED_WHITE (LED_RED | LED_GREEN | LED_BLUE)
|
||||
#define LED_YELLOW ((1 << LED_RED) | (1 << LED_GREEN) )
|
||||
#define LED_PURPLE ((1 << LED_RED) | (1 << LED_BLUE))
|
||||
#define LED_CYAN ( (1 << LED_GREEN) | (1 << LED_BLUE))
|
||||
#define LED_WHITE ((1 << LED_RED) | (1 << LED_GREEN) | (1 << LED_BLUE))
|
||||
|
||||
#endif
|
||||
|
@ -5,11 +5,17 @@
|
||||
#include "tests.h"
|
||||
#include "config.h"
|
||||
|
||||
#define DEBUG_MACA 1
|
||||
#define LED LED_GREEN
|
||||
|
||||
void main(void) {
|
||||
volatile packet_t *p;
|
||||
|
||||
*GPIO_DATA0 = 0x00000000;
|
||||
*GPIO_PAD_DIR0 = ( 1 << LED );
|
||||
/* read from the data register instead of the pad */
|
||||
/* this is needed because the led clamps the voltage low */
|
||||
*GPIO_DATA_SEL0 = ( 1 << LED );
|
||||
|
||||
uart_init(INC,MOD);
|
||||
|
||||
print_welcome("rftest-rx");
|
||||
@ -35,6 +41,7 @@ void main(void) {
|
||||
|
||||
while(1) {
|
||||
if((p = rx_packet())) {
|
||||
toggle_gpio0(LED);
|
||||
/* print and free the packet */
|
||||
printf("rftest-rx --- ");
|
||||
print_packet(p);
|
||||
|
@ -33,21 +33,6 @@ uint32_t ackBox[10];
|
||||
}while(0)
|
||||
|
||||
|
||||
volatile uint8_t led;
|
||||
#define LED LED_RED
|
||||
#define led_on() do { led = 1; *GPIO_DATA0 = LED; } while(0);
|
||||
#define led_off() do { led = 0; *GPIO_DATA0 = 0x00000000; } while(0);
|
||||
|
||||
void toggle_led(void) {
|
||||
if(0 == led) {
|
||||
led_on();
|
||||
led = 1;
|
||||
|
||||
} else {
|
||||
led_off();
|
||||
}
|
||||
}
|
||||
|
||||
volatile uint8_t *data;
|
||||
uint8_t count=0;
|
||||
void fill_data(void) {
|
||||
|
@ -27,18 +27,19 @@ void print_welcome(char* testname) {
|
||||
printf("board: %s\n\r", STR2(BOARD));
|
||||
}
|
||||
|
||||
void print_packet(packet_t *p) {
|
||||
void print_packet(volatile packet_t *p) {
|
||||
volatile uint8_t i,j,k;
|
||||
#define PER_ROW 16
|
||||
if(p) {
|
||||
printf("len 0x%02x\n\r",p->length);
|
||||
for(j=0, k=0; j < ((p->length)%PER_ROW)-1; j++) {
|
||||
for(i=0; i < PER_ROW; i++, k++) {
|
||||
if(k>=p->length) { break; }
|
||||
if(k >= (p->length + 1) ) { goto out; } /* + 1 since first byte is len+2 */
|
||||
printf("%02x ",p->data[j*PER_ROW+i]);
|
||||
}
|
||||
printf("\n\r");
|
||||
}
|
||||
out:
|
||||
printf("\n\r");
|
||||
}
|
||||
return;
|
||||
|
@ -9,6 +9,14 @@
|
||||
void uart1_init(uint16_t inc, uint16_t mod);
|
||||
void print_welcome(char* testname);
|
||||
void dump_regs(uint32_t base, uint32_t len);
|
||||
void print_packet(packet_t *p);
|
||||
void print_packet(volatile packet_t *p);
|
||||
|
||||
#define toggle_gpio0(x) do { \
|
||||
if(bit_is_set(*GPIO_DATA0,x)) { \
|
||||
*GPIO_DATA_RESET0 = (1 << x); \
|
||||
} else { \
|
||||
*GPIO_DATA_SET0 = (1 << x) ; \
|
||||
} \
|
||||
} while(0);
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user