Code refactoring
Moved all HW-dependent function definitions to bmlite_hal.h Moved all HW-dependent function implementations to hal_*.c Change-Id: I5f592fcffab1ef4bb815f90b968be638d33d0a5d
This commit is contained in:
parent
f0636d475f
commit
22f24e6a82
1
.vscode/settings.json
vendored
1
.vscode/settings.json
vendored
@ -10,6 +10,7 @@
|
|||||||
"C_Cpp.default.includePath": [
|
"C_Cpp.default.includePath": [
|
||||||
"${workspaceFolder}/BMLite_example/inc",
|
"${workspaceFolder}/BMLite_example/inc",
|
||||||
"${workspaceFolder}/hcp/inc",
|
"${workspaceFolder}/hcp/inc",
|
||||||
|
"${workspaceFolder}/CMSIS/Include",
|
||||||
"${workspaceFolder}/HAL_Driver/inc",
|
"${workspaceFolder}/HAL_Driver/inc",
|
||||||
"${workspaceFolder}/HAL_Driver/sdk",
|
"${workspaceFolder}/HAL_Driver/sdk",
|
||||||
"${workspaceFolder}/HAL_Driver/sdk/components",
|
"${workspaceFolder}/HAL_Driver/sdk/components",
|
||||||
|
|||||||
89
BMLite_example/inc/bmlite_hal.h
Executable file
89
BMLite_example/inc/bmlite_hal.h
Executable file
@ -0,0 +1,89 @@
|
|||||||
|
/**
|
||||||
|
* @file bmlite.h
|
||||||
|
* @brief BM-Lite HAL functions.
|
||||||
|
*
|
||||||
|
* All functions must be implemented in order to support BM-Lite on a Board
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef BMLITE_H
|
||||||
|
#define BMLITE_H
|
||||||
|
|
||||||
|
#include "fpc_bep_types.h"
|
||||||
|
#include "platform.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @brief Board initialization
|
||||||
|
* @param[in] SPI CLK speed
|
||||||
|
*/
|
||||||
|
|
||||||
|
void hal_board_init(uint32_t speed_hz);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @brief Control BM-Lite Reset pin
|
||||||
|
* @param[in] True - Activate RESET
|
||||||
|
* False - Deactivate RESET
|
||||||
|
*/
|
||||||
|
void hal_bmlite_reset(bool state);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @brief Init SPI interface
|
||||||
|
* @param[in] SPI CLK speed
|
||||||
|
*/
|
||||||
|
void hal_bmlite_spi_init(uint32_t speed_hz);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @brief SPI write-read
|
||||||
|
* @param[in] Write buffer
|
||||||
|
* @param[in] Read buffer
|
||||||
|
* @param[in] Size
|
||||||
|
* @param[in] Leave CS asserted
|
||||||
|
* @return ::fpc_bep_result_t
|
||||||
|
*/
|
||||||
|
fpc_bep_result_t hal_bmlite_spi_write_read(uint8_t *write, uint8_t *read, size_t size,
|
||||||
|
bool leave_cs_asserted);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @brief Check if BM-Lite IRQ pin is set
|
||||||
|
* @return ::bool
|
||||||
|
*/
|
||||||
|
bool hal_bmlite_get_status(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Initializes timebase. Starts system tick counter.
|
||||||
|
*/
|
||||||
|
void hal_timebase_init(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Reads the system tick counter.
|
||||||
|
*
|
||||||
|
* @return Tick count since hal_timebase_init() call. [ms]
|
||||||
|
*/
|
||||||
|
uint32_t hal_timebase_get_tick(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Busy wait.
|
||||||
|
*
|
||||||
|
* @param[in] ms Time to wait [ms].
|
||||||
|
* 0 => return immediately
|
||||||
|
* 1 => wait at least 1ms etc.
|
||||||
|
*/
|
||||||
|
void hal_timebase_busy_wait(uint32_t ms);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Optional functions for Buttons & Leds control
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @brief Get button press time (msec)
|
||||||
|
* @return ::uint32_t
|
||||||
|
*/
|
||||||
|
uint32_t hal_get_button_press_time();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @brief Set LED(s) status
|
||||||
|
* @param[in] Status
|
||||||
|
*/
|
||||||
|
void hal_set_leds(uint8_t status);
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* BMLITE_H */
|
||||||
@ -27,6 +27,7 @@
|
|||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
#include "fpc_com_result.h"
|
#include "fpc_com_result.h"
|
||||||
|
#include "bmlite_hal.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief LED status.
|
* @brief LED status.
|
||||||
@ -80,34 +81,6 @@ fpc_com_result_t platform_bmlite_send(uint16_t size, const uint8_t *data, uint32
|
|||||||
fpc_com_result_t platform_bmlite_receive(uint16_t size, uint8_t *data, uint32_t timeout,
|
fpc_com_result_t platform_bmlite_receive(uint16_t size, uint8_t *data, uint32_t timeout,
|
||||||
void *session);
|
void *session);
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Initializes timebase. Starts system tick counter.
|
|
||||||
*/
|
|
||||||
void platform_timebase_init(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Reads the system tick counter.
|
|
||||||
*
|
|
||||||
* @return Tick count since platform_timebase_init() call. [ms]
|
|
||||||
*/
|
|
||||||
uint32_t platform_timebase_get_tick(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Busy wait.
|
|
||||||
*
|
|
||||||
* @param[in] ms Time to wait [ms].
|
|
||||||
* 0 => return immediately
|
|
||||||
* 1 => wait at least 1ms etc.
|
|
||||||
*/
|
|
||||||
void platform_timebase_busy_wait(uint32_t ms);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Get time in micro seconds
|
|
||||||
*
|
|
||||||
* @return time in us.
|
|
||||||
*/
|
|
||||||
uint32_t platform_get_time(void);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Stops execution if a debug interface is attached.
|
* @brief Stops execution if a debug interface is attached.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -35,16 +35,16 @@ void bmlite_on_error(bmlite_error_t error, int32_t value)
|
|||||||
{
|
{
|
||||||
if(value != FPC_BEP_RESULT_TIMEOUT) {
|
if(value != FPC_BEP_RESULT_TIMEOUT) {
|
||||||
platform_set_led(3);
|
platform_set_led(3);
|
||||||
platform_timebase_busy_wait(500);
|
hal_timebase_busy_wait(500);
|
||||||
platform_set_led(0);
|
platform_set_led(0);
|
||||||
platform_timebase_busy_wait(500);
|
hal_timebase_busy_wait(500);
|
||||||
platform_set_led(3);
|
platform_set_led(3);
|
||||||
platform_timebase_busy_wait(500);
|
hal_timebase_busy_wait(500);
|
||||||
platform_set_led(0);
|
platform_set_led(0);
|
||||||
platform_timebase_busy_wait(500);
|
hal_timebase_busy_wait(500);
|
||||||
} else {
|
} else {
|
||||||
platform_set_led(3);
|
platform_set_led(3);
|
||||||
platform_timebase_busy_wait(100);
|
hal_timebase_busy_wait(100);
|
||||||
platform_set_led(0);
|
platform_set_led(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -55,19 +55,19 @@ void bmlite_on_error(bmlite_error_t error, int32_t value)
|
|||||||
void bmlite_on_start_enroll()
|
void bmlite_on_start_enroll()
|
||||||
{
|
{
|
||||||
platform_set_led(1);
|
platform_set_led(1);
|
||||||
platform_timebase_busy_wait(500);
|
hal_timebase_busy_wait(500);
|
||||||
platform_set_led(2);
|
platform_set_led(2);
|
||||||
platform_timebase_busy_wait(500);
|
hal_timebase_busy_wait(500);
|
||||||
}
|
}
|
||||||
|
|
||||||
void bmlite_on_finish_enroll()
|
void bmlite_on_finish_enroll()
|
||||||
{
|
{
|
||||||
platform_set_led(1);
|
platform_set_led(1);
|
||||||
platform_timebase_busy_wait(100);
|
hal_timebase_busy_wait(100);
|
||||||
platform_set_led(0);
|
platform_set_led(0);
|
||||||
platform_timebase_busy_wait(100);
|
hal_timebase_busy_wait(100);
|
||||||
platform_set_led(1);
|
platform_set_led(1);
|
||||||
platform_timebase_busy_wait(100);
|
hal_timebase_busy_wait(100);
|
||||||
platform_set_led(0);
|
platform_set_led(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,9 +96,7 @@ int main (int argc, char **argv)
|
|||||||
uint16_t size[2] = { 256, 256 };
|
uint16_t size[2] = { 256, 256 };
|
||||||
fpc_com_chain_t hcp_chain;
|
fpc_com_chain_t hcp_chain;
|
||||||
|
|
||||||
if(!platform_init(baudrate)) {
|
platform_init(baudrate);
|
||||||
platform_halt_if_debug();
|
|
||||||
}
|
|
||||||
|
|
||||||
init_com_chain(&hcp_chain, buffer, size, NULL);
|
init_com_chain(&hcp_chain, buffer, size, NULL);
|
||||||
hcp_chain.channel = 1;
|
hcp_chain.channel = 1;
|
||||||
@ -127,7 +125,7 @@ int main (int argc, char **argv)
|
|||||||
} else {
|
} else {
|
||||||
// Erase All templates
|
// Erase All templates
|
||||||
platform_set_led(BMLITE_LED_STATUS_DELETE_TEMPLATES);
|
platform_set_led(BMLITE_LED_STATUS_DELETE_TEMPLATES);
|
||||||
platform_timebase_busy_wait(500);
|
hal_timebase_busy_wait(500);
|
||||||
res = bep_delete_template(&hcp_chain, REMOVE_ID_ALL_TEMPLATES);
|
res = bep_delete_template(&hcp_chain, REMOVE_ID_ALL_TEMPLATES);
|
||||||
}
|
}
|
||||||
res = bep_identify_finger(&hcp_chain, &template_id, &match);
|
res = bep_identify_finger(&hcp_chain, &template_id, &match);
|
||||||
@ -138,7 +136,7 @@ int main (int argc, char **argv)
|
|||||||
} else {
|
} else {
|
||||||
platform_set_led(BMLITE_LED_STATUS_NOMATCH);
|
platform_set_led(BMLITE_LED_STATUS_NOMATCH);
|
||||||
}
|
}
|
||||||
platform_timebase_busy_wait(500);
|
hal_timebase_busy_wait(500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,32 +22,23 @@
|
|||||||
|
|
||||||
#include "fpc_com_result.h"
|
#include "fpc_com_result.h"
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
#include "bmlite.h"
|
#include "bmlite_hal.h"
|
||||||
#include "boards.h"
|
|
||||||
#include "platform_spi.h"
|
|
||||||
#include "btns_leds.h"
|
|
||||||
|
|
||||||
bool platform_init(uint32_t speed_hz)
|
bool platform_init(uint32_t speed_hz)
|
||||||
{
|
{
|
||||||
nordic_board_init(4000000);
|
hal_board_init(4000000);
|
||||||
platform_timebase_init();
|
hal_timebase_init();
|
||||||
bsp_board_init(BSP_INIT_LEDS | BSP_INIT_BUTTONS);
|
|
||||||
|
|
||||||
platform_bmlite_reset();
|
platform_bmlite_reset();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t platform_get_time(void)
|
|
||||||
{
|
|
||||||
return platform_timebase_get_tick();
|
|
||||||
}
|
|
||||||
|
|
||||||
void platform_bmlite_reset(void)
|
void platform_bmlite_reset(void)
|
||||||
{
|
{
|
||||||
nordic_bmlite_reset(true);
|
hal_bmlite_reset(true);
|
||||||
platform_timebase_busy_wait(100);
|
hal_timebase_busy_wait(100);
|
||||||
nordic_bmlite_reset(false);
|
hal_bmlite_reset(false);
|
||||||
platform_timebase_busy_wait(100);
|
hal_timebase_busy_wait(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
fpc_com_result_t platform_bmlite_send(uint16_t size, const uint8_t *data, uint32_t timeout,
|
fpc_com_result_t platform_bmlite_send(uint16_t size, const uint8_t *data, uint32_t timeout,
|
||||||
@ -55,38 +46,26 @@ fpc_com_result_t platform_bmlite_send(uint16_t size, const uint8_t *data, uint32
|
|||||||
{
|
{
|
||||||
uint8_t buff[size];
|
uint8_t buff[size];
|
||||||
|
|
||||||
return nordic_bmlite_spi_write_read((uint8_t *)data, buff, size, false);
|
return hal_bmlite_spi_write_read((uint8_t *)data, buff, size, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
fpc_com_result_t platform_bmlite_receive(uint16_t size, uint8_t *data, uint32_t timeout,
|
fpc_com_result_t platform_bmlite_receive(uint16_t size, uint8_t *data, uint32_t timeout,
|
||||||
void *session)
|
void *session)
|
||||||
{
|
{
|
||||||
volatile uint32_t start_time = platform_get_time();
|
volatile uint32_t start_time = hal_timebase_get_tick();
|
||||||
volatile uint32_t curr_time = start_time;
|
volatile uint32_t curr_time = start_time;
|
||||||
while (!nordic_bmlite_get_status() &&
|
while (!hal_bmlite_get_status() &&
|
||||||
(curr_time = platform_get_time()) - start_time < timeout) {
|
(curr_time = hal_timebase_get_tick()) - start_time < timeout) {
|
||||||
}
|
}
|
||||||
if(curr_time - start_time >= timeout) {
|
if(curr_time - start_time >= timeout) {
|
||||||
return FPC_COM_RESULT_TIMEOUT;
|
return FPC_COM_RESULT_TIMEOUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t buff[size];
|
uint8_t buff[size];
|
||||||
return nordic_bmlite_spi_write_read(buff, data, size, false);
|
return hal_bmlite_spi_write_read(buff, data, size, false);
|
||||||
}
|
|
||||||
|
|
||||||
void platform_halt_if_debug(void)
|
|
||||||
{
|
|
||||||
// Stop here if debugger is attached.
|
|
||||||
__BKPT(0xFC);
|
|
||||||
}
|
|
||||||
|
|
||||||
void platform_sw_reset(void)
|
|
||||||
{
|
|
||||||
NVIC_SystemReset();
|
|
||||||
while(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void platform_set_led(platform_led_status_t color)
|
void platform_set_led(platform_led_status_t color)
|
||||||
{
|
{
|
||||||
board_set_leds(color);
|
hal_set_leds(color);
|
||||||
}
|
}
|
||||||
@ -1,13 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file bmlite.h
|
|
||||||
* @brief BM-Lite control functions.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef BMLITE_H
|
|
||||||
#define BMLITE_H
|
|
||||||
|
|
||||||
bool nordic_bmlite_get_status(void);
|
|
||||||
void nordic_board_init(uint32_t speed_hz);
|
|
||||||
void nordic_bmlite_reset(bool state);
|
|
||||||
|
|
||||||
#endif /* BMLITE_H */
|
|
||||||
@ -1,14 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file btns_leds.h
|
|
||||||
* @brief Buttons and LEDs control functions
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef BTNS_LEDS_H
|
|
||||||
#define BTNS_LEDS_H
|
|
||||||
|
|
||||||
#include "platform.h"
|
|
||||||
|
|
||||||
void board_set_leds(platform_led_status_t color);
|
|
||||||
uint32_t board_get_button_press_time();
|
|
||||||
|
|
||||||
#endif
|
|
||||||
@ -1,16 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file platform_spi.h
|
|
||||||
* @brief Platform SPI functions.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef PLATFORM_SPI_H
|
|
||||||
#define PLATFORM_SPI_H
|
|
||||||
|
|
||||||
#include "fpc_bep_types.h"
|
|
||||||
|
|
||||||
fpc_bep_result_t nordic_bmlite_spi_write_read(uint8_t *write, uint8_t *read, size_t size,
|
|
||||||
bool leave_cs_asserted);
|
|
||||||
|
|
||||||
void nordic_bmlite_spi_init(uint32_t speed_hz);
|
|
||||||
|
|
||||||
#endif /* PLATFORM_SPI_H */
|
|
||||||
@ -15,7 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file board_hal.c
|
* @file hal_board.c
|
||||||
* @brief Board Specific functions
|
* @brief Board Specific functions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -26,17 +26,16 @@
|
|||||||
#include "nrf_gpiote.h"
|
#include "nrf_gpiote.h"
|
||||||
#include "nrf_drv_gpiote.h"
|
#include "nrf_drv_gpiote.h"
|
||||||
|
|
||||||
#include "bmlite.h"
|
#include "bmlite_hal.h"
|
||||||
#include "platform_spi.h"
|
|
||||||
|
|
||||||
#define FPC_PIN_RESET ARDUINO_2_PIN
|
#define BMLITE_PIN_RESET ARDUINO_2_PIN
|
||||||
#define FPC_PIN_INTERRUPT ARDUINO_A2_PIN
|
#define BMLITE_PIN_STATUS ARDUINO_A2_PIN
|
||||||
|
|
||||||
static volatile bool sensor_interrupt = false;
|
static volatile bool sensor_interrupt = false;
|
||||||
|
|
||||||
static void nordic_bmlite_gpio_init (void);
|
static void nordic_bmlite_gpio_init (void);
|
||||||
|
|
||||||
void nordic_board_init(uint32_t speed_hz)
|
void hal_board_init(uint32_t speed_hz)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (NRF_UICR->REGOUT0 != UICR_REGOUT0_VOUT_3V3)
|
if (NRF_UICR->REGOUT0 != UICR_REGOUT0_VOUT_3V3)
|
||||||
@ -51,21 +50,23 @@ void nordic_board_init(uint32_t speed_hz)
|
|||||||
NRF_USBD->ENABLE = 1;
|
NRF_USBD->ENABLE = 1;
|
||||||
|
|
||||||
nordic_bmlite_gpio_init();
|
nordic_bmlite_gpio_init();
|
||||||
nordic_bmlite_spi_init(speed_hz);
|
hal_bmlite_spi_init(speed_hz);
|
||||||
|
bsp_board_init(BSP_INIT_LEDS | BSP_INIT_BUTTONS);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void nordic_bmlite_reset(bool state)
|
void hal_bmlite_reset(bool state)
|
||||||
{
|
{
|
||||||
if(!state) {
|
if(!state) {
|
||||||
nrf_drv_gpiote_out_set(FPC_PIN_RESET);
|
nrf_drv_gpiote_out_set(BMLITE_PIN_RESET);
|
||||||
} else {
|
} else {
|
||||||
nrf_drv_gpiote_out_clear(FPC_PIN_RESET);
|
nrf_drv_gpiote_out_clear(BMLITE_PIN_RESET);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool nordic_bmlite_get_status(void)
|
bool hal_bmlite_get_status(void)
|
||||||
{
|
{
|
||||||
return nrf_drv_gpiote_in_is_set(FPC_PIN_INTERRUPT);
|
return nrf_drv_gpiote_in_is_set(BMLITE_PIN_STATUS);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void nordic_bmlite_gpio_init(void)
|
static void nordic_bmlite_gpio_init(void)
|
||||||
@ -74,12 +75,12 @@ static void nordic_bmlite_gpio_init(void)
|
|||||||
err_code = nrf_drv_gpiote_init();
|
err_code = nrf_drv_gpiote_init();
|
||||||
APP_ERROR_CHECK(err_code);
|
APP_ERROR_CHECK(err_code);
|
||||||
nrf_drv_gpiote_out_config_t out_config = GPIOTE_CONFIG_OUT_SIMPLE(true);
|
nrf_drv_gpiote_out_config_t out_config = GPIOTE_CONFIG_OUT_SIMPLE(true);
|
||||||
err_code = nrf_drv_gpiote_out_init(FPC_PIN_RESET, &out_config);
|
err_code = nrf_drv_gpiote_out_init(BMLITE_PIN_RESET, &out_config);
|
||||||
APP_ERROR_CHECK(err_code);
|
APP_ERROR_CHECK(err_code);
|
||||||
nrf_drv_gpiote_out_task_enable(FPC_PIN_RESET); //Enable task for output pin (toggle)
|
nrf_drv_gpiote_out_task_enable(BMLITE_PIN_RESET); //Enable task for output pin (toggle)
|
||||||
|
|
||||||
nrf_drv_gpiote_in_config_t config = GPIOTE_CONFIG_IN_SENSE_LOTOHI(true);
|
nrf_drv_gpiote_in_config_t config = GPIOTE_CONFIG_IN_SENSE_LOTOHI(true);
|
||||||
err_code = nrf_drv_gpiote_in_init(FPC_PIN_INTERRUPT, &config, NULL);
|
err_code = nrf_drv_gpiote_in_init(BMLITE_PIN_STATUS, &config, NULL);
|
||||||
APP_ERROR_CHECK(err_code);
|
APP_ERROR_CHECK(err_code);
|
||||||
nrf_gpiote_event_clear(NRF_GPIOTE_EVENTS_IN_0);
|
nrf_gpiote_event_clear(NRF_GPIOTE_EVENTS_IN_0);
|
||||||
return;
|
return;
|
||||||
@ -20,7 +20,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "boards.h"
|
#include "boards.h"
|
||||||
#include "btns_leds.h"
|
#include "bmlite_hal.h"
|
||||||
|
|
||||||
/** LED ON time in ms */
|
/** LED ON time in ms */
|
||||||
#define LED_SOLID_ON_TIME_MS 700
|
#define LED_SOLID_ON_TIME_MS 700
|
||||||
@ -28,7 +28,7 @@
|
|||||||
/** LED blink time in ms */
|
/** LED blink time in ms */
|
||||||
#define LED_BLINK_TIME_MS 200
|
#define LED_BLINK_TIME_MS 200
|
||||||
|
|
||||||
void board_set_leds(uint8_t color)
|
void hal_set_leds(uint8_t color)
|
||||||
{
|
{
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
|
|
||||||
@ -25,7 +25,8 @@
|
|||||||
#include "nrf_gpiote.h"
|
#include "nrf_gpiote.h"
|
||||||
#include "nrf_drv_gpiote.h"
|
#include "nrf_drv_gpiote.h"
|
||||||
|
|
||||||
#include "platform.h"
|
//#include "platform.h"
|
||||||
|
#include "bmlite_hal.h"
|
||||||
#include "fpc_bep_types.h"
|
#include "fpc_bep_types.h"
|
||||||
|
|
||||||
|
|
||||||
@ -76,7 +77,7 @@ static void spi_write_read(uint8_t *write, uint8_t *read, size_t size, bool leav
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fpc_bep_result_t nordic_bmlite_spi_write_read(uint8_t *write, uint8_t *read, size_t size,
|
fpc_bep_result_t hal_bmlite_spi_write_read(uint8_t *write, uint8_t *read, size_t size,
|
||||||
bool leave_cs_asserted)
|
bool leave_cs_asserted)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -95,7 +96,7 @@ fpc_bep_result_t nordic_bmlite_spi_write_read(uint8_t *write, uint8_t *read, siz
|
|||||||
return FPC_BEP_RESULT_OK;
|
return FPC_BEP_RESULT_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nordic_bmlite_spi_init(uint32_t speed_hz)
|
void hal_bmlite_spi_init(uint32_t speed_hz)
|
||||||
{
|
{
|
||||||
//spi_config.ss_pin = BMLITE_CS_PIN;
|
//spi_config.ss_pin = BMLITE_CS_PIN;
|
||||||
spi_config.miso_pin = BMLITE_MISO_PIN;
|
spi_config.miso_pin = BMLITE_MISO_PIN;
|
||||||
@ -59,7 +59,7 @@ static void timer_event_handler(nrf_timer_event_t event_type, void* p_context)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void platform_timebase_init(void)
|
void hal_timebase_init(void)
|
||||||
{
|
{
|
||||||
uint32_t time_ms = 1; //Time (in miliseconds) between consecutive compare events.
|
uint32_t time_ms = 1; //Time (in miliseconds) between consecutive compare events.
|
||||||
uint32_t time_ticks;
|
uint32_t time_ticks;
|
||||||
@ -77,7 +77,7 @@ void platform_timebase_init(void)
|
|||||||
nrf_drv_timer_enable(&TIMER_LED);
|
nrf_drv_timer_enable(&TIMER_LED);
|
||||||
}
|
}
|
||||||
|
|
||||||
void platform_timebase_busy_wait(uint32_t delay)
|
void hal_timebase_busy_wait(uint32_t delay)
|
||||||
{
|
{
|
||||||
uint32_t start;
|
uint32_t start;
|
||||||
uint32_t delay_internal = 0;
|
uint32_t delay_internal = 0;
|
||||||
@ -91,7 +91,7 @@ void platform_timebase_busy_wait(uint32_t delay)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t platform_timebase_get_tick(void)
|
uint32_t hal_timebase_get_tick(void)
|
||||||
{
|
{
|
||||||
return systick;
|
return systick;
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user