Build pico-example/cdc_msc sample on qmk build system Add usb descriptors Use usb config in config.h tentative implementation Enable debug print by cdc Process queued transfer before new report Fix dprint hang on Windows resolve warnings Add pico uart/i2c/spi sources Trim mouse report ID before send implement atomic_util Add eeprom emulation Save emulated eeprom by CLI comamnd Delete unused file Implement RGBLIGHT Add pio_manager Implement split Chang default serial speed Print elf size Fix make command Add eeprom save command to keymaps Reset when CDC baudrate is 1200bps Replace pro micro pin config to RP2040 pro micro Add i2c functions Disable LTO automatically Add CTPIM, CONVERT_TO_PICO_MICRO option Add MIDI functions Call usb_task() in midi send function Convert pico-sdk results to i2c_status Add build target uf2 to rp2040 Remove unused parts Fix warnings rp2040 samples: Update readme.md Check pico-sdk setup Implement lazy write back from eepemu to ROM Add PiPi Gherkin Change DDYNAMIC_KEYMAP_EEPROM_MAX_ADDR to 4095 PiPi Gherkin: Increase DYNAMIC_KEYMAP_LAYER_COUNT to 6 Change interface number of RAW to 1 due to VIA restriction Generate bs2_default_padded_checksummed.S at build time Calculate eeprom emulation region Fix warning Add pico/usb_util.c to SRC Fix pico's split Add keyboard_quantizer/rp Add pwm driver Remove unused file Add analog.c Change default FLASH clock div to 4 Fix merge mistakes and issues. rejig files remove ugfx more rejigging remove qmk_main add watchdog back
53 lines
1.9 KiB
C
53 lines
1.9 KiB
C
/* Copyright 2018 Jack Humbert
|
|
* Copyright 2018 Yiancar
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
/* This library follows the convention of the AVR i2c_master library.
|
|
* As a result addresses are expected to be already shifted (addr << 1).
|
|
* I2CD1 is the default driver which corresponds to pins B6 and B7. This
|
|
* can be changed.
|
|
* Please ensure that HAL_USE_I2C is TRUE in the halconf.h file and that
|
|
* STM32_I2C_USE_I2C1 is TRUE in the mcuconf.h file.
|
|
*/
|
|
#pragma once
|
|
|
|
#include <stdint.h>
|
|
|
|
#ifndef I2C1_SCL
|
|
# define I2C1_SCL 3
|
|
#endif
|
|
#ifndef I2C1_SDA
|
|
# define I2C1_SDA 2
|
|
#endif
|
|
|
|
#ifndef I2C_DRIVER
|
|
# define I2C_DRIVER i2c1
|
|
#endif
|
|
|
|
typedef int16_t i2c_status_t;
|
|
|
|
#define I2C_STATUS_SUCCESS (0)
|
|
#define I2C_STATUS_ERROR (-1)
|
|
#define I2C_STATUS_TIMEOUT (-2)
|
|
|
|
#define i2c_init() i2c_init_pico()
|
|
void i2c_init_pico(void);
|
|
i2c_status_t i2c_start(uint8_t address);
|
|
i2c_status_t i2c_transmit(uint8_t address, const uint8_t* data, uint16_t length, uint16_t timeout);
|
|
i2c_status_t i2c_receive(uint8_t address, uint8_t* data, uint16_t length, uint16_t timeout);
|
|
i2c_status_t i2c_writeReg(uint8_t devaddr, uint8_t regaddr, const uint8_t* data, uint16_t length, uint16_t timeout);
|
|
i2c_status_t i2c_readReg(uint8_t devaddr, uint8_t regaddr, uint8_t* data, uint16_t length, uint16_t timeout);
|
|
void i2c_stop(void);
|