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.
MAX6955.cpp
- Committer:
- lonesometraveler
- Date:
- 2011-08-02
- Revision:
- 0:8c7de3096cac
- Child:
- 1:8936ddb97551
File content as of revision 0:8c7de3096cac:
#include "MAX6955.h"
MAX6955::MAX6955(PinName sda, PinName scl, char driver): i2c_(sda, scl), driver_(driver){}
int MAX6955::write(char command, char data){
char i2cData[2];
i2cData[0] = command;
i2cData[1] = data;
int result = i2c_.write(driver_, i2cData, 2);
wait(0.07);
return result;
}
int MAX6955::writeS(char* buffer){
int result = i2c_.write(driver_, (char *) buffer, 8);
wait(0.07);
return result;
}
int MAX6955::init(){
int result = 0;
result = result + write(reg_decodeMode, 0x00);
result = result + write(reg_scanLimit, 0x07);
result = result + write(reg_configuration, 0x21);
result = result + write(reg_globalIntensity, 0x08);
result = result + write(reg_digitType, 0xFF);
result = result + write(reg_displayTest, 0x00);
return result;
}