Files

39 lines
1.0 KiB
C

/*
* kl_api.h
* Public entry points for the K-Line protocol stack.
*
* Integration:
* - Call KLine_Init() once after HAL peripheral init
* - Call KLine_Service() from the main loop (frequently, <3ms)
* - Route ISR callbacks as described below
*
* ISR wiring (add to your existing HAL callbacks):
*
* void HAL_UART_TxCpltCallback(UART_HandleTypeDef *huart) {
* if (huart->Instance == USART1) KL_Phy_TxCpltCB();
* }
*
* void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart) {
* if (huart->Instance == USART1) KL_Phy_RxCpltCB();
* }
*
* void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) {
* if (GPIO_Pin == KL_RX_PIN) KL_Session_OnExtiRxFalling();
* }
*
* void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) {
* if (htim->Instance == TIM17) KL_Session_OnTim17Elapsed();
* }
*/
#ifndef KL_API_H
#define KL_API_H
#include <stdint.h>
void KLine_Init(void);
void KLine_Service(void);
uint8_t KLine_GetStatus(void); /* 0=idle, 1=connecting, 2=active */
#endif /* KL_API_H */