cueOS  2.4
cueOS - Universal Show Control OS for ARM
keys_driver.c
1#include "stm32f4xx_hal.h"
2
3I2C_HandleTypeDef hi2c3;
4
8static void _keys_config_i2c(void){
9 hi2c3.Instance = I2C3;
10 hi2c3.Init.ClockSpeed = 100000;
11 hi2c3.Init.DutyCycle = I2C_DUTYCYCLE_2;
12 hi2c3.Init.OwnAddress1 = 0;
13 hi2c3.Init.AddressingMode = I2C_ADDRESSINGMODE_7BIT;
14 hi2c3.Init.DualAddressMode = I2C_DUALADDRESS_DISABLE;
15 hi2c3.Init.OwnAddress2 = 0;
16 hi2c3.Init.GeneralCallMode = I2C_GENERALCALL_DISABLE;
17 hi2c3.Init.NoStretchMode = I2C_NOSTRETCH_DISABLE;
18
19 HAL_I2C_Init(&hi2c3);
20}
21
22void keys_init(void){
23
24 _keys_config_i2c();
25 char *test = "test";
26 int i;
27
28 if(HAL_I2C_Master_Transmit(&hi2c3, 0x70, test, 4, 10000) == HAL_OK){
29 uint8_t hh = 0;
30 }
31
32// for(i=0x70; i<0x80; i++){
33// if(HAL_I2C_Master_Transmit(&hi2c3, i, &test, 4, 1000) == HAL_OK){
34// uint8_t hh = 0;
35// break;
36// }
37// }
38
39}