HXD019 Driver for STM8 MCUs

Published 2017-02-18Views 698views

STM8 MCU and HXD019 driver example

Article

                                    #define  DELAY_ST  20//20.07ms calibrated//19

#include "stm8l15x.h"
#include "Spi_flash_hw.h"
#include "mcu_init.h"
 
#define  I2CERR_NO_ERROR 0
//Data signal port: input //H: 25uS-35uS
//Set port as pull-up input without interrupt //18mS-25mS
 
 
//extern unsigned char irda_data[232];
/*********************** SDA_PIN ************************/
void SetSDAInput(void) /*********************** Enable IIC ************************/
{
//  GPIO_Init(GPIOC, GPIO_Pin_0, GPIO_Mode_In_PU_No_IT); /*********************** Disable IIC ************************/
  GPIOC->DDR &= (uint8_t)(~GPIO_Pin_0);
 
//  GPIOC->CR1 |= GPIO_Pin_0;
  GPIOC->CR1 &= (uint8_t)(~GPIO_Pin_0);
 
  GPIOC->CR2 &= (uint8_t)(~GPIO_Pin_0);
  GPIOC->ODR |= GPIO_Pin_0;
 
 
Driver Instructions for MTK Smartphone HXD019
u16 I2COpen(void)
{
  SetSDAOutput(); 
//  SetSCLOutput();
 
  SetSCLHigh();
  SetSDAHigh();
  
  return I2CERR_NO_ERROR; 
}
 
 
Process: Set IO, compile and burn, install the provided application: *.apk, and it is ready to use
u16 I2CClose(void)   
{
  SetSDAOutput(); 
//  SetSCLOutput(); 
  
  SetSCLHigh();
  SetSDAHigh();
  
  return I2CERR_NO_ERROR; 
}
 

 

Clarify the requirement before choosing a chip

Tell us the device type, interaction needs and volume plan; we will match a solution and arrange samples.

You are visitor No.7605   粤ICP备13027018号 Shenzhen Market Supervision Administration