HAL driver API

1. ADC service

1.1 ADC initialization function

void HalAdcInit (void)

1.2 Read and return the ADC conversion value under the specified channel and resolution

uint16 HalAdcRead (uint8 channel,uint8 resolution);

2. LCD service

2.1 Initialize LCD function

void HalLcdInit (void);

2.2 Write a string to LCD

void HalLcdWriteString (unit8* str,uint8 option);

2.3 Write a 32-bit data to LCD

void HalLcdWriteValue (uint32 value,uint8 radix,uint8 option);

2.4 Write 2 lines of text on the LCD display

void HalLcdWriteScreen( char *line1,char *line2 );

2.5 Write a string at the specified line number on the LCD display followed by a 16-bit value

void HalLcdWriteStringValue( char *title,uint16 value,uint8 format,uint8 line );

2.6 Write two 16-bit values ​​back-to-back on a specified line on the LCD display

void HalLcdWriteStringValueValue( char *title,uint16 value1,uint8 format1,uint16 value2,uint8 format2,uint8 line );

2.7 Simulate a percentage bar on the LCD with a digital percentage in the middle of the screen

void HalLcdDisplayPercentBar( char *title,uint8 value );

3.LED service

3.1 Initialize the LED service

void HalLedInit(void);

3.2 Setting the LEDs

void HalLedSet (uint8 led, uint8 mode);

3.3 Setting the LED to blink

void HalLedBlink (uint8 leds,uint8 numBlinks,uint8 percent,uint16 period);

3.4 Return the current state of the LED

uint8 HalLedGetState (void);

3.5 Store the current state of the LEDs and turn off all LEDs to save power

void HalLedEnterSleep (void);

3.6 Restore the original state of the LED before entering sleep mode

void HalLedExitSleep (void);

4. Button service

4.1 Initialize button function

void HalKeyInit (void *init);

4.2 Configure the key service to be polled or interrupt driven

void HalKeyConfig (bool interruptEnable,halKeyCBack_t *cback);

4.3 Read the current state of the button

uint8 HalKeyRead (void);

4.4 Set a global state variable indicating that sleep mode has been entered

void HalKeyEnterSleep (void);

4.5 Set a global state variable indicating that sleep mode has been exited

void HalKeyExitSleep (void);

4.6 Query whether there is button information

void HalKeyPoll ( void );

4.7 Key press

bool HalKeyPressed( void );

5. Hibernate (low power consumption) service

5.1 Set the low power mode of the MAC

void halSleep(uint32 osal_timeout)

6. Counter/Timer Service

6.1 Counter/Timer Initialization

void HalTimerInit (void)

6.2 Configuring Counters/Timers

halTimerStatus_t HalTimerConfig ( uint8 timerId, uint8 opMode, uint8 channel, uint8 channelMode, bool intEnable,halTimerCBack_t cback);

6.3 Start the counter/timer

uint8 HalTimerStart( uint8 timerId, uint32 timePerTick );

6.4 Turn off the counter/timer

uint8 HalTimerStop(uint8 timerId);

6.5 Counter/Timer Dividing

void HalTimerTick (void);

6.6 Timer Interrupts

uint8 HalTimerInterruptEnable ( uint8 timerId,uint8 channelMode,bool enable );

7. Serial port service

7.1 Serial port initialization

void HalUARTInit (void)

7.2 Open the serial port

HalUARTOpen (uint8 port,halUARTCfg_t *config);

7.3 Close the serial port

void HalUARTClose (uint8 port);

7.4 Read data from serial port

uint16 HalUARTRead (uint8 port,uint8 *buf,uint16 length);

7.5 Write data to serial port

uint16 HalUARTWrite (uint8 port,uint8 *buf,uint16 length);

7.6 Serial polling

void HalUARTPoll (void);

7.7 Return the number of bytes currently in the Rx buffer

uint16 Hal_UART_RxBufLen (uint8 port);

7.8 Return the number of bytes currently in the Tx buffer

uint16 Hal_UART_TxBufLen (uint8 port);

7.9 Enabling or disabling flow control for the UART

void Hal_UART_FlowControlSet (uint8 port,uint8 status);

7.10 This function aborts the UART when entering sleep mode

void HalUARTSuspend (void);

7.11 Resume UART after waking from sleep

void HalUARTResume (void);

8.PA/LNA service

8.1RX Low Gain Mode

#define HAL_PA_LNA_RX_LGM ()

8.2RX High Gain Mode

#define HAL_PA_LNA_RX_HGM()

9. I2C service

9.1 I2C initialization

void HalI2CInit (void)

9.2 I2C accepts data

int8 HalI2CReceive(uint8 address,uint8 *buf,uint16 len);

9.3 I2C send data

int8 HalI2CSend(uint8 address,uint8 *buf,uint16 len);

10. IR Services

10.1 IR initialization

void HalIrGenInit (void);

10.2 Generate IR format signal corresponding to command

void HalIrGenCommand (halIrGenCmd_t command );

10.3 IR signal generation completion callback

void HalIrGenComplete (void);



Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325432743&siteId=291194637