# hal_gw0.c File Reference

Hardware Abstraction Layer (HAL) for the Smith Electronics Zigbee to Ethernet Gateway GW-0. More...

`#include "inc/hw_ints.h"`
`#include "inc/hw_memmap.h"`
`#include "inc/hw_nvic.h"`
`#include "inc/hw_types.h"`
`#include "inc/hw_ssi.h"`
`#include "driverlib/ethernet.h"`
`#include "driverlib/flash.h"`
`#include "driverlib/gpio.h"`
`#include "driverlib/ssi.h"`
`#include "hal_gw0.h"`
`#include "utils/uartstdio.h"`
`#include "inc/hw_uart.h"`
`#include "driverlib/uart.h"`

## Defines
#define | NUM_LEDS 1
#define | HAL_HELPER
## Functions
void | delayMs (unsigned int ms)
void | halInit ()
int | putchar (int c)
void | toggleLed (unsigned char whichLed)
signed int | setLed (unsigned char led)
void | clearLeds ()
void | halSpiInit ()
void | spiWrite (unsigned char *bytes, unsigned char numBytes)

## Detailed Description

Hardware Abstraction Layer (HAL) for the Smith Electronics Zigbee to Ethernet Gateway GW-0.

Tools to interact with the GW-0 onboard peripherals for ZNP interface. The Gw0 is a Zigbee to Ethernet gateway based on the TI LM3S6965 Arm Cortex-M3 processor. Since the GW-0 is an existing Stellaris Project with a ZNP "grafted in", things are a little different here.

The ZNP library & examples require the following methods to be implemented. Refer to individual method descriptions for more information.

- halInit() //Not implemented, handled elsewhere in the project
- putchar() //Not implemented, handled elsewhere in the project
- halSpiInit()
- delayMs()
- halResetZnp()
- toggleLed()

Rev
  535

Author
  dsmith

Date
  2010-05-26 21:35:08 -0700 (Wed, 26 May 2010)

## Define Documentation

#define HAL_HELPER

Configures hardware for the ZNP peripherals

## Function Documentation

void clearLeds | ( |  | ) |

Turns OFF LEDs.

Postcondition:
  LEDs are turned off.

void delayMs | ( | unsigned int | ms | ) |

Blocking Delay in Milliseconds delays by at least the specified number of milliseconds (ms)

Precondition:
  TICKS_PER_MS set

Parameters:

  | ms | number of milliseconds to delay

void halInit | ( |  | ) |

Note:
  It takes five clock cycles after SysCtlPeripheralEnable() is called to enable a peripheral before the the peripheral is actually enabled. During this time, attempts to access the peripheral will result in a bus fault. Care should be taken to ensure that the peripheral is not accessed during this brief time period.

int putchar | ( | int | c | ) |

Standard putchar() for printf() etc. in stdio.h

Precondition:
  UART has been configured.

signed int setLed | ( | unsigned char | led | ) |

Turns ON the specified LED.

Parameters:

  | led | the LED to turn on, must be 0 or 1.

Postcondition:
  The specified LED is turned on.

Returns:
  0 if success, -1 if invalid LED specified

void spiWrite | ( | unsigned char * | bytes,
|  | unsigned char | numBytes |
| ) |  |  |

See Stellaris Application Note spma002.pdf, "Adding 32kB of Serial SRAM to a Stellaris Microcontroller"

void toggleLed | ( | unsigned char | whichLed | ) |

Toggles the specified LED.

Parameters:

  | led | the LED to toggle, must be 0 or 1.

Postcondition:
  The specified LED is toggled.

Returns:
  0 if success, -1 if invalid LED specified

All Files Functions Variables Defines