<commit_before>/**
 * @file tlc59116.c
 *
 * \copyright Copyright 2013 /Dev. All rights reserved.
 * \license This project is released under MIT license.
 *
 * @author <NAME> <<EMAIL>>
 * @since 0.12.0
 */

#include "tlc59116.h"

// Do we want TLC59116?
#ifdef EXT_TLC59116

// Check if COM_I2C is enabled
#ifndef COM_I2C
#error TLC59116 cannot work without COM_I2C
#endif // COM_I2C

/**
 * Speed for I2C to talk over
 */
const i2c_speed = 350;

void tlc59116_reset(void) {
    // Make sure i2c is initialized
    i2c_init(i2c_speed);
    // Start i2c
    if (i2c_start()) { /* Start failed */ }
    // Send reset command
    else if(i2c_send_address(0xD6)) { /* Send reset command failed */ }
    // Send first reset byte
    else if(i2c_send_byte(0xA5)) { /* Send first reset byte failed */ }
    // Send second reset byte
    else if(i2c_send_byte(0x5A)) { /* Send second reset byte failed */ }
    // Stop i2c
    i2c_stop();
}

void tlc59116_sleep(uint8_t address, uint8_t sleep) {
    // Sequence:
    // Start, select chip, select register, repeated start, select chip,
    // read register (not ack), start, repeated start, select chip,
    // select register, write new byte (sleep or not), stop

    // Make sure i2c is initialized
    i2c_init(i2c_speed);
    // Start i2c
    i2c_start();
    // Select chip (WRITE)
    i2c_send_address(I2C_WRITE(address));
    // Select register
    i2c_send_byte(0x00);
    // Repeated start
    i2c_start();<commit_msg>Update doc sequence for sleep<commit_after>/**
 * @file tlc59116.c
 *
 * \copyright Copyright 2013 /Dev. All rights reserved.
 * \license This project is released under MIT license.
 *
 * @author <NAME> <<EMAIL>>
 * @since 0.12.0
 */

#include "tlc59116.h"

// Do we want TLC59116?
#ifdef EXT_TLC59116

// Check if COM_I2C is enabled
#ifndef COM_I2C
#error TLC59116 cannot work without COM_I2C
#endif // COM_I2C

/**
 * Speed for I2C to talk over
 */
const i2c_speed = 350;

void tlc59116_reset(void) {
    // Make sure i2c is initialized
    i2c_init(i2c_speed);
    // Start i2c
    if (i2c_start()) { /* Start failed */ }
    // Send reset command
    else if(i2c_send_address(0xD6)) { /* Send reset command failed */ }
    // Send first reset byte
    else if(i2c_send_byte(0xA5)) { /* Send first reset byte failed */ }
    // Send second reset byte
    else if(i2c_send_byte(0x5A)) { /* Send second reset byte failed */ }
    // Stop i2c
    i2c_stop();
}

void tlc59116_sleep(uint8_t address, uint8_t sleep) {
    // Sequence:
    // Start, select chip, select register, repeated start, select chip,
    // read register (not ack), repeated start, select chip, select register,
    // write new byte (sleep or not), stop

    // Make sure i2c is initialized
    i2c_init(i2c_speed);
    // Start i2c
    i2c_start();
    // Select chip (WRITE)
    i2c_send_address(I2C_WRITE(address));
    // Select register
    i2c_send_byte(0x00);
    // Repeated start
    i2c_start();
{'fraction_non_alphanumeric': 0.11842551747539871, 'fraction_numerical': 0.05564981336952833, 'mean_word_length': 2.8385416666666665, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '1412744', 'n_tokens_mistral': 1115, 'n_tokens_neox': 1048, 'n_words': 314}