Changeset 1487


Ignore:
Timestamp:
02/26/12 15:55:19 (16 months ago)
Author:
thomas
Message:

leds bsp example app for GINA

Location:
trunk/firmware/openos
Files:
2 added
1 deleted
6 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/firmware/openos/bsp/board.h

    r1415 r1487  
    11/** 
    2 \brief Cross-platform declaration "board" bsp module. 
     2\brief GINA-specific definition of the "board" bsp module. 
    33 
    44\author Thomas Watteyne <watteyne@eecs.berkeley.edu>, February 2012. 
  • trunk/firmware/openos/bsp/gina/board.c

    r1299 r1487  
    11/** 
    2 \brief GINA's board service package 
     2\brief GINA-specific definition of the "board" bsp module. 
    33 
    4 \author Thomas Watteyne <watteyne@eecs.berkeley.edu>, August 2010 
     4\author Thomas Watteyne <watteyne@eecs.berkeley.edu>, February 2012. 
    55*/ 
    66 
     7#include "msp430x26x.h" 
    78#include "board.h" 
    89#include "leds.h" 
    9 #include "msp430x26x.h" 
    10 #include "opentimers.h" 
    11 #include "ieee154etimer.h" 
    12 #include "openserial.h" 
    13 #include "radio.h" 
    14 #include "i2c.h" 
    1510 
    1611//=========================== variables ======================================= 
     
    2419   WDTCTL  = WDTPW + WDTHOLD; 
    2520    
    26    // clock MSP at 16MHz 
    27    BCSCTL1 = CALBC1_16MHZ; 
    28    DCOCTL  = CALDCO_16MHZ; 
     21   // setup clock speed 
     22   BCSCTL1 = CALBC1_16MHZ;                       // MCLK at ~16MHz 
     23   DCOCTL  = CALDCO_16MHZ;                       // MCLK at ~16MHz 
    2924    
    30    // low-level drivers 
     25   // initialize bsp modules 
    3126   leds_init(); 
    32    i2c_init(); 
    33    opentimers_init(); 
    34    ieee154etimer_init(); 
    35    openserial_init(); 
    3627    
    37    // high-level drivers 
    38    radio_init(); 
    39     
    40    // set 'general interrupt enable' bit 
     28   // enable interrupts 
    4129   __bis_SR_register(GIE); 
    4230} 
    4331 
     32void board_sleep() { 
     33   __bis_SR_register(GIE+LPM3_bits);             // sleep, but leave ACLK on 
     34} 
     35 
    4436//=========================== private ========================================= 
  • trunk/firmware/openos/bsp/telosb/board.c

    r1469 r1487  
    77#include "msp430f1611.h" 
    88#include "board.h" 
     9// bsp modules 
    910#include "leds.h" 
    1011#include "uart.h" 
  • trunk/firmware/openos/bsp/telosb/leds.c

    r1467 r1487  
    1717//=========================== public ========================================== 
    1818 
    19 void leds_init() { 
     19void    leds_init() { 
    2020   P5DIR     |=  0x70;                           // P5DIR = 0bx111xxxx for LEDs 
    2121   P5OUT     |=  0x70;                           // P2OUT = 0bx111xxxx, all LEDs off 
    2222} 
    2323 
    24 void leds_error_on() { 
     24void    leds_error_on() { 
    2525   P5OUT     &= ~0x10; 
    2626} 
    27 void leds_error_off() { 
     27void    leds_error_off() { 
    2828   P5OUT     |=  0x10; 
    2929} 
    30 void leds_error_toggle() { 
     30void    leds_error_toggle() { 
    3131   P5OUT     ^=  0x10; 
    3232} 
     33uint8_t leds_error_isOn() { 
     34   return (uint8_t)(P5OUT & 0x10)>>4; 
     35} 
    3336 
    34 void leds_radio_on() { 
     37void    leds_radio_on() { 
    3538   P5OUT     &= ~0x20; 
    3639} 
    37 void leds_radio_off() { 
     40void    leds_radio_off() { 
    3841   P5OUT     |=  0x20; 
    3942} 
    40 void leds_radio_toggle() { 
     43void    leds_radio_toggle() { 
    4144   P5OUT     ^=  0x20; 
    4245} 
     46uint8_t leds_radio_isOn() { 
     47   return (uint8_t)(P5OUT & 0x20)>>5; 
     48} 
    4349 
    44 void leds_sync_on() { 
     50void    leds_sync_on() { 
    4551   P5OUT     &= ~0x40; 
    4652} 
    47 void leds_sync_off() { 
     53void    leds_sync_off() { 
    4854   P5OUT     |=  0x40; 
    4955} 
    50 void leds_sync_toggle() { 
     56void    leds_sync_toggle() { 
    5157   P5OUT     ^=  0x40; 
    5258} 
     59uint8_t leds_sync_isOn() { 
     60   return (uint8_t)(P5OUT & 0x40)>>6; 
     61} 
    5362 
    54 void leds_all_on() { 
     63void    leds_debug_on() { 
     64   // TelosB doesn't have a debug LED :( 
     65} 
     66void    leds_debug_off() { 
     67   // TelosB doesn't have a debug LED :( 
     68} 
     69void    leds_debug_toggle() { 
     70   // TelosB doesn't have a debug LED :( 
     71} 
     72uint8_t leds_debug_isOn() { 
     73   // TelosB doesn't have a debug LED :( 
     74   return 0; 
     75} 
     76 
     77void    leds_all_on() { 
    5578   P5OUT     &= ~0x70; 
    5679} 
    57 void leds_all_off() { 
     80void    leds_all_off() { 
    5881   P5OUT     |=  0x70; 
    5982} 
    60 void leds_all_toggle() { 
     83void    leds_all_toggle() { 
    6184   P5OUT     ^=  0x70; 
    6285} 
    6386 
    64 void leds_circular_shift() { 
     87void    leds_circular_shift() { 
    6588   uint8_t leds_on; 
    6689   // get LED state 
     
    82105} 
    83106 
    84 void leds_increment() { 
     107void    leds_increment() { 
    85108   uint8_t leds_on; 
    86109   // get LED state 
  • trunk/firmware/openos/gina.eww

    r1486 r1487  
    22 
    33<workspace> 
     4  <project> 
     5    <path>$WS_DIR$\projects\gina\01-bsp\01bsp_leds.ewp</path> 
     6  </project> 
    47  <project> 
    58    <path>$WS_DIR$\projects\gina\test_leds_xtal.ewp</path> 
  • trunk/firmware/openos/projects/common/01-bsp/01bsp_leds.c

    r1484 r1487  
    2828   leds_sync_off(); 
    2929   leds_sync_toggle(); 
     30   leds_debug_on(); 
     31   leds_debug_off(); 
     32   leds_debug_toggle(); 
    3033   leds_sync_toggle(); 
    3134   leds_circular_shift(); 
  • trunk/firmware/openos/projects/gina/01-bsp

    • Property svn:ignore set to
      *.dep
      Debug
      settings
      path.txt
Note: See TracChangeset for help on using the changeset viewer.