Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
SMC02B.h
- Committer:
- goncaloc
- Date:
- 2010-10-11
- Revision:
- 3:8595605248a3
- Parent:
- 2:d14838eb6b4b
- Child:
- 4:420e977e37b6
File content as of revision 3:8595605248a3:
/**
* @author Gonçalo Costa
*
* @section LICENSE
*
* Copyright (c) 2010 ARM Limited
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* @section DESCRIPTION
*
* Pololu Micro Dual Serial Motor Controller.
*
* Datasheet:
*
* http://www.pololu.com/file/0J36/smc02b_guide.pdf
*/
#ifndef SMC02B_H
#define SMC02B_H
/**
* Includes
*/
#include "mbed.h"
/**
* Defines
*/
#define SMC02B_START_BYTE 0x80
#define SMC02B_CONFIG_BYTE 0x02
#define SMC02B_DEVICE_ID 0x00
#define SMC02B_BYTE3 0x00
#define SMC02B_BYTE4 0x00
#define SMC02B_MOTOR1_DIR 0x00
#define SMC02B_MOTOR1_SPEED 0x00
#define SMC02B_MOTOR1_NUMBER 0x00
#define SMC02B_MOTOR2_DIR 0x00
#define SMC02B_MOTOR2_SPEED 0x00
#define SMC02B_MOTOR2_NUMBER 0x00
/**
* Pololu Micro Dual Serial Motor Controller.
*/
class SMC02B
{
public:
SMC02B(PinName tx, PinName rx, PinName pin);
void SMC02B_RST(void);
void SMC02B_MOTOR_SET( char motor, char direction, char speed );
void SMC02B_MOTOR_BRAKE( char motor );
void SMC02B_MOTOR_COAST( char motor );
void SMC02B_CONFIG( char mode, char motor );
private:
DigitalOut _rst;
Serial* _SMC02B;
};
#endif