Init
This commit is contained in:
commit
261e3e9205
|
|
@ -0,0 +1,41 @@
|
|||
//
|
||||
// Created by xemon on 19.10.22.
|
||||
//
|
||||
#include <GpioPin.h>
|
||||
#include "I2cPorts.h"
|
||||
|
||||
void I2cPorts_InitI2c3(tI2cPortNation *env) {
|
||||
|
||||
// //Init I2c 3
|
||||
// //SCL
|
||||
// InitGpioPinConfigOnly(GPIOC, GPIO_PIN_0, GPIO_Mode_AF_OD, GPIO_Speed_2MHz);
|
||||
// //SDA
|
||||
// InitGpioPinConfigOnly(GPIOC, GPIO_PIN_1, GPIO_Mode_AF_OD, GPIO_Speed_2MHz);
|
||||
|
||||
RCC_EnableAPB2PeriphClk(RCC_APB2_PERIPH_GPIOC, ENABLE);
|
||||
|
||||
GPIO_InitType GPIO_InitStructure;
|
||||
|
||||
GPIO_InitStructure.Pin = GPIO_PIN_0 | GPIO_PIN_1;
|
||||
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
|
||||
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_OD;
|
||||
GPIO_InitPeripheral(GPIOC, &GPIO_InitStructure);
|
||||
|
||||
//No remap
|
||||
// GPIO_ConfigPinRemap(GPIO_RMP3_I2C3, ENABLE);
|
||||
|
||||
vI2cPortNationInit7bit(env, I2C3, 400000);
|
||||
}
|
||||
|
||||
tI2cPorts I2C_PORTS;
|
||||
|
||||
void I2cPorts_Init() {
|
||||
tI2cPorts *env = &I2C_PORTS;
|
||||
|
||||
RCC_EnableAPB2PeriphClk(RCC_APB2_PERIPH_AFIO, ENABLE);
|
||||
RCC_EnableAPB2PeriphClk(RCC_APB2_PERIPH_I2C3, ENABLE);
|
||||
|
||||
I2cPorts_InitI2c3(&env->max9860Port);
|
||||
env->max9860Io = I2cPortNation_GetIO(&env->max9860Port);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
//
|
||||
// Created by xemon on 19.10.22.
|
||||
//
|
||||
|
||||
#ifndef UVEOS_ON_NATION_I2CPORTS_H
|
||||
#define UVEOS_ON_NATION_I2CPORTS_H
|
||||
|
||||
#include "I2cIO.h"
|
||||
#include "I2cPortNation.h"
|
||||
|
||||
typedef struct {
|
||||
tI2cPortNation max9860Port;
|
||||
tI2cIO max9860Io;
|
||||
} tI2cPorts;
|
||||
|
||||
extern tI2cPorts I2C_PORTS;
|
||||
|
||||
void I2cPorts_Init();
|
||||
|
||||
#endif //UVEOS_ON_NATION_I2CPORTS_H
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"dep": [
|
||||
{
|
||||
"type": "git",
|
||||
"provider": "NAVIGATOR_UVEOS_NATION_TELIT",
|
||||
"repo": "I2cPort_NATION_N32G45X"
|
||||
}
|
||||
],
|
||||
"cmake": {
|
||||
"inc_dirs": [
|
||||
"./"
|
||||
],
|
||||
"srcs": [
|
||||
"*.c"
|
||||
]
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue