Zigbee Module Examples

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions
hal_msp430x2xxx_usci.c File Reference

Hardware Abstraction Layer (HAL) for the TI MSP430F2xxx series of microcontrollers. More...

`#include "hal_msp430x2xxx_usci.h"`

## Functions
signed int | halUartInit (unsigned char port, unsigned char baudRate)
signed int | halUartCharPut (unsigned char port, unsigned char data)
signed int | halSpiInit (unsigned char port, unsigned char baudRate)
signed int | halSpiWrite (unsigned char port, unsigned char *bytes, unsigned char numBytes)

## Detailed Description

Hardware Abstraction Layer (HAL) for the TI MSP430F2xxx series of microcontrollers.

This file contains generic utilities for using this processor.

Rev:
  1528

Author:
  dsmith

Date:
  2012-08-30 15:58:08 -0700 (Thu, 30 Aug 2012)

# Support

Please refer to the wiki at www.anaren.com/air-wiki-zigbee for more information. Additional support is available via email at the following addresses:

- Questions on how to use the product: AIR@a.nosp@m.nare.nosp@m.n.com
- Feature requests, comments, and improvements: featu.nosp@m.rere.nosp@m.quest.nosp@m.s@te.nosp@m.slaco.nosp@m.ntro.nosp@m.ls.co.nosp@m.m
- Consulting engagements: sales.nosp@m.@tes.nosp@m.lacon.nosp@m.trol.nosp@m.s.com

# License

Copyright (c) 2012 Tesla Controls. All rights reserved. This Software may only be used with an Anaren A2530E24AZ1, A2530E24CZ1, A2530R24AZ1, or A2530R24CZ1 module. Redistribution and use in source and binary forms, with or without modification, are subject to the Software License Agreement in the file "anaren_eula.txt"

YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL ANAREN MICROWAVE OR TESLA CONTROLS BE LIABLE OR OBLIGATED UNDER CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSE INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.

## Function Documentation

signed int halSpiInit | ( | unsigned char | port,
|  | unsigned char | baudRate
| ) |  |

Configures the selected SPI port.

Parameters:

  port | must be USCIB0

Note:
  CC2530 SPI clock speed < 4MHz. SPI port configured for clock polarity of 0, clock phase of 0, and MSB first.
  On MDB the RFIC SPI port is USCIB1
  Modify this method for other hardware implementations.

Precondition:
  SPI pins configured correctly: Clock, MOSI, MISO configured as SPI function; Chip Select configured as an output; SRDY configured as an input.

Postcondition:
  SPI port is configured for RFIC communications.

Note:
  immediately after calling this method you should call SPI_SS_CLEAR()

Todo:
  implement baudRate

signed int halSpiWrite | ( | unsigned char | port,
|  | unsigned char * | bytes,
|  | unsigned char | numBytes
| ) |  |

Sends a message over SPI on USCI_B1. To read data out, you must write data in. To Write, set *bytes, numBytes. To Read, set *bytes only. Don't need to set numBytes because CC2530ZNP will stop when no more bytes read.

Parameters:

  bytes | the data to be sent or received.
  numBytes | the number of bytes to be sent. This same buffer will be overwritten with the received data.

Note:
  Modify this method for other hardware implementations.

Precondition:
  SPI port configured for writing
  Peripheral has been initialized

Postcondition:
  bytes contains received data, if any

Returns:
  0 if success, -1 if incorrect port

Note:
  - chip select should be controlled in the wrapping function with SPI_SS_SET() and SPI_SS_CLEAR()

signed int halUartCharPut | ( | unsigned char | port,
|  | unsigned char | data
| ) |  |

    Send one character out the specified port. Used in putchar().

Note, in putchar, must convert to unsigned char, e.g. int putchar(int b) { halUartCharPut(p, (unsigned char) (b & 0xFF)); return b; }

Parameters:

  port | must be USCIA0 or USCIA1
  the | data to send

Returns:
  the data if success, else ERROR_HAL_INVALID_USCI_PORT if bad port.

signed int halUartInit | ( | unsigned char | port,
|  | unsigned char | baudRate
| ) |  |

    Configures the selected port.

Also enables the Rx interrupt for this UART.

Parameters:

  port | must be USCIA0 or USCIA1
  baudRate | must be BAUD_RATE_9600, BAUD_RATE_19200, BAUD_RATE_38400, or BAUD_RATE_115200

Precondition:
  SMCLK is 4MHz

See also:
  Table 15-5 of MSP430F2xxx Family User's Guide, slau144

Returns:
  0 if success, else an error