[FL-84] iButton app, dallas emulate + cyfral read, cyfral emulate (#253)

* maxim crc function
* one wire template device and ds1990 classes
* 3 fields for addr
* cyfral emulator lib
* add cyfral read mode, refract rendering and events
* add ADC1_IN14, add adc interrupt
* cyfral read mode
* rename and move api-hal includes folder
* build onewire libs only if we build app
* start in mode 0
This commit is contained in:
DrZlo13
2020-11-25 10:25:13 +03:00
committed by GitHub
parent 758e37e294
commit 1f761d7fbb
37 changed files with 1996 additions and 821 deletions

View File

@@ -0,0 +1,8 @@
#pragma once
typedef enum {
ApiHalBootModeNormal,
ApiHalBootModeDFU
} ApiHalBootMode;
void api_hal_boot_set_mode(ApiHalBootMode mode);

View File

@@ -0,0 +1,6 @@
#pragma once
#include "main.h"
void delay(float milliseconds);
void delay_us(float microseconds);
void delay_us_init_DWT(void);

View File

@@ -0,0 +1,22 @@
#pragma once
#include <stdint.h>
#include <stdbool.h>
/* Initialize drivers */
void api_hal_power_init();
/* Get predicted remaining battery capacity in percents */
uint8_t api_hal_power_get_pct();
/* Get charging status */
bool api_hal_power_is_charging();
/* Poweroff system */
void api_hal_power_off();
/* OTG enable */
void api_hal_power_enable_otg();
/* OTG disable */
void api_hal_power_disable_otg();

View File

@@ -0,0 +1,10 @@
#pragma once
#include <stdint.h>
#include <stddef.h>
/* Get platform UID size in bytes */
size_t api_hal_uid_size();
/* Get const pointer to UID */
const uint8_t* api_hal_uid();

View File

@@ -0,0 +1,24 @@
#pragma once
#include <stdbool.h>
#include <stdint.h>
#include <string.h>
/* Init VCP HAL
* Allocates ring buffer and initializes state
*/
void api_hal_vcp_init();
/* Recieve data from VCP
* Waits till some data arrives, never returns 0
* @param buffer - pointer to buffer
* @param size - buffer size
* @return items copied in buffer, 0 if channel closed
*/
size_t api_hal_vcp_rx(uint8_t* buffer, size_t size);
/* Transmit data to VCP
* @param buffer - pointer to buffer
* @param size - buffer size
*/
void api_hal_vcp_tx(uint8_t* buffer, size_t size);

View File

@@ -0,0 +1,11 @@
#pragma once
#include "api-hal-boot.h"
#include "api-hal-gpio.h"
#include "api-hal-delay.h"
#include "api-hal-pwm.h"
#include "api-hal-task.h"
#include "api-hal-tim.h"
#include "api-hal-power.h"
#include "api-hal-vcp.h"
#include "api-hal-uid.h"