<commit_before>'use strict';

var device = require('./device'),
    write = device.writer('/dev/lms_pwm');

/*
 * motorPorts: [0x00..0x0F] Bit field representing motor port A to D
 */
exports.resetTachoCount = function (motorPorts, callback) {
    var buffer = new Buffer(2);

    buffer[0] = 0xB2;
    buffer[1] = motorPorts;

    write(buffer, callback);
};

/*
 * polarity: [+-0..1] Polarity +-1, 0=toggle (multiplied to SPEED and POWER)
 * motorPorts: [0x00..0x0F] Bit field representing motor port A to D
 */
exports.setPolarity = function (polarity, motorPorts, callback) {
    var buffer = new Buffer(3);

    buffer[0] = 0xA7;
    buffer[1] = motorPorts;
    buffer[2] = polarity;

    write(buffer, callback);
};

/*
 * power: [+-0..100%] Power relative to polarity
 * motorPorts: [0x00..0x0F] Bit field representing motor port A to D
 */
exports.setPower = function (power, motorPorts, callback) {
    var buffer = new Buffer(3);

    buffer[0] = 0xA4;
    buffer[1] = motorPorts;
    buffer[2] = power;

    write(buffer, callback);
};

/*
 * speed: [+-0..100%] Speed relative to polarity (0->BRAKE)
 * motorPorts: [0x00..0x0F] Bit field representing motor port A to D
 */
exports.setSpeed = function (speed, motorPorts, callback) {
    var buffer = new Buffer(3);

    buffer[0] = 0xA5;
    buffer[1] = motorPorts;
    buffer[2] = speed;

    write(buffer, callback);
};

/*
 * motorPorts: [0x00..0x0F] Bit field representing motor port A to D
 */
exports.start = function (motorPorts, callback) {
    var buffer = new Buffer(2);

    buffer[0] = 0xA6;
    buffer[1] = motorPorts;

    write(buffer, callback);
};

/*
 * state: [boolean] State after stop (false=Coast, true=Brake)
 * motorPorts: [0x00..0x0F] Bit field representing motor port A to D
 */
exports.stop = function (state, motorPorts, callback) {
    var buffer = new Buffer(3);

    buffer[0] = 0xA3;
    buffer[1] = motorPorts;
    buffer[2] = state ? 1 : 0;

    write(buffer, callback);
};<commit_msg>Update pwm device<commit_after>'use strict';

var device = require('./device'),
    write = device.writer('/dev/lms_pwm');

/*
 * motorPorts: [0x00..0x0F] Bit field representing motor port A to D
 */
exports.resetTachoCount = function (motorPorts, callback) {
    write(new Buffer([
        0xB2, motorPorts
    ]), callback);
};

/*
 * polarity: [+-0..1] Polarity +-1, 0=toggle (multiplied to SPEED and POWER)
 * motorPorts: [0x00..0x0F] Bit field representing motor port A to D
 */
exports.setPolarity = function (polarity, motorPorts, callback) {
    write(new Buffer([
        0xA7, motorPorts, polarity
    ]), callback);
};

/*
 * power: [+-0..100%] Power relative to polarity
 * motorPorts: [0x00..0x0F] Bit field representing motor port A to D
 */
exports.setPower = function (power, motorPorts, callback) {
    write(new Buffer([
        0xA4, motorPorts, power
    ]), callback);
};

/*
 * speed: [+-0..100%] Speed relative to polarity (0->BRAKE)
 * motorPorts: [0x00..0x0F] Bit field representing motor port A to D
 */
exports.setSpeed = function (speed, motorPorts, callback) {
    write(new Buffer([
        0xA5, motorPorts, speed
    ]), callback);
};

/*
 * motorPorts: [0x00..0x0F] Bit field representing motor port A to D
 */
exports.start = function (motorPorts, callback) {
    write(new Buffer([
        0xA6, motorPorts
    ]), callback);
};

/*
 * state: [boolean] State after stop (false=Coast, true=Brake)
 * motorPorts: [0x00..0x0F] Bit field representing motor port A to D
 */
exports.stop = function (state, motorPorts, callback) {
    write(new Buffer([
        0xA3, motorPorts, state ? 1 : 0
    ]), callback);
};
{'fraction_non_alphanumeric': 0.14735099337748345, 'fraction_numerical': 0.037527593818984545, 'mean_word_length': 3.3206197854588795, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4086854', 'n_tokens_mistral': 1304, 'n_tokens_neox': 1243, 'n_words': 358}