CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
Loading...
Searching...
No Matches
sao.cpp File Reference
#include "mod_sao/sao.h"
#include "cdc_hal/II2cBus.h"
#include "cdc_log.h"
#include <cstring>

Go to the source code of this file.

Functions

static esp_err_t sao_read_eeprom (uint8_t mem_addr, uint8_t *data, size_t len)
 Reads bytes from SAO EEPROM at a given memory address.
static bool sao_parse_descriptor (sao_descriptor_t *desc)
 Parses the SAO binary descriptor from EEPROM content.
bool sao_init (void)
bool sao_scan (void)
bool sao_read_descriptor (sao_descriptor_t *desc)
bool sao_is_detected (void)
const char * sao_get_name (void)
const char * sao_get_driver_name (void)
void sao_get_info_string (char *buf, size_t len)

Variables

static const char * TAG = "SAO"
 SAO (Standardized Add-On) binary descriptor parser implementing badge.team SAO format.
static sao_descriptor_t g_sao_descriptor
static bool g_sao_detected = false
static bool g_sao_initialized = false
static cdc::hal::II2cBusg_sao_bus = nullptr
static cdc::hal::I2cDeviceHandle g_sao_dev = nullptr

Function Documentation

◆ sao_get_driver_name()

const char * sao_get_driver_name ( void )

Definition at line 194 of file sao.cpp.

References g_sao_descriptor, and g_sao_detected.

◆ sao_get_info_string()

void sao_get_info_string ( char * buf,
size_t len )

Definition at line 199 of file sao.cpp.

References g_sao_descriptor, and g_sao_detected.

Referenced by cdc::mod_sao::getInfoView().

◆ sao_get_name()

const char * sao_get_name ( void )

Definition at line 189 of file sao.cpp.

References g_sao_descriptor, and g_sao_detected.

◆ sao_init()

◆ sao_is_detected()

bool sao_is_detected ( void )

Definition at line 185 of file sao.cpp.

References g_sao_detected.

◆ sao_parse_descriptor()

bool sao_parse_descriptor ( sao_descriptor_t * desc)
static

Parses the SAO binary descriptor from EEPROM content.

Parameters
descOutput descriptor structure.
Returns
true if parsing succeeded, otherwise false.

Definition at line 35 of file sao.cpp.

References LOG_D, SAO_MAX_DRIVER_DATA_LEN, SAO_MAX_DRIVER_NAME_LEN, SAO_MAX_EXTRA_DRIVERS, SAO_MAX_NAME_LEN, sao_read_eeprom(), and TAG.

Referenced by sao_scan().

◆ sao_read_descriptor()

bool sao_read_descriptor ( sao_descriptor_t * desc)

Definition at line 175 of file sao.cpp.

References g_sao_descriptor, and g_sao_detected.

◆ sao_read_eeprom()

esp_err_t sao_read_eeprom ( uint8_t mem_addr,
uint8_t * data,
size_t len )
static

Reads bytes from SAO EEPROM at a given memory address.

Parameters
mem_addrStart address in EEPROM.
dataOutput buffer receiving the bytes.
lenNumber of bytes to read.
Returns
ESP error code from the I2C read operation.

Definition at line 25 of file sao.cpp.

References g_sao_bus, and g_sao_dev.

Referenced by sao_parse_descriptor().

◆ sao_scan()

bool sao_scan ( void )

Variable Documentation

◆ g_sao_bus

cdc::hal::II2cBus* g_sao_bus = nullptr
static

Definition at line 15 of file sao.cpp.

Referenced by sao_init(), and sao_read_eeprom().

◆ g_sao_descriptor

sao_descriptor_t g_sao_descriptor
static

◆ g_sao_detected

bool g_sao_detected = false
static

◆ g_sao_dev

cdc::hal::I2cDeviceHandle g_sao_dev = nullptr
static

Definition at line 16 of file sao.cpp.

Referenced by sao_init(), and sao_read_eeprom().

◆ g_sao_initialized

bool g_sao_initialized = false
static

Definition at line 14 of file sao.cpp.

Referenced by sao_init(), and sao_scan().

◆ TAG

const char* TAG = "SAO"
static

SAO (Standardized Add-On) binary descriptor parser implementing badge.team SAO format.

Definition at line 10 of file sao.cpp.