# SFBHWPWM.h

Go to the documentation of this file.

    00001 /*                                              -*- mode:C++; fill-column:100 -*-
    00002   SFBHWPWM.h - Support for h/w-based Pulse Width Modulation
    00003   Copyright (C) 2009 The Regents of the University of New Mexico.  All rights reserved.
    00004
    00005   This library is free software; you can redistribute it and/or
    00006   modify it under the terms of the GNU Lesser General Public
    00007   License as published by the Free Software Foundation; either
    00008   version 2.1 of the License, or (at your option) any later version.
    00009
    00010   This library is distributed in the hope that it will be useful,
    00011   but WITHOUT ANY WARRANTY; without even the implied warranty of
    00012   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00013   Lesser General Public License for more details.
    00014
    00015   You should have received a copy of the GNU General Public License
    00016   along with this library; if not, write to the Free Software
    00017   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
    00018   USA
    00019 */
    00020
    00028 #ifndef SFBHWPWM_H_
    00029 #define SFBHWPWM_H_
    00030
    00031 #include "SFBTypes.h"
    00032
    00036 void PWMStart();
    00037
    00041 void PWMStop();
    00042
    00046 enum PWMChannelModes {
    00047   PWM_INACTIVE,
    00048   PWM_SINGLE_EDGE,
    00049   PWM_DOUBLE_EDGE,
    00050   PWM_CHANNEL_MODES_MAX
    00051 };
    00052
    00064 void PWMSetMode(u32 pwmIndex, u32 mode);
    00065
    00081 void PWMSetWidth(u32 pwmIndex, u32 width, bool commit = true);
    00082
    00089 u32 PWMGetWidth(u32 pwmIndex);
    00090
    00091
    00102 int PWMFindIndex(int sfbPin);
    00103
    00110 u32 PWMGetPin(u32 pwmIndex);
    00111
    00134 u32 PWMGetChannel(u32 pwmIndex);
    00135
    00163 enum PWMIndices {
    00164   PWM_BODY_RGB_RED_PIN,
    00165   PWM_BODY_RGB_GREEN_PIN,
    00166   PWM_BODY_RGB_BLUE_PIN,
    00167   PWM_NORTH_LED_PIN,
    00168   PWM_SOUTH_LED_PIN,
    00169   PWM_EAST_LED_PIN,
    00170   PWM_WEST_D0_PIN,
    00171   PWM_WEST_D2_PIN,
    00172   PWM_WEST_D3_PIN,
    00173   PWM_EAST_D1_PIN,
    00174   PWM_EAST_D3_PIN
    00175 };
    00176
    00177 #endif /*SFBHWPWM_H_*/