mirror of
https://github.com/tpunix/HMCLOCK.git
synced 2026-05-12 03:14:50 +08:00
初始化仓库
This commit is contained in:
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
|
||||
./Keil_5/out_DA14585
|
||||
./Keil_5/*.uvguix.*
|
||||
./Keil_5/JLinkLog.txt
|
||||
|
||||
9
Keil_5/EventRecorderStub.scvd
Normal file
9
Keil_5/EventRecorderStub.scvd
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<component_viewer schemaVersion="0.1" xmlns:xs="http://www.w3.org/2001/XMLSchema-instance" xs:noNamespaceSchemaLocation="Component_Viewer.xsd">
|
||||
|
||||
<component name="EventRecorderStub" version="1.0.0"/> <!--name and version of the component-->
|
||||
<events>
|
||||
</events>
|
||||
|
||||
</component_viewer>
|
||||
39
Keil_5/JLinkSettings.ini
Normal file
39
Keil_5/JLinkSettings.ini
Normal file
@@ -0,0 +1,39 @@
|
||||
[BREAKPOINTS]
|
||||
ForceImpTypeAny = 0
|
||||
ShowInfoWin = 1
|
||||
EnableFlashBP = 2
|
||||
BPDuringExecution = 0
|
||||
[CFI]
|
||||
CFISize = 0x00
|
||||
CFIAddr = 0x00
|
||||
[CPU]
|
||||
MonModeVTableAddr = 0xFFFFFFFF
|
||||
MonModeDebug = 0
|
||||
MaxNumAPs = 0
|
||||
LowPowerHandlingMode = 0
|
||||
OverrideMemMap = 0
|
||||
AllowSimulation = 1
|
||||
ScriptFile=""
|
||||
[FLASH]
|
||||
CacheExcludeSize = 0x00
|
||||
CacheExcludeAddr = 0x00
|
||||
MinNumBytesFlashDL = 0
|
||||
SkipProgOnCRCMatch = 1
|
||||
VerifyDownload = 1
|
||||
AllowCaching = 1
|
||||
EnableFlashDL = 2
|
||||
Override = 0
|
||||
Device="ARM7"
|
||||
[GENERAL]
|
||||
WorkRAMSize = 0x00
|
||||
WorkRAMAddr = 0x00
|
||||
RAMUsageLimit = 0x00
|
||||
[SWO]
|
||||
SWOLogFile=""
|
||||
[MEM]
|
||||
RdOverrideOrMask = 0x00
|
||||
RdOverrideAndMask = 0xFFFFFFFF
|
||||
RdOverrideAddr = 0xFFFFFFFF
|
||||
WrOverrideOrMask = 0x00
|
||||
WrOverrideAndMask = 0xFFFFFFFF
|
||||
WrOverrideAddr = 0xFFFFFFFF
|
||||
2225
Keil_5/ble_app_peripheral.uvoptx
Normal file
2225
Keil_5/ble_app_peripheral.uvoptx
Normal file
File diff suppressed because it is too large
Load Diff
7524
Keil_5/ble_app_peripheral.uvprojx
Normal file
7524
Keil_5/ble_app_peripheral.uvprojx
Normal file
File diff suppressed because one or more lines are too long
259
src/config/da14531_config_advanced.h
Normal file
259
src/config/da14531_config_advanced.h
Normal file
@@ -0,0 +1,259 @@
|
||||
/**
|
||||
****************************************************************************************
|
||||
*
|
||||
* @file da14531_config_advanced.h
|
||||
*
|
||||
* @brief Advanced compile configuration file.
|
||||
*
|
||||
* Copyright (C) 2014-2023 Renesas Electronics Corporation and/or its affiliates.
|
||||
* All rights reserved. Confidential Information.
|
||||
*
|
||||
* This software ("Software") is supplied by Renesas Electronics Corporation and/or its
|
||||
* affiliates ("Renesas"). Renesas grants you a personal, non-exclusive, non-transferable,
|
||||
* revocable, non-sub-licensable right and license to use the Software, solely if used in
|
||||
* or together with Renesas products. You may make copies of this Software, provided this
|
||||
* copyright notice and disclaimer ("Notice") is included in all such copies. Renesas
|
||||
* reserves the right to change or discontinue the Software at any time without notice.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS". RENESAS DISCLAIMS ALL WARRANTIES OF ANY KIND,
|
||||
* WHETHER EXPRESS, IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. TO THE
|
||||
* MAXIMUM EXTENT PERMITTED UNDER LAW, IN NO EVENT SHALL RENESAS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE, EVEN IF RENESAS HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGES. USE OF THIS SOFTWARE MAY BE SUBJECT TO TERMS AND CONDITIONS CONTAINED IN
|
||||
* AN ADDITIONAL AGREEMENT BETWEEN YOU AND RENESAS. IN CASE OF CONFLICT BETWEEN THE TERMS
|
||||
* OF THIS NOTICE AND ANY SUCH ADDITIONAL LICENSE AGREEMENT, THE TERMS OF THE AGREEMENT
|
||||
* SHALL TAKE PRECEDENCE. BY CONTINUING TO USE THIS SOFTWARE, YOU AGREE TO THE TERMS OF
|
||||
* THIS NOTICE.IF YOU DO NOT AGREE TO THESE TERMS, YOU ARE NOT PERMITTED TO USE THIS
|
||||
* SOFTWARE.
|
||||
*
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef _DA14531_CONFIG_ADVANCED_H_
|
||||
#define _DA14531_CONFIG_ADVANCED_H_
|
||||
|
||||
#include "da1458x_stack_config.h"
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Low Power clock selection. */
|
||||
/* -LP_CLK_XTAL32 External XTAL32K oscillator */
|
||||
/* -LP_CLK_RCX20 Internal RCX clock */
|
||||
/* -LP_CLK_FROM_OTP Use the selection in the corresponding field of OTP Header */
|
||||
/****************************************************************************************************************/
|
||||
#define CFG_LP_CLK LP_CLK_RCX20
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Periodic wakeup period to poll GTL iface. Time in msec. */
|
||||
/****************************************************************************************************************/
|
||||
#define CFG_MAX_SLEEP_DURATION_PERIODIC_WAKEUP_MS 500 // 0.5s
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Periodic wakeup period if GTL iface is not enabled. Time in msec. */
|
||||
/****************************************************************************************************************/
|
||||
#define CFG_MAX_SLEEP_DURATION_EXTERNAL_WAKEUP_MS 600000 // 600s
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Wakeup from external processor running host application. */
|
||||
/****************************************************************************************************************/
|
||||
#undef CFG_EXTERNAL_WAKEUP
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Wakeup external processor when a message is sent to GTL */
|
||||
/****************************************************************************************************************/
|
||||
#undef CFG_WAKEUP_EXT_PROCESSOR
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Enables True Random Number Generator. A true random number, generated at system initialization, is used to */
|
||||
/* seed any random number generator (C standard library, ChaCha20, etc.). */
|
||||
/****************************************************************************************************************/
|
||||
#define CFG_TRNG
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Secure connections support. */
|
||||
/* If the secure connections mode is to be used the macro must be defined. The secure connections mode uses */
|
||||
/* private/public keys which have been created based on the Elliptic-curve Diffie-Hellman (ECDH) protocol. */
|
||||
/* Note for DA14585/586/531: */
|
||||
/* If the macro is defined, the ECDH keys will be created only once after the system start-up. If the legacy */
|
||||
/* pairing is to be used, it is recommended to undefine the macro in order to gain faster start-up time and */
|
||||
/* reduce the RAM footprint. */
|
||||
/* Note for DA14531-01: */
|
||||
/* The ECDH keys are always created after a pairing request. If the legacy pairing is to be used, it is */
|
||||
/* recommended to undefine the macro in order to reduce the RAM footprint. */
|
||||
/****************************************************************************************************************/
|
||||
#undef CFG_ENABLE_SMP_SECURE
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Uses ChaCha20 random number generator instead of the C standard library random number generator. */
|
||||
/****************************************************************************************************************/
|
||||
#define CFG_USE_CHACHA20_RAND
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Custom heap sizes */
|
||||
/****************************************************************************************************************/
|
||||
// #define DB_HEAP_SZ 1024
|
||||
// #define ENV_HEAP_SZ 4928
|
||||
// #define MSG_HEAP_SZ 6880
|
||||
// #define NON_RET_HEAP_SZ 2048
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* NVDS configuration */
|
||||
/* - CFG_NVDS_TAG_BD_ADDRESS Default bdaddress. If bdaddress is written in OTP header this value is */
|
||||
/* ignored */
|
||||
/* - CFG_NVDS_TAG_LPCLK_DRIFT Low power clock drift. Permitted values in ppm are: */
|
||||
/* + DRIFT_20PPM */
|
||||
/* + DRIFT_30PPM */
|
||||
/* + DRIFT_50PPM */
|
||||
/* + DRIFT_75PPM */
|
||||
/* + DRIFT_100PPM */
|
||||
/* + DRIFT_150PPM */
|
||||
/* + DRIFT_250PPM */
|
||||
/* + DRIFT_500PPM Default value (500 ppm) */
|
||||
/* - CFG_NVDS_TAG_BLE_CA_TIMER_DUR Channel Assessment Timer duration (Multiple of 10ms) */
|
||||
/* - CFG_NVDS_TAG_BLE_CRA_TIMER_DUR Channel Reassessment Timer duration (Multiple of CA timer duration) */
|
||||
/* - CFG_NVDS_TAG_BLE_CA_MIN_RSSI Minimum RSSI Threshold */
|
||||
/* - CFG_NVDS_TAG_BLE_CA_NB_PKT Number of packets to receive for statistics */
|
||||
/* - CFG_NVDS_TAG_BLE_CA_NB_BAD_PKT Number of bad packets needed to remove a channel */
|
||||
/****************************************************************************************************************/
|
||||
#define CFG_NVDS_TAG_BD_ADDRESS {0x0B, 0x00, 0xF4, 0x35, 0x23, 0x48}
|
||||
|
||||
#define CFG_NVDS_TAG_LPCLK_DRIFT DRIFT_500PPM
|
||||
#define CFG_NVDS_TAG_BLE_CA_TIMER_DUR (500)
|
||||
#define CFG_NVDS_TAG_BLE_CRA_TIMER_DUR (8)
|
||||
#define CFG_NVDS_TAG_BLE_CA_MIN_RSSI (-60)
|
||||
#define CFG_NVDS_TAG_BLE_CA_NB_PKT (20)
|
||||
#define CFG_NVDS_TAG_BLE_CA_NB_BAD_PKT (CFG_NVDS_TAG_BLE_CA_NB_PKT/2)
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Enables the BLE statistics measurement feature. */
|
||||
/****************************************************************************************************************/
|
||||
#undef CFG_BLE_METRICS
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Output the Hardfault arguments to serial/UART interface. */
|
||||
/****************************************************************************************************************/
|
||||
#undef CFG_PRODUCTION_DEBUG_OUTPUT
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Maximum supported TX data packet length (supportedMaxTxOctets value, as defined in 4.2 Specification). */
|
||||
/* Range: 27 - 251 octets. */
|
||||
/* NOTE 1: Even number of octets are not supported. A selected even number will be automatically converted to */
|
||||
/* the next odd one. */
|
||||
/* NOTE 2: The supportedMaxTxTime value is automatically calculated by the ROM code, according to the following */
|
||||
/* equation: */
|
||||
/* supportedMaxTxTime = (supportedMaxTxOctets + 11 + 3 ) * 8 */
|
||||
/* Range: 328 - 2120 usec. */
|
||||
/****************************************************************************************************************/
|
||||
#define CFG_MAX_TX_PACKET_LENGTH (251)
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Maximum supported RX data packet length (supportedMaxRxOctets value, as defined in 4.2 Specification). */
|
||||
/* Range: 27 - 251 octets. */
|
||||
/* NOTE 1: Even number of octets are not supported. A selected even number will be automatically converted to */
|
||||
/* the next odd one. */
|
||||
/* NOTE 2: The supportedMaxRxTime value is automatically calculated by the ROM code, according to the following */
|
||||
/* equation: */
|
||||
/* supportedMaxRxTime = (supportedMaxRxOctets + 11 + 3 ) * 8 */
|
||||
/* Range: 328 - 2120 usec. */
|
||||
/****************************************************************************************************************/
|
||||
#define CFG_MAX_RX_PACKET_LENGTH (251)
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Select external application/host transport layer: */
|
||||
/* - 0 = GTL (auto) */
|
||||
/* - 1 = HCI (auto) */
|
||||
/* - 8 = GTL (fixed) */
|
||||
/* - 9 = HCI (fixed) */
|
||||
/****************************************************************************************************************/
|
||||
#define CFG_USE_H4TL (0)
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Duplicate filter max value for the scan report list. The maximum value shall be 100. */
|
||||
/****************************************************************************************************************/
|
||||
#define CFG_BLE_DUPLICATE_FILTER_MAX (10)
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Duplicate filter flag for the scan report list. This flag controls what will be reported if the */
|
||||
/* CFG_BLE_DUPLICATE_FILTER_MAX number is exceeded. */
|
||||
/* - If the flag is defined, the extra devices are considered to be in the list and will not be reported. */
|
||||
/****************************************************************************************************************/
|
||||
#undef CFG_BLE_DUPLICATE_FILTER_FOUND
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Resolving list maximum size. */
|
||||
/****************************************************************************************************************/
|
||||
#define CFG_LLM_RESOLVING_LIST_MAX LLM_RESOLVING_LIST_MAX
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Enables automatic data packet length negotiation. */
|
||||
/* NOTE: Enable only if peer device supports data length extension!! */
|
||||
/****************************************************************************************************************/
|
||||
#undef AUTO_DATA_LENGTH_NEGOTIATION_UPON_NEW_CONNECTION
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Maximum retention memory in bytes. The base address of the retention data is calculated from the selected */
|
||||
/* size. */
|
||||
/****************************************************************************************************************/
|
||||
#define CFG_RET_DATA_SIZE (2048)
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Maximum uninitialized retained data required by the application. */
|
||||
/****************************************************************************************************************/
|
||||
#define CFG_RET_DATA_UNINIT_SIZE (0)
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* RAM cell(s) retention mode handling. The user has to select which RAM cells must be retained during the */
|
||||
/* extended sleep, based on his/her application RAM layout. The last RAM block is always retained, since it */
|
||||
/* contains the BLE state and ROM data. */
|
||||
/* - CFG_RETAIN_RAM_1_BLOCK: if defined, the 1st RAM block must be retained. */
|
||||
/* - CFG_RETAIN_RAM_2_BLOCK: if defined, the 2nd RAM block must be retained. */
|
||||
/* By default, the SDK keeps all RAM cells retained. */
|
||||
/****************************************************************************************************************/
|
||||
#define CFG_RETAIN_RAM_1_BLOCK
|
||||
#define CFG_RETAIN_RAM_2_BLOCK
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Non-retained heap handling. The non-retained heap is either empty or not, and it may fill with messages */
|
||||
/* during the application runtime. If it is not empty while the system is going to extended sleep, it must be */
|
||||
/* retained. Macro state: */
|
||||
/* - If the macro is defined then the retention mode of the RAM cell(s), where the non-ret heap resides, */
|
||||
/* is automatically controlled by the SDK. */
|
||||
/* - If the macro is undefined then the retention mode of the RAM cell(s), where the non-ret heap resides, */
|
||||
/* is controlled by the following macros: */
|
||||
/* * CFG_RETAIN_RAM_1_BLOCK */
|
||||
/* * CFG_RETAIN_RAM_2_BLOCK */
|
||||
/****************************************************************************************************************/
|
||||
#define CFG_AUTO_DETECT_NON_RET_HEAP
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Code location selection. */
|
||||
/* - CFG_CODE_LOCATION_EXT: Code is loaded from SPI flash / I2C EEPROM / UART */
|
||||
/* - CFG_CODE_LOCATION_OTP: Code is burned in the OTP */
|
||||
/* The above options are mutually exclusive and exactly one of them must be enabled. */
|
||||
/****************************************************************************************************************/
|
||||
#define CFG_CODE_LOCATION_EXT
|
||||
#undef CFG_CODE_LOCATION_OTP
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Code size for OTP copy on (extended sleep with OTP copy on). If the OTP copy is on and the default SDK */
|
||||
/* scatter file is not used the following macro must define the code size in bytes for the OTP copy. */
|
||||
/****************************************************************************************************************/
|
||||
#undef CFG_CODE_SIZE_FOR_OTP_COPY_ON
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Temperature range selection (it applies to hibernation mode only). */
|
||||
/* - CFG_HIGH_TEMPERATURE: Device is configured to operate at high temperature range (-40C to +105C). */
|
||||
/* - CFG_AMB_TEMPERATURE: Device is configured to operate at ambient temperature range (-40C to +40C). */
|
||||
/* - CFG_MID_TEMPERATURE: Device is configured to operate at mid temperature range (-40C to +60C). */
|
||||
/* - CFG_EXT_TEMPERATURE: Device is configured to operate at ext temperature range (-40C to +85C). */
|
||||
/****************************************************************************************************************/
|
||||
#define CFG_AMB_TEMPERATURE
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Disable quadrature decoder on start up. The quadrature decoder is by default enabled on system power up and */
|
||||
/* it may count events. This leads to WKUP_QUADEC_IRQn pending interrupts. */
|
||||
/****************************************************************************************************************/
|
||||
#define CFG_DISABLE_QUADEC_ON_START_UP
|
||||
|
||||
#endif // _DA14531_CONFIG_ADVANCED_H_
|
||||
123
src/config/da14531_config_basic.h
Normal file
123
src/config/da14531_config_basic.h
Normal file
@@ -0,0 +1,123 @@
|
||||
/**
|
||||
****************************************************************************************
|
||||
*
|
||||
* @file da14531_config_basic.h
|
||||
*
|
||||
* @brief Basic compile configuration file.
|
||||
*
|
||||
* Copyright (C) 2015-2023 Renesas Electronics Corporation and/or its affiliates.
|
||||
* All rights reserved. Confidential Information.
|
||||
*
|
||||
* This software ("Software") is supplied by Renesas Electronics Corporation and/or its
|
||||
* affiliates ("Renesas"). Renesas grants you a personal, non-exclusive, non-transferable,
|
||||
* revocable, non-sub-licensable right and license to use the Software, solely if used in
|
||||
* or together with Renesas products. You may make copies of this Software, provided this
|
||||
* copyright notice and disclaimer ("Notice") is included in all such copies. Renesas
|
||||
* reserves the right to change or discontinue the Software at any time without notice.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS". RENESAS DISCLAIMS ALL WARRANTIES OF ANY KIND,
|
||||
* WHETHER EXPRESS, IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. TO THE
|
||||
* MAXIMUM EXTENT PERMITTED UNDER LAW, IN NO EVENT SHALL RENESAS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE, EVEN IF RENESAS HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGES. USE OF THIS SOFTWARE MAY BE SUBJECT TO TERMS AND CONDITIONS CONTAINED IN
|
||||
* AN ADDITIONAL AGREEMENT BETWEEN YOU AND RENESAS. IN CASE OF CONFLICT BETWEEN THE TERMS
|
||||
* OF THIS NOTICE AND ANY SUCH ADDITIONAL LICENSE AGREEMENT, THE TERMS OF THE AGREEMENT
|
||||
* SHALL TAKE PRECEDENCE. BY CONTINUING TO USE THIS SOFTWARE, YOU AGREE TO THE TERMS OF
|
||||
* THIS NOTICE.IF YOU DO NOT AGREE TO THESE TERMS, YOU ARE NOT PERMITTED TO USE THIS
|
||||
* SOFTWARE.
|
||||
*
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef _DA14531_CONFIG_BASIC_H_
|
||||
#define _DA14531_CONFIG_BASIC_H_
|
||||
|
||||
#include "da1458x_stack_config.h"
|
||||
#include "user_profiles_config.h"
|
||||
|
||||
/***************************************************************************************************************/
|
||||
/* Integrated or external processor configuration */
|
||||
/* -defined Integrated processor mode. Host application runs in DA14585 processor. Host application */
|
||||
/* is the TASK_APP kernel task. */
|
||||
/* -undefined External processor mode. Host application runs on an external processor. Communicates with */
|
||||
/* BLE application through GTL protocol over a signalling iface (UART, SPI etc) */
|
||||
/***************************************************************************************************************/
|
||||
#define CFG_APP
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Enables the BLE security functionality in TASK_APP. If not defined BLE security related code is compiled out.*/
|
||||
/****************************************************************************************************************/
|
||||
#undef CFG_APP_SECURITY
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Enables WatchDog timer. */
|
||||
/****************************************************************************************************************/
|
||||
#define CFG_WDOG
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Determines maximum concurrent connections supported by application. It configures the heap memory allocated */
|
||||
/* to service multiple connections. It is used for GAP central role applications. For GAP peripheral role it */
|
||||
/* should be set to 1 for optimizing memory utilization. */
|
||||
/* - MAX value for DA14531: 3 */
|
||||
/****************************************************************************************************************/
|
||||
#define CFG_MAX_CONNECTIONS (1)
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Enables development/debug mode. For production mode builds it must be disabled. */
|
||||
/* When enabled the following debugging features are enabled */
|
||||
/* - Allows the emulation of the OTP mirroring to System RAM. No actual writing to RAM is done, but the */
|
||||
/* exact same amount of time is spend as if the mirroring would take place. This is to mimic the */
|
||||
/* behavior as if the System Code is already in OTP, and the mirroring takes place after waking up, */
|
||||
/* but the (development) code still resides in an external source. */
|
||||
/* - Validation of GPIO reservations. */
|
||||
/* - Enables Debug module and sets code execution in breakpoint in Hardfault and NMI (Watchdog) handlers.*/
|
||||
/* It allows developer to hot attach debugger and get debug information */
|
||||
/****************************************************************************************************************/
|
||||
#define CFG_DEVELOPMENT_DEBUG
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* UART Console Print. If CFG_PRINTF is defined, serial interface logging mechanism will be enabled. */
|
||||
/* If CFG_PRINTF_UART2 is defined, then serial interface logging mechanism is implented using UART2, else UART1 */
|
||||
/* will be used. */
|
||||
/****************************************************************************************************************/
|
||||
#undef CFG_PRINTF
|
||||
#ifdef CFG_PRINTF
|
||||
#define CFG_PRINTF_UART2
|
||||
#endif
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* UART1 Driver Implementation. If CFG_UART1_SDK is defined, UART1 ROM driver will be overriden and UART SDK */
|
||||
/* driver will be used, else ROM driver will be used for UART1 module. */
|
||||
/****************************************************************************************************************/
|
||||
#undef CFG_UART1_SDK
|
||||
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Select external memory device for data storage */
|
||||
/* SPI FLASH (#define CFG_SPI_FLASH_ENABLE) */
|
||||
/* I2C EEPROM (#define CFG_I2C_EEPROM_ENABLE) */
|
||||
/****************************************************************************************************************/
|
||||
#undef CFG_SPI_FLASH_ENABLE
|
||||
#undef CFG_I2C_EEPROM_ENABLE
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Enables/Disables the DMA Support for the following interfaces: */
|
||||
/* - UART */
|
||||
/* - SPI */
|
||||
/* - I2C */
|
||||
/* - ADC */
|
||||
/****************************************************************************************************************/
|
||||
#undef CFG_UART_DMA_SUPPORT
|
||||
#undef CFG_SPI_DMA_SUPPORT
|
||||
#undef CFG_I2C_DMA_SUPPORT
|
||||
#undef CFG_ADC_DMA_SUPPORT
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Notify the SDK about the fixed power mode (currently used only for Bypass): */
|
||||
/* - CFG_POWER_MODE_BYPASS = Bypass mode */
|
||||
/****************************************************************************************************************/
|
||||
#undef CFG_POWER_MODE_BYPASS
|
||||
|
||||
#endif // _DA14531_CONFIG_BASIC_H_
|
||||
256
src/config/da14535_config_advanced.h
Normal file
256
src/config/da14535_config_advanced.h
Normal file
@@ -0,0 +1,256 @@
|
||||
/**
|
||||
****************************************************************************************
|
||||
*
|
||||
* @file da14535_config_advanced.h
|
||||
*
|
||||
* @brief Advanced compile configuration file.
|
||||
*
|
||||
* Copyright (C) 2022-2023 Renesas Electronics Corporation and/or its affiliates.
|
||||
* All rights reserved. Confidential Information.
|
||||
*
|
||||
* This software ("Software") is supplied by Renesas Electronics Corporation and/or its
|
||||
* affiliates ("Renesas"). Renesas grants you a personal, non-exclusive, non-transferable,
|
||||
* revocable, non-sub-licensable right and license to use the Software, solely if used in
|
||||
* or together with Renesas products. You may make copies of this Software, provided this
|
||||
* copyright notice and disclaimer ("Notice") is included in all such copies. Renesas
|
||||
* reserves the right to change or discontinue the Software at any time without notice.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS". RENESAS DISCLAIMS ALL WARRANTIES OF ANY KIND,
|
||||
* WHETHER EXPRESS, IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. TO THE
|
||||
* MAXIMUM EXTENT PERMITTED UNDER LAW, IN NO EVENT SHALL RENESAS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE, EVEN IF RENESAS HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGES. USE OF THIS SOFTWARE MAY BE SUBJECT TO TERMS AND CONDITIONS CONTAINED IN
|
||||
* AN ADDITIONAL AGREEMENT BETWEEN YOU AND RENESAS. IN CASE OF CONFLICT BETWEEN THE TERMS
|
||||
* OF THIS NOTICE AND ANY SUCH ADDITIONAL LICENSE AGREEMENT, THE TERMS OF THE AGREEMENT
|
||||
* SHALL TAKE PRECEDENCE. BY CONTINUING TO USE THIS SOFTWARE, YOU AGREE TO THE TERMS OF
|
||||
* THIS NOTICE.IF YOU DO NOT AGREE TO THESE TERMS, YOU ARE NOT PERMITTED TO USE THIS
|
||||
* SOFTWARE.
|
||||
*
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef _DA14535_CONFIG_ADVANCED_H_
|
||||
#define _DA14535_CONFIG_ADVANCED_H_
|
||||
|
||||
#include "da1458x_stack_config.h"
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Low Power clock selection. */
|
||||
/* -LP_CLK_XTAL32 External XTAL32K oscillator */
|
||||
/* -LP_CLK_RCX20 Internal RCX clock */
|
||||
/* -LP_CLK_FROM_OTP Use the selection in the corresponding field of OTP Header */
|
||||
/****************************************************************************************************************/
|
||||
#define CFG_LP_CLK LP_CLK_RCX20
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Periodic wakeup period to poll GTL iface. Time in msec. */
|
||||
/****************************************************************************************************************/
|
||||
#define CFG_MAX_SLEEP_DURATION_PERIODIC_WAKEUP_MS 500 // 0.5s
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Periodic wakeup period if GTL iface is not enabled. Time in msec. */
|
||||
/****************************************************************************************************************/
|
||||
#define CFG_MAX_SLEEP_DURATION_EXTERNAL_WAKEUP_MS 600000 // 600s
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Wakeup from external processor running host application. */
|
||||
/****************************************************************************************************************/
|
||||
#undef CFG_EXTERNAL_WAKEUP
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Wakeup external processor when a message is sent to GTL */
|
||||
/****************************************************************************************************************/
|
||||
#undef CFG_WAKEUP_EXT_PROCESSOR
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Enables True Random Number Generator. A true random number, generated at system initialization, is used to */
|
||||
/* seed any random number generator (C standard library, ChaCha20, etc.). */
|
||||
/****************************************************************************************************************/
|
||||
#define CFG_TRNG
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Secure connections support. */
|
||||
/* If the secure connections mode is to be used the macro must be defined. The secure connections mode uses */
|
||||
/* private/public keys which have been created based on the Elliptic-curve Diffie-Hellman (ECDH) protocol. */
|
||||
/* Note for DA14585/586/531: */
|
||||
/* If the macro is defined, the ECDH keys will be created only once after the system start-up. If the legacy */
|
||||
/* pairing is to be used, it is recommended to undefine the macro in order to gain faster start-up time and */
|
||||
/* reduce the RAM footprint. */
|
||||
/* Note for DA14531-01, DA14535: */
|
||||
/* The ECDH keys are always created after a pairing request. If the legacy pairing is to be used, it is */
|
||||
/* recommended to undefine the macro in order to reduce the RAM footprint. */
|
||||
/****************************************************************************************************************/
|
||||
#undef CFG_ENABLE_SMP_SECURE
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Uses ChaCha20 random number generator instead of the C standard library random number generator. */
|
||||
/****************************************************************************************************************/
|
||||
#define CFG_USE_CHACHA20_RAND
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Custom heap sizes */
|
||||
/****************************************************************************************************************/
|
||||
// #define DB_HEAP_SZ 1024
|
||||
// #define ENV_HEAP_SZ 4928
|
||||
// #define MSG_HEAP_SZ 6880
|
||||
// #define NON_RET_HEAP_SZ 2048
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* NVDS configuration */
|
||||
/* - CFG_NVDS_TAG_BD_ADDRESS Default bdaddress. If bdaddress is written in OTP header this value is */
|
||||
/* ignored */
|
||||
/* - CFG_NVDS_TAG_LPCLK_DRIFT Low power clock drift. Permitted values in ppm are: */
|
||||
/* + DRIFT_20PPM */
|
||||
/* + DRIFT_30PPM */
|
||||
/* + DRIFT_50PPM */
|
||||
/* + DRIFT_75PPM */
|
||||
/* + DRIFT_100PPM */
|
||||
/* + DRIFT_150PPM */
|
||||
/* + DRIFT_250PPM */
|
||||
/* + DRIFT_500PPM Default value (500 ppm) */
|
||||
/* - CFG_NVDS_TAG_BLE_CA_TIMER_DUR Channel Assessment Timer duration (Multiple of 10ms) */
|
||||
/* - CFG_NVDS_TAG_BLE_CRA_TIMER_DUR Channel Reassessment Timer duration (Multiple of CA timer duration) */
|
||||
/* - CFG_NVDS_TAG_BLE_CA_MIN_RSSI Minimum RSSI Threshold */
|
||||
/* - CFG_NVDS_TAG_BLE_CA_NB_PKT Number of packets to receive for statistics */
|
||||
/* - CFG_NVDS_TAG_BLE_CA_NB_BAD_PKT Number of bad packets needed to remove a channel */
|
||||
/****************************************************************************************************************/
|
||||
#define CFG_NVDS_TAG_BD_ADDRESS {0x0B, 0x00, 0xF4, 0x35, 0x23, 0x48}
|
||||
|
||||
#define CFG_NVDS_TAG_LPCLK_DRIFT DRIFT_500PPM
|
||||
#define CFG_NVDS_TAG_BLE_CA_TIMER_DUR (500)
|
||||
#define CFG_NVDS_TAG_BLE_CRA_TIMER_DUR (8)
|
||||
#define CFG_NVDS_TAG_BLE_CA_MIN_RSSI (-60)
|
||||
#define CFG_NVDS_TAG_BLE_CA_NB_PKT (20)
|
||||
#define CFG_NVDS_TAG_BLE_CA_NB_BAD_PKT (CFG_NVDS_TAG_BLE_CA_NB_PKT/2)
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Enables the BLE statistics measurement feature. */
|
||||
/****************************************************************************************************************/
|
||||
#undef CFG_BLE_METRICS
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Output the Hardfault arguments to serial/UART interface. */
|
||||
/****************************************************************************************************************/
|
||||
#undef CFG_PRODUCTION_DEBUG_OUTPUT
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Maximum supported TX data packet length (supportedMaxTxOctets value, as defined in 4.2 Specification). */
|
||||
/* Range: 27 - 251 octets. */
|
||||
/* NOTE 1: Even number of octets are not supported. A selected even number will be automatically converted to */
|
||||
/* the next odd one. */
|
||||
/* NOTE 2: The supportedMaxTxTime value is automatically calculated by the ROM code, according to the following */
|
||||
/* equation: */
|
||||
/* supportedMaxTxTime = (supportedMaxTxOctets + 11 + 3 ) * 8 */
|
||||
/* Range: 328 - 2120 usec. */
|
||||
/****************************************************************************************************************/
|
||||
#define CFG_MAX_TX_PACKET_LENGTH (251)
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Maximum supported RX data packet length (supportedMaxRxOctets value, as defined in 4.2 Specification). */
|
||||
/* Range: 27 - 251 octets. */
|
||||
/* NOTE 1: Even number of octets are not supported. A selected even number will be automatically converted to */
|
||||
/* the next odd one. */
|
||||
/* NOTE 2: The supportedMaxRxTime value is automatically calculated by the ROM code, according to the following */
|
||||
/* equation: */
|
||||
/* supportedMaxRxTime = (supportedMaxRxOctets + 11 + 3 ) * 8 */
|
||||
/* Range: 328 - 2120 usec. */
|
||||
/****************************************************************************************************************/
|
||||
#define CFG_MAX_RX_PACKET_LENGTH (251)
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Select external application/host transport layer: */
|
||||
/* - 0 = GTL (auto) */
|
||||
/* - 1 = HCI (auto) */
|
||||
/* - 8 = GTL (fixed) */
|
||||
/* - 9 = HCI (fixed) */
|
||||
/****************************************************************************************************************/
|
||||
#define CFG_USE_H4TL (0)
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Duplicate filter max value for the scan report list. The maximum value shall be 100. */
|
||||
/****************************************************************************************************************/
|
||||
#define CFG_BLE_DUPLICATE_FILTER_MAX (10)
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Duplicate filter flag for the scan report list. This flag controls what will be reported if the */
|
||||
/* CFG_BLE_DUPLICATE_FILTER_MAX number is exceeded. */
|
||||
/* - If the flag is defined, the extra devices are considered to be in the list and will not be reported. */
|
||||
/****************************************************************************************************************/
|
||||
#undef CFG_BLE_DUPLICATE_FILTER_FOUND
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Enables automatic data packet length negotiation. */
|
||||
/* NOTE: Enable only if peer device supports data length extension!! */
|
||||
/****************************************************************************************************************/
|
||||
#undef AUTO_DATA_LENGTH_NEGOTIATION_UPON_NEW_CONNECTION
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Maximum retention memory in bytes. The base address of the retention data is calculated from the selected */
|
||||
/* size. */
|
||||
/****************************************************************************************************************/
|
||||
#define CFG_RET_DATA_SIZE (2048)
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Maximum uninitialized retained data required by the application. */
|
||||
/****************************************************************************************************************/
|
||||
#define CFG_RET_DATA_UNINIT_SIZE (0)
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* RAM cell(s) retention mode handling. The user has to select which RAM cells must be retained during the */
|
||||
/* extended sleep, based on his/her application RAM layout. The last RAM block is always retained, since it */
|
||||
/* contains the BLE state and ROM data. */
|
||||
/* - CFG_RETAIN_RAM_1_BLOCK: if defined, the 1st RAM block must be retained. */
|
||||
/* By default, the SDK keeps all RAM cells retained. */
|
||||
/****************************************************************************************************************/
|
||||
#define CFG_RETAIN_RAM_1_BLOCK
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Non-retained heap handling. The non-retained heap is either empty or not, and it may fill with messages */
|
||||
/* during the application runtime. If it is not empty while the system is going to extended sleep, it must be */
|
||||
/* retained. Macro state: */
|
||||
/* - If the macro is defined then the retention mode of the RAM cell(s), where the non-ret heap resides, */
|
||||
/* is automatically controlled by the SDK. */
|
||||
/* - If the macro is undefined then the retention mode of the RAM cell(s), where the non-ret heap resides, */
|
||||
/* is controlled by the following macros: */
|
||||
/* * CFG_RETAIN_RAM_1_BLOCK */
|
||||
/****************************************************************************************************************/
|
||||
#define CFG_AUTO_DETECT_NON_RET_HEAP
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Code location selection. */
|
||||
/* - CFG_CODE_LOCATION_EXT: Code is loaded from SPI flash / I2C EEPROM / UART */
|
||||
/* - CFG_CODE_LOCATION_OTP: Code is burned in the OTP */
|
||||
/* The above options are mutually exclusive and exactly one of them must be enabled. */
|
||||
/****************************************************************************************************************/
|
||||
#define CFG_CODE_LOCATION_EXT
|
||||
#undef CFG_CODE_LOCATION_OTP
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Code size for OTP copy on (extended sleep with OTP copy on). If the OTP copy is on and the default SDK */
|
||||
/* scatter file is not used the following macro must define the code size in bytes for the OTP copy. */
|
||||
/****************************************************************************************************************/
|
||||
#undef CFG_CODE_SIZE_FOR_OTP_COPY_ON
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Temperature range selection (it applies to hibernation mode only). */
|
||||
/* - CFG_HIGH_TEMPERATURE: Device is configured to operate at high temperature range (-40C to +105C). */
|
||||
/* - CFG_AMB_TEMPERATURE: Device is configured to operate at ambient temperature range (-40C to +40C). */
|
||||
/* - CFG_MID_TEMPERATURE: Device is configured to operate at mid temperature range (-40C to +60C). */
|
||||
/* - CFG_EXT_TEMPERATURE: Device is configured to operate at ext temperature range (-40C to +85C). */
|
||||
/****************************************************************************************************************/
|
||||
#define CFG_AMB_TEMPERATURE
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Disable quadrature decoder on start up. The quadrature decoder is by default enabled on system power up and */
|
||||
/* it may count events. This leads to WKUP_QUADEC_IRQn pending interrupts. */
|
||||
/****************************************************************************************************************/
|
||||
#define CFG_DISABLE_QUADEC_ON_START_UP
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Enables the XTAL32M dynamic frequency trimming based on the temperature changes. */
|
||||
/****************************************************************************************************************/
|
||||
#undef CFG_XTAL32M_DYN_FREQ_TRIMMING
|
||||
|
||||
#endif // _DA14535_CONFIG_ADVANCED_H_
|
||||
122
src/config/da14535_config_basic.h
Normal file
122
src/config/da14535_config_basic.h
Normal file
@@ -0,0 +1,122 @@
|
||||
/**
|
||||
****************************************************************************************
|
||||
*
|
||||
* @file da14535_config_basic.h
|
||||
*
|
||||
* @brief Basic compile configuration file.
|
||||
*
|
||||
* Copyright (C) 2023 Renesas Electronics Corporation and/or its affiliates.
|
||||
* All rights reserved. Confidential Information.
|
||||
*
|
||||
* This software ("Software") is supplied by Renesas Electronics Corporation and/or its
|
||||
* affiliates ("Renesas"). Renesas grants you a personal, non-exclusive, non-transferable,
|
||||
* revocable, non-sub-licensable right and license to use the Software, solely if used in
|
||||
* or together with Renesas products. You may make copies of this Software, provided this
|
||||
* copyright notice and disclaimer ("Notice") is included in all such copies. Renesas
|
||||
* reserves the right to change or discontinue the Software at any time without notice.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS". RENESAS DISCLAIMS ALL WARRANTIES OF ANY KIND,
|
||||
* WHETHER EXPRESS, IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. TO THE
|
||||
* MAXIMUM EXTENT PERMITTED UNDER LAW, IN NO EVENT SHALL RENESAS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE, EVEN IF RENESAS HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGES. USE OF THIS SOFTWARE MAY BE SUBJECT TO TERMS AND CONDITIONS CONTAINED IN
|
||||
* AN ADDITIONAL AGREEMENT BETWEEN YOU AND RENESAS. IN CASE OF CONFLICT BETWEEN THE TERMS
|
||||
* OF THIS NOTICE AND ANY SUCH ADDITIONAL LICENSE AGREEMENT, THE TERMS OF THE AGREEMENT
|
||||
* SHALL TAKE PRECEDENCE. BY CONTINUING TO USE THIS SOFTWARE, YOU AGREE TO THE TERMS OF
|
||||
* THIS NOTICE.IF YOU DO NOT AGREE TO THESE TERMS, YOU ARE NOT PERMITTED TO USE THIS
|
||||
* SOFTWARE.
|
||||
*
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef _DA14535_CONFIG_BASIC_H_
|
||||
#define _DA14535_CONFIG_BASIC_H_
|
||||
|
||||
#include "da1458x_stack_config.h"
|
||||
#include "user_profiles_config.h"
|
||||
|
||||
/***************************************************************************************************************/
|
||||
/* Integrated or external processor configuration */
|
||||
/* -defined Integrated processor mode. Host application runs in DA14535 processor. Host application */
|
||||
/* is the TASK_APP kernel task. */
|
||||
/* -undefined External processor mode. Host application runs on an external processor. Communicates with */
|
||||
/* BLE application through GTL protocol over a signalling iface (UART, SPI etc) */
|
||||
/***************************************************************************************************************/
|
||||
#define CFG_APP
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Enables the BLE security functionality in TASK_APP. If not defined BLE security related code is compiled out.*/
|
||||
/****************************************************************************************************************/
|
||||
#undef CFG_APP_SECURITY
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Enables WatchDog timer. */
|
||||
/****************************************************************************************************************/
|
||||
#define CFG_WDOG
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Determines maximum concurrent connections supported by application. It configures the heap memory allocated */
|
||||
/* to service multiple connections. It is used for GAP central role applications. For GAP peripheral role it */
|
||||
/* should be set to 1 for optimizing memory utilization. */
|
||||
/* - MAX value for DA14535: 3 */
|
||||
/****************************************************************************************************************/
|
||||
#define CFG_MAX_CONNECTIONS (1)
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Enables development/debug mode. For production mode builds it must be disabled. */
|
||||
/* When enabled the following debugging features are enabled */
|
||||
/* - Allows the emulation of the OTP mirroring to System RAM. No actual writing to RAM is done, but the */
|
||||
/* exact same amount of time is spend as if the mirroring would take place. This is to mimic the */
|
||||
/* behavior as if the System Code is already in OTP, and the mirroring takes place after waking up, */
|
||||
/* but the (development) code still resides in an external source. */
|
||||
/* - Validation of GPIO reservations. */
|
||||
/* - Enables Debug module and sets code execution in breakpoint in Hardfault and NMI (Watchdog) handlers.*/
|
||||
/* It allows developer to hot attach debugger and get debug information */
|
||||
/****************************************************************************************************************/
|
||||
#define CFG_DEVELOPMENT_DEBUG
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* UART Console Print. If CFG_PRINTF is defined, serial interface logging mechanism will be enabled. */
|
||||
/* If CFG_PRINTF_UART2 is defined, then serial interface logging mechanism is implented using UART2, else UART1 */
|
||||
/* will be used. */
|
||||
/****************************************************************************************************************/
|
||||
#undef CFG_PRINTF
|
||||
#ifdef CFG_PRINTF
|
||||
#define CFG_PRINTF_UART2
|
||||
#endif
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* UART1 Driver Implementation. If CFG_UART1_SDK is defined, UART1 ROM driver will be overriden and UART SDK */
|
||||
/* driver will be used, else ROM driver will be used for UART1 module. */
|
||||
/****************************************************************************************************************/
|
||||
#undef CFG_UART1_SDK
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Select external memory device for data storage */
|
||||
/* SPI FLASH (#define CFG_SPI_FLASH_ENABLE) */
|
||||
/* I2C EEPROM (#define CFG_I2C_EEPROM_ENABLE) */
|
||||
/****************************************************************************************************************/
|
||||
#undef CFG_SPI_FLASH_ENABLE
|
||||
#undef CFG_I2C_EEPROM_ENABLE
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Enables/Disables the DMA Support for the following interfaces: */
|
||||
/* - UART */
|
||||
/* - SPI */
|
||||
/* - I2C */
|
||||
/* - ADC */
|
||||
/****************************************************************************************************************/
|
||||
#undef CFG_UART_DMA_SUPPORT
|
||||
#undef CFG_SPI_DMA_SUPPORT
|
||||
#undef CFG_I2C_DMA_SUPPORT
|
||||
#undef CFG_ADC_DMA_SUPPORT
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Notify the SDK about the fixed power mode (currently used only for Bypass): */
|
||||
/* - CFG_POWER_MODE_BYPASS = Bypass mode */
|
||||
/****************************************************************************************************************/
|
||||
#undef CFG_POWER_MODE_BYPASS
|
||||
|
||||
#endif // _DA14535_CONFIG_BASIC_H_
|
||||
286
src/config/da14585_config_advanced.h
Normal file
286
src/config/da14585_config_advanced.h
Normal file
@@ -0,0 +1,286 @@
|
||||
/**
|
||||
****************************************************************************************
|
||||
*
|
||||
* @file da14585_config_advanced.h
|
||||
*
|
||||
* @brief Advanced compile configuration file.
|
||||
*
|
||||
* Copyright (C) 2014-2024 Renesas Electronics Corporation and/or its affiliates.
|
||||
* All rights reserved. Confidential Information.
|
||||
*
|
||||
* This software ("Software") is supplied by Renesas Electronics Corporation and/or its
|
||||
* affiliates ("Renesas"). Renesas grants you a personal, non-exclusive, non-transferable,
|
||||
* revocable, non-sub-licensable right and license to use the Software, solely if used in
|
||||
* or together with Renesas products. You may make copies of this Software, provided this
|
||||
* copyright notice and disclaimer ("Notice") is included in all such copies. Renesas
|
||||
* reserves the right to change or discontinue the Software at any time without notice.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS". RENESAS DISCLAIMS ALL WARRANTIES OF ANY KIND,
|
||||
* WHETHER EXPRESS, IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. TO THE
|
||||
* MAXIMUM EXTENT PERMITTED UNDER LAW, IN NO EVENT SHALL RENESAS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE, EVEN IF RENESAS HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGES. USE OF THIS SOFTWARE MAY BE SUBJECT TO TERMS AND CONDITIONS CONTAINED IN
|
||||
* AN ADDITIONAL AGREEMENT BETWEEN YOU AND RENESAS. IN CASE OF CONFLICT BETWEEN THE TERMS
|
||||
* OF THIS NOTICE AND ANY SUCH ADDITIONAL LICENSE AGREEMENT, THE TERMS OF THE AGREEMENT
|
||||
* SHALL TAKE PRECEDENCE. BY CONTINUING TO USE THIS SOFTWARE, YOU AGREE TO THE TERMS OF
|
||||
* THIS NOTICE.IF YOU DO NOT AGREE TO THESE TERMS, YOU ARE NOT PERMITTED TO USE THIS
|
||||
* SOFTWARE.
|
||||
*
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef _DA14585_CONFIG_ADVANCED_H_
|
||||
#define _DA14585_CONFIG_ADVANCED_H_
|
||||
|
||||
#include "da1458x_stack_config.h"
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Low Power clock selection. */
|
||||
/* -LP_CLK_XTAL32 External XTAL32K oscillator */
|
||||
/* -LP_CLK_RCX20 Internal RCX clock */
|
||||
/* -LP_CLK_FROM_OTP Use the selection in the corresponding field of OTP Header */
|
||||
/****************************************************************************************************************/
|
||||
#define CFG_LP_CLK LP_CLK_XTAL32
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* If defined the application uses a hardcoded value for XTAL16M trimming. Should be disabled for devices */
|
||||
/* where XTAL16M is calibrated and trim value is stored in OTP. */
|
||||
/* Important note. The hardcoded value is the average value of the trimming values giving the optimal results */
|
||||
/* for DA14585 DK devices. May not be applicable in other designs */
|
||||
/****************************************************************************************************************/
|
||||
#define CFG_USE_DEFAULT_XTAL16M_TRIM_VALUE_IF_NOT_CALIBRATED
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Periodic wakeup period to poll GTL iface. Time in msec. */
|
||||
/****************************************************************************************************************/
|
||||
#define CFG_MAX_SLEEP_DURATION_PERIODIC_WAKEUP_MS 500 // 0.5s
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Periodic wakeup period if GTL iface is not enabled. Time in msec. */
|
||||
/****************************************************************************************************************/
|
||||
#define CFG_MAX_SLEEP_DURATION_EXTERNAL_WAKEUP_MS 600000 // 600s
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Wakeup from external processor running host application. */
|
||||
/****************************************************************************************************************/
|
||||
#undef CFG_EXTERNAL_WAKEUP
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Wakeup external processor when a message is sent to GTL */
|
||||
/****************************************************************************************************************/
|
||||
#undef CFG_WAKEUP_EXT_PROCESSOR
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Enables True Random Number Generator. A true random number, generated at system initialization, is used to */
|
||||
/* seed any random number generator (C standard library, ChaCha20, etc.). The following supported options */
|
||||
/* provide a trade-off between code size and start-up latency. */
|
||||
/* - undefined (or 0): TRNG is disabled. */
|
||||
/* - 32: Enables TRNG with 32 Bytes Buffer. */
|
||||
/* - 64: Enables TRNG with 64 Bytes Buffer. */
|
||||
/* - 128: Enables TRNG with 128 Bytes Buffer. */
|
||||
/* - 256: Enables TRNG with 256 Bytes Buffer. */
|
||||
/* - 512: Enables TRNG with 512 Bytes Buffer. */
|
||||
/* - 1024: Enables TRNG with 1024 Bytes Buffer. */
|
||||
/****************************************************************************************************************/
|
||||
#define CFG_TRNG (1024)
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Secure connections support. */
|
||||
/* If the secure connections mode is to be used the macro must be defined. The secure connections mode uses */
|
||||
/* private/public keys which have been created based on the Elliptic-curve Diffie-Hellman (ECDH) protocol. */
|
||||
/* Note for DA14585/586/531: */
|
||||
/* If the macro is defined, the ECDH keys will be created only once after the system start-up. If the legacy */
|
||||
/* pairing is to be used, it is recommended to undefine the macro in order to gain faster start-up time and */
|
||||
/* reduce the RAM footprint. */
|
||||
/* Note for DA14531-01: */
|
||||
/* The ECDH keys are always created after a pairing request. If the legacy pairing is to be used, it is */
|
||||
/* recommended to undefine the macro in order to reduce the RAM footprint. */
|
||||
/****************************************************************************************************************/
|
||||
#undef CFG_ENABLE_SMP_SECURE
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Uses ChaCha20 random number generator instead of the C standard library random number generator. */
|
||||
/****************************************************************************************************************/
|
||||
#define CFG_USE_CHACHA20_RAND
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Custom heap sizes */
|
||||
/****************************************************************************************************************/
|
||||
#define DB_HEAP_SZ 1024
|
||||
#define ENV_HEAP_SZ 4928
|
||||
#define MSG_HEAP_SZ 6880
|
||||
#define NON_RET_HEAP_SZ 2048
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* NVDS configuration */
|
||||
/* - CFG_NVDS_TAG_BD_ADDRESS Default bdaddress. If bdaddress is written in OTP header this value is */
|
||||
/* ignored */
|
||||
/* - CFG_NVDS_TAG_LPCLK_DRIFT Low power clock drift. Permitted values in ppm are: */
|
||||
/* + DRIFT_20PPM */
|
||||
/* + DRIFT_30PPM */
|
||||
/* + DRIFT_50PPM */
|
||||
/* + DRIFT_75PPM */
|
||||
/* + DRIFT_100PPM */
|
||||
/* + DRIFT_150PPM */
|
||||
/* + DRIFT_250PPM */
|
||||
/* + DRIFT_500PPM Default value (500 ppm) */
|
||||
/* - CFG_NVDS_TAG_BLE_CA_TIMER_DUR Channel Assessment Timer duration (Multiple of 10ms) */
|
||||
/* - CFG_NVDS_TAG_BLE_CRA_TIMER_DUR Channel Reassessment Timer duration (Multiple of CA timer duration) */
|
||||
/* - CFG_NVDS_TAG_BLE_CA_MIN_RSSI Minimum RSSI Threshold */
|
||||
/* - CFG_NVDS_TAG_BLE_CA_NB_PKT Number of packets to receive for statistics */
|
||||
/* - CFG_NVDS_TAG_BLE_CA_NB_BAD_PKT Number of bad packets needed to remove a channel */
|
||||
/****************************************************************************************************************/
|
||||
#define CFG_NVDS_TAG_BD_ADDRESS {0x0B, 0x00, 0xF4, 0x35, 0x23, 0x48}
|
||||
|
||||
#define CFG_NVDS_TAG_LPCLK_DRIFT DRIFT_500PPM
|
||||
#define CFG_NVDS_TAG_BLE_CA_TIMER_DUR (500)
|
||||
#define CFG_NVDS_TAG_BLE_CRA_TIMER_DUR (8)
|
||||
#define CFG_NVDS_TAG_BLE_CA_MIN_RSSI (-60)
|
||||
#define CFG_NVDS_TAG_BLE_CA_NB_PKT (20)
|
||||
#define CFG_NVDS_TAG_BLE_CA_NB_BAD_PKT (CFG_NVDS_TAG_BLE_CA_NB_PKT/2)
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Enables the BLE statistics measurement feature. */
|
||||
/****************************************************************************************************************/
|
||||
#undef CFG_BLE_METRICS
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Output the Hardfault arguments to serial/UART interface. */
|
||||
/****************************************************************************************************************/
|
||||
#undef CFG_PRODUCTION_DEBUG_OUTPUT
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Maximum supported TX data packet length (supportedMaxTxOctets value, as defined in 4.2 Specification). */
|
||||
/* Range: 27 - 251 octets. */
|
||||
/* NOTE 1: Even number of octets are not supported. A selected even number will be automatically converted to */
|
||||
/* the next odd one. */
|
||||
/* NOTE 2: The supportedMaxTxTime value is automatically calculated by the ROM code, according to the following */
|
||||
/* equation: */
|
||||
/* supportedMaxTxTime = (supportedMaxTxOctets + 11 + 3 ) * 8 */
|
||||
/* Range: 328 - 2120 usec. */
|
||||
/****************************************************************************************************************/
|
||||
#define CFG_MAX_TX_PACKET_LENGTH (251)
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Maximum supported RX data packet length (supportedMaxRxOctets value, as defined in 4.2 Specification). */
|
||||
/* Range: 27 - 251 octets. */
|
||||
/* NOTE 1: Even number of octets are not supported. A selected even number will be automatically converted to */
|
||||
/* the next odd one. */
|
||||
/* NOTE 2: The supportedMaxRxTime value is automatically calculated by the ROM code, according to the following */
|
||||
/* equation: */
|
||||
/* supportedMaxRxTime = (supportedMaxRxOctets + 11 + 3 ) * 8 */
|
||||
/* Range: 328 - 2120 usec. */
|
||||
/****************************************************************************************************************/
|
||||
#define CFG_MAX_RX_PACKET_LENGTH (251)
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Select external application/host transport layer: */
|
||||
/* - 0 = GTL (auto) */
|
||||
/* - 1 = HCI (auto) */
|
||||
/* - 8 = GTL (fixed) */
|
||||
/* - 9 = HCI (fixed) */
|
||||
/****************************************************************************************************************/
|
||||
#define CFG_USE_H4TL (0)
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Duplicate filter max value for the scan report list. The maximum value shall be 100. */
|
||||
/****************************************************************************************************************/
|
||||
#define CFG_BLE_DUPLICATE_FILTER_MAX (10)
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Duplicate filter flag for the scan report list. This flag controls what will be reported if the */
|
||||
/* CFG_BLE_DUPLICATE_FILTER_MAX number is exceeded. */
|
||||
/* - If the flag is defined, the extra devices are considered to be in the list and will not be reported. */
|
||||
/****************************************************************************************************************/
|
||||
#undef CFG_BLE_DUPLICATE_FILTER_FOUND
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Resolving list maximum size. */
|
||||
/****************************************************************************************************************/
|
||||
#define CFG_LLM_RESOLVING_LIST_MAX LLM_RESOLVING_LIST_MAX
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Enables automatic data packet length negotiation. */
|
||||
/* NOTE: Enable only if peer device supports data length extension!! */
|
||||
/****************************************************************************************************************/
|
||||
#undef AUTO_DATA_LENGTH_NEGOTIATION_UPON_NEW_CONNECTION
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Maximum retention memory in bytes. The base address of the retention data is calculated from the selected */
|
||||
/* size. */
|
||||
/****************************************************************************************************************/
|
||||
#define CFG_RET_DATA_SIZE (2048)
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Maximum uninitialized retained data required by the application. */
|
||||
/****************************************************************************************************************/
|
||||
#define CFG_RET_DATA_UNINIT_SIZE (0)
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* RAM cell(s) retention mode handling. The user has to select which RAM cells must be retained during the */
|
||||
/* extended sleep, based on his/her application RAM layout. The last RAM block is always retained, since it */
|
||||
/* contains the BLE state and ROM data. */
|
||||
/* - CFG_RETAIN_RAM_1_BLOCK: if defined, the 1st RAM block must be retained. */
|
||||
/* - CFG_RETAIN_RAM_2_BLOCK: if defined, the 2nd RAM block must be retained. */
|
||||
/* - CFG_RETAIN_RAM_3_BLOCK: if defined, the 3rd RAM block must be retained. */
|
||||
/* By default, the SDK keeps all RAM cells retained. */
|
||||
/****************************************************************************************************************/
|
||||
#define CFG_RETAIN_RAM_1_BLOCK
|
||||
#define CFG_RETAIN_RAM_2_BLOCK
|
||||
#define CFG_RETAIN_RAM_3_BLOCK
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Non-retained heap handling. The non-retained heap is either empty or not, and it may fill with messages */
|
||||
/* during the application runtime. If it is not empty while the system is going to extended sleep, it must be */
|
||||
/* retained. Macro state: */
|
||||
/* - If the macro is defined then the retention mode of the RAM cell(s), where the non-ret heap resides, */
|
||||
/* is automatically controlled by the SDK. */
|
||||
/* - If the macro is undefined then the retention mode of the RAM cell(s), where the non-ret heap resides, */
|
||||
/* is controlled by the following macros: */
|
||||
/* * CFG_RETAIN_RAM_1_BLOCK */
|
||||
/* * CFG_RETAIN_RAM_2_BLOCK */
|
||||
/* * CFG_RETAIN_RAM_3_BLOCK */
|
||||
/****************************************************************************************************************/
|
||||
#define CFG_AUTO_DETECT_NON_RET_HEAP
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Code location selection. */
|
||||
/* - CFG_CODE_LOCATION_EXT: Code is loaded from SPI flash / I2C EEPROM / UART */
|
||||
/* - CFG_CODE_LOCATION_OTP: Code is burned in the OTP */
|
||||
/* The above options are mutually exclusive and exactly one of them must be enabled. */
|
||||
/****************************************************************************************************************/
|
||||
#define CFG_CODE_LOCATION_EXT
|
||||
#undef CFG_CODE_LOCATION_OTP
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Code size for OTP copy on (extended sleep with OTP copy on). If the OTP copy is on and the default SDK */
|
||||
/* scatter file is not used the following macro must define the code size in bytes for the OTP copy. */
|
||||
/****************************************************************************************************************/
|
||||
#undef CFG_CODE_SIZE_FOR_OTP_COPY_ON
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Temperature range selection. */
|
||||
/* - CFG_HIGH_TEMPERATURE: Device is configured to operate at high temperature range (-40C to +105C). */
|
||||
/* - CFG_AMB_TEMPERATURE: Device is configured to operate at ambient temperature range (-40C to +40C). */
|
||||
/* - CFG_MID_TEMPERATURE: Device is configured to operate at mid temperature range (-40C to +60C). */
|
||||
/* - CFG_EXT_TEMPERATURE: Device is configured to operate at ext temperature range (-40C to +85C). */
|
||||
/* NOTE 1: High temperature support is not compatible with power optimizations. User shall undefine the */
|
||||
/* CFG_POWER_OPTIMIZATIONS flag, if device is to support the high temperature range feature. */
|
||||
/****************************************************************************************************************/
|
||||
#define CFG_AMB_TEMPERATURE
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Enable power optimizations using the XTAL16M adaptive settling algorithm. */
|
||||
/* NOTE: The XTAL16M adaptive settling algorithm works only with XTAL32K and not with RCX, as the LP clock. */
|
||||
/****************************************************************************************************************/
|
||||
#define CFG_XTAL16M_ADAPTIVE_SETTLING
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Enable the wakeup metrics to measure and obtain statistics about the number of delayed wakeups when in */
|
||||
/* high temperature configuration.Also check lld_sleep_compensate_func(void). */
|
||||
/****************************************************************************************************************/
|
||||
#undef CFG_ENABLE_WAKEUP_METRICS
|
||||
|
||||
#endif // _DA14585_CONFIG_ADVANCED_H_
|
||||
118
src/config/da14585_config_basic.h
Normal file
118
src/config/da14585_config_basic.h
Normal file
@@ -0,0 +1,118 @@
|
||||
/**
|
||||
****************************************************************************************
|
||||
*
|
||||
* @file da14585_config_basic.h
|
||||
*
|
||||
* @brief Basic compile configuration file.
|
||||
*
|
||||
* Copyright (C) 2015-2023 Renesas Electronics Corporation and/or its affiliates.
|
||||
* All rights reserved. Confidential Information.
|
||||
*
|
||||
* This software ("Software") is supplied by Renesas Electronics Corporation and/or its
|
||||
* affiliates ("Renesas"). Renesas grants you a personal, non-exclusive, non-transferable,
|
||||
* revocable, non-sub-licensable right and license to use the Software, solely if used in
|
||||
* or together with Renesas products. You may make copies of this Software, provided this
|
||||
* copyright notice and disclaimer ("Notice") is included in all such copies. Renesas
|
||||
* reserves the right to change or discontinue the Software at any time without notice.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS". RENESAS DISCLAIMS ALL WARRANTIES OF ANY KIND,
|
||||
* WHETHER EXPRESS, IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. TO THE
|
||||
* MAXIMUM EXTENT PERMITTED UNDER LAW, IN NO EVENT SHALL RENESAS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE, EVEN IF RENESAS HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGES. USE OF THIS SOFTWARE MAY BE SUBJECT TO TERMS AND CONDITIONS CONTAINED IN
|
||||
* AN ADDITIONAL AGREEMENT BETWEEN YOU AND RENESAS. IN CASE OF CONFLICT BETWEEN THE TERMS
|
||||
* OF THIS NOTICE AND ANY SUCH ADDITIONAL LICENSE AGREEMENT, THE TERMS OF THE AGREEMENT
|
||||
* SHALL TAKE PRECEDENCE. BY CONTINUING TO USE THIS SOFTWARE, YOU AGREE TO THE TERMS OF
|
||||
* THIS NOTICE.IF YOU DO NOT AGREE TO THESE TERMS, YOU ARE NOT PERMITTED TO USE THIS
|
||||
* SOFTWARE.
|
||||
*
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef _DA14585_CONFIG_BASIC_H_
|
||||
#define _DA14585_CONFIG_BASIC_H_
|
||||
|
||||
#include "da1458x_stack_config.h"
|
||||
#include "user_profiles_config.h"
|
||||
|
||||
/***************************************************************************************************************/
|
||||
/* Integrated or external processor configuration */
|
||||
/* -defined Integrated processor mode. Host application runs in DA14585 processor. Host application */
|
||||
/* is the TASK_APP kernel task. */
|
||||
/* -undefined External processor mode. Host application runs on an external processor. Communicates with */
|
||||
/* BLE application through GTL protocol over a signalling iface (UART, SPI etc) */
|
||||
/***************************************************************************************************************/
|
||||
#define CFG_APP
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Enables the BLE security functionality in TASK_APP. If not defined BLE security related code is compiled out.*/
|
||||
/****************************************************************************************************************/
|
||||
#undef CFG_APP_SECURITY
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Enables WatchDog timer. */
|
||||
/****************************************************************************************************************/
|
||||
#define CFG_WDOG
|
||||
#undef CFG_WDOG
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Determines maximum concurrent connections supported by application. It configures the heap memory allocated */
|
||||
/* to service multiple connections. It is used for GAP central role applications. For GAP peripheral role it */
|
||||
/* should be set to 1 for optimizing memory utilization. */
|
||||
/* - MAX value for DA14585: 8 */
|
||||
/****************************************************************************************************************/
|
||||
#define CFG_MAX_CONNECTIONS (1)
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Enables development/debug mode. For production mode builds it must be disabled. */
|
||||
/* When enabled the following debugging features are enabled */
|
||||
/* - Allows the emulation of the OTP mirroring to System RAM. No actual writing to RAM is done, but the */
|
||||
/* exact same amount of time is spend as if the mirroring would take place. This is to mimic the */
|
||||
/* behavior as if the System Code is already in OTP, and the mirroring takes place after waking up, */
|
||||
/* but the (development) code still resides in an external source. */
|
||||
/* - Validation of GPIO reservations. */
|
||||
/* - Enables Debug module and sets code execution in breakpoint in Hardfault and NMI (Watchdog) handlers.*/
|
||||
/* It allows developer to hot attach debugger and get debug information */
|
||||
/****************************************************************************************************************/
|
||||
#define CFG_DEVELOPMENT_DEBUG
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* UART Console Print. If CFG_PRINTF is defined, serial interface logging mechanism will be enabled. */
|
||||
/* If CFG_PRINTF_UART2 is defined, then serial interface logging mechanism is implented using UART2, else UART1 */
|
||||
/* will be used. */
|
||||
/****************************************************************************************************************/
|
||||
#undef CFG_PRINTF
|
||||
#define CFG_PRINTF
|
||||
|
||||
#ifdef CFG_PRINTF
|
||||
#define CFG_PRINTF_UART2
|
||||
#endif
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* UART1 Driver Implementation. If CFG_UART1_SDK is defined, UART1 ROM driver will be overriden and UART SDK */
|
||||
/* driver will be used, else ROM driver will be used for UART1 module. */
|
||||
/****************************************************************************************************************/
|
||||
#undef CFG_UART1_SDK
|
||||
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Select external memory device for data storage */
|
||||
/* SPI FLASH (#define CFG_SPI_FLASH_ENABLE) */
|
||||
/* I2C EEPROM (#define CFG_I2C_EEPROM_ENABLE) */
|
||||
/****************************************************************************************************************/
|
||||
#undef CFG_SPI_FLASH_ENABLE
|
||||
#undef CFG_I2C_EEPROM_ENABLE
|
||||
|
||||
/****************************************************************************************************************/
|
||||
/* Enables/Disables the DMA Support for the following interfaces: */
|
||||
/* - UART */
|
||||
/* - SPI */
|
||||
/* - I2C */
|
||||
/****************************************************************************************************************/
|
||||
#undef CFG_UART_DMA_SUPPORT
|
||||
#undef CFG_SPI_DMA_SUPPORT
|
||||
#undef CFG_I2C_DMA_SUPPORT
|
||||
|
||||
#endif // _DA14585_CONFIG_BASIC_H_
|
||||
45
src/config/da1458x_config_advanced.h
Normal file
45
src/config/da1458x_config_advanced.h
Normal file
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
****************************************************************************************
|
||||
*
|
||||
* @file da1458x_config_advanced.h
|
||||
*
|
||||
* @brief Advanced compile configuration file.
|
||||
*
|
||||
* Copyright (C) 2014-2023 Renesas Electronics Corporation and/or its affiliates.
|
||||
* All rights reserved. Confidential Information.
|
||||
*
|
||||
* This software ("Software") is supplied by Renesas Electronics Corporation and/or its
|
||||
* affiliates ("Renesas"). Renesas grants you a personal, non-exclusive, non-transferable,
|
||||
* revocable, non-sub-licensable right and license to use the Software, solely if used in
|
||||
* or together with Renesas products. You may make copies of this Software, provided this
|
||||
* copyright notice and disclaimer ("Notice") is included in all such copies. Renesas
|
||||
* reserves the right to change or discontinue the Software at any time without notice.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS". RENESAS DISCLAIMS ALL WARRANTIES OF ANY KIND,
|
||||
* WHETHER EXPRESS, IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. TO THE
|
||||
* MAXIMUM EXTENT PERMITTED UNDER LAW, IN NO EVENT SHALL RENESAS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE, EVEN IF RENESAS HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGES. USE OF THIS SOFTWARE MAY BE SUBJECT TO TERMS AND CONDITIONS CONTAINED IN
|
||||
* AN ADDITIONAL AGREEMENT BETWEEN YOU AND RENESAS. IN CASE OF CONFLICT BETWEEN THE TERMS
|
||||
* OF THIS NOTICE AND ANY SUCH ADDITIONAL LICENSE AGREEMENT, THE TERMS OF THE AGREEMENT
|
||||
* SHALL TAKE PRECEDENCE. BY CONTINUING TO USE THIS SOFTWARE, YOU AGREE TO THE TERMS OF
|
||||
* THIS NOTICE.IF YOU DO NOT AGREE TO THESE TERMS, YOU ARE NOT PERMITTED TO USE THIS
|
||||
* SOFTWARE.
|
||||
*
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef _DA1458X_CONFIG_ADVANCED_H_
|
||||
#define _DA1458X_CONFIG_ADVANCED_H_
|
||||
|
||||
#if defined (__DA14535__)
|
||||
#include "da14535_config_advanced.h"
|
||||
#elif defined (__DA14531__)
|
||||
#include "da14531_config_advanced.h"
|
||||
#else
|
||||
#include "da14585_config_advanced.h"
|
||||
#endif
|
||||
|
||||
#endif // _DA1458X_CONFIG_ADVANCED_H_
|
||||
45
src/config/da1458x_config_basic.h
Normal file
45
src/config/da1458x_config_basic.h
Normal file
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
****************************************************************************************
|
||||
*
|
||||
* @file da1458x_config_basic.h
|
||||
*
|
||||
* @brief Basic compile configuration file.
|
||||
*
|
||||
* Copyright (C) 2015-2023 Renesas Electronics Corporation and/or its affiliates.
|
||||
* All rights reserved. Confidential Information.
|
||||
*
|
||||
* This software ("Software") is supplied by Renesas Electronics Corporation and/or its
|
||||
* affiliates ("Renesas"). Renesas grants you a personal, non-exclusive, non-transferable,
|
||||
* revocable, non-sub-licensable right and license to use the Software, solely if used in
|
||||
* or together with Renesas products. You may make copies of this Software, provided this
|
||||
* copyright notice and disclaimer ("Notice") is included in all such copies. Renesas
|
||||
* reserves the right to change or discontinue the Software at any time without notice.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS". RENESAS DISCLAIMS ALL WARRANTIES OF ANY KIND,
|
||||
* WHETHER EXPRESS, IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. TO THE
|
||||
* MAXIMUM EXTENT PERMITTED UNDER LAW, IN NO EVENT SHALL RENESAS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE, EVEN IF RENESAS HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGES. USE OF THIS SOFTWARE MAY BE SUBJECT TO TERMS AND CONDITIONS CONTAINED IN
|
||||
* AN ADDITIONAL AGREEMENT BETWEEN YOU AND RENESAS. IN CASE OF CONFLICT BETWEEN THE TERMS
|
||||
* OF THIS NOTICE AND ANY SUCH ADDITIONAL LICENSE AGREEMENT, THE TERMS OF THE AGREEMENT
|
||||
* SHALL TAKE PRECEDENCE. BY CONTINUING TO USE THIS SOFTWARE, YOU AGREE TO THE TERMS OF
|
||||
* THIS NOTICE.IF YOU DO NOT AGREE TO THESE TERMS, YOU ARE NOT PERMITTED TO USE THIS
|
||||
* SOFTWARE.
|
||||
*
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef _DA1458X_CONFIG_BASIC_H_
|
||||
#define _DA1458X_CONFIG_BASIC_H_
|
||||
|
||||
#if defined (__DA14535__)
|
||||
#include "da14535_config_basic.h"
|
||||
#elif defined (__DA14531__)
|
||||
#include "da14531_config_basic.h"
|
||||
#else
|
||||
#include "da14585_config_basic.h"
|
||||
#endif
|
||||
|
||||
#endif // _DA1458X_CONFIG_BASIC_H_
|
||||
148
src/config/user_callback_config.h
Normal file
148
src/config/user_callback_config.h
Normal file
@@ -0,0 +1,148 @@
|
||||
/**
|
||||
****************************************************************************************
|
||||
*
|
||||
* @file user_callback_config.h
|
||||
*
|
||||
* @brief Callback functions configuration file.
|
||||
*
|
||||
* Copyright (C) 2015-2023 Renesas Electronics Corporation and/or its affiliates.
|
||||
* All rights reserved. Confidential Information.
|
||||
*
|
||||
* This software ("Software") is supplied by Renesas Electronics Corporation and/or its
|
||||
* affiliates ("Renesas"). Renesas grants you a personal, non-exclusive, non-transferable,
|
||||
* revocable, non-sub-licensable right and license to use the Software, solely if used in
|
||||
* or together with Renesas products. You may make copies of this Software, provided this
|
||||
* copyright notice and disclaimer ("Notice") is included in all such copies. Renesas
|
||||
* reserves the right to change or discontinue the Software at any time without notice.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS". RENESAS DISCLAIMS ALL WARRANTIES OF ANY KIND,
|
||||
* WHETHER EXPRESS, IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. TO THE
|
||||
* MAXIMUM EXTENT PERMITTED UNDER LAW, IN NO EVENT SHALL RENESAS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE, EVEN IF RENESAS HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGES. USE OF THIS SOFTWARE MAY BE SUBJECT TO TERMS AND CONDITIONS CONTAINED IN
|
||||
* AN ADDITIONAL AGREEMENT BETWEEN YOU AND RENESAS. IN CASE OF CONFLICT BETWEEN THE TERMS
|
||||
* OF THIS NOTICE AND ANY SUCH ADDITIONAL LICENSE AGREEMENT, THE TERMS OF THE AGREEMENT
|
||||
* SHALL TAKE PRECEDENCE. BY CONTINUING TO USE THIS SOFTWARE, YOU AGREE TO THE TERMS OF
|
||||
* THIS NOTICE.IF YOU DO NOT AGREE TO THESE TERMS, YOU ARE NOT PERMITTED TO USE THIS
|
||||
* SOFTWARE.
|
||||
*
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef _USER_CALLBACK_CONFIG_H_
|
||||
#define _USER_CALLBACK_CONFIG_H_
|
||||
|
||||
/*
|
||||
* INCLUDE FILES
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include "app_callback.h"
|
||||
#include "app_default_handlers.h"
|
||||
#include "app_entry_point.h"
|
||||
#include "app_prf_types.h"
|
||||
#if (BLE_APP_SEC)
|
||||
#include "app_bond_db.h"
|
||||
#endif // (BLE_APP_SEC)
|
||||
#include "user_peripheral.h"
|
||||
|
||||
/*
|
||||
* LOCAL VARIABLE DEFINITIONS
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
static const struct app_callbacks user_app_callbacks = {
|
||||
.app_on_connection = user_app_connection,
|
||||
.app_on_disconnect = user_app_disconnect,
|
||||
.app_on_update_params_rejected = NULL,
|
||||
.app_on_update_params_complete = NULL,
|
||||
.app_on_set_dev_config_complete = default_app_on_set_dev_config_complete,
|
||||
.app_on_adv_nonconn_complete = NULL,
|
||||
.app_on_adv_undirect_complete = user_app_adv_undirect_complete,
|
||||
.app_on_adv_direct_complete = NULL,
|
||||
.app_on_db_init_complete = user_app_on_db_init_complete,
|
||||
.app_on_scanning_completed = NULL,
|
||||
.app_on_adv_report_ind = NULL,
|
||||
.app_on_get_dev_name = default_app_on_get_dev_name,
|
||||
.app_on_get_dev_appearance = default_app_on_get_dev_appearance,
|
||||
.app_on_get_dev_slv_pref_params = default_app_on_get_dev_slv_pref_params,
|
||||
.app_on_set_dev_info = default_app_on_set_dev_info,
|
||||
.app_on_data_length_change = NULL,
|
||||
.app_on_update_params_request = default_app_update_params_request,
|
||||
.app_on_generate_static_random_addr = default_app_generate_static_random_addr,
|
||||
.app_on_svc_changed_cfg_ind = NULL,
|
||||
.app_on_get_peer_features = NULL,
|
||||
#if (BLE_APP_SEC)
|
||||
.app_on_pairing_request = NULL,
|
||||
.app_on_tk_exch = NULL,
|
||||
.app_on_irk_exch = NULL,
|
||||
.app_on_csrk_exch = NULL,
|
||||
.app_on_ltk_exch = NULL,
|
||||
.app_on_pairing_succeeded = NULL,
|
||||
.app_on_encrypt_ind = NULL,
|
||||
.app_on_encrypt_req_ind = NULL,
|
||||
.app_on_security_req_ind = NULL,
|
||||
.app_on_addr_solved_ind = NULL,
|
||||
.app_on_addr_resolve_failed = NULL,
|
||||
#if !defined (__DA14531_01__) && !defined (__DA14535__)
|
||||
.app_on_ral_cmp_evt = NULL,
|
||||
.app_on_ral_size_ind = NULL,
|
||||
.app_on_ral_addr_ind = NULL,
|
||||
#endif // not for DA14531-01, DA14535
|
||||
#endif // (BLE_APP_SEC)
|
||||
};
|
||||
|
||||
#if (BLE_APP_SEC)
|
||||
static const struct app_bond_db_callbacks user_app_bond_db_callbacks = {
|
||||
.app_bdb_init = NULL,
|
||||
.app_bdb_get_size = NULL,
|
||||
.app_bdb_add_entry = NULL,
|
||||
.app_bdb_remove_entry = NULL,
|
||||
.app_bdb_search_entry = NULL,
|
||||
.app_bdb_get_number_of_stored_irks = NULL,
|
||||
.app_bdb_get_stored_irks = NULL,
|
||||
.app_bdb_get_device_info_from_slot = NULL,
|
||||
};
|
||||
#endif // (BLE_APP_SEC)
|
||||
|
||||
#define app_process_catch_rest_cb user_catch_rest_hndl
|
||||
|
||||
static const struct arch_main_loop_callbacks user_app_main_loop_callbacks = {
|
||||
.app_on_init = user_app_init,
|
||||
|
||||
// By default the watchdog timer is reloaded and resumed when the system wakes up.
|
||||
// The user has to take into account the watchdog timer handling (keep it running,
|
||||
// freeze it, reload it, resume it, etc), when the app_on_ble_powered() is being
|
||||
// called and may potentially affect the main loop.
|
||||
.app_on_ble_powered = NULL,
|
||||
|
||||
// By default the watchdog timer is reloaded and resumed when the system wakes up.
|
||||
// The user has to take into account the watchdog timer handling (keep it running,
|
||||
// freeze it, reload it, resume it, etc), when the app_on_system_powered() is being
|
||||
// called and may potentially affect the main loop.
|
||||
.app_on_system_powered = NULL,
|
||||
|
||||
.app_before_sleep = NULL,
|
||||
.app_validate_sleep = NULL,
|
||||
.app_going_to_sleep = NULL,
|
||||
.app_resume_from_sleep = NULL,
|
||||
};
|
||||
|
||||
// Default Handler Operations
|
||||
static const struct default_app_operations user_default_app_operations = {
|
||||
.default_operation_adv = user_app_adv_start,
|
||||
};
|
||||
|
||||
// Place in this structure the app_<profile>_db_create and app_<profile>_enable functions
|
||||
// for SIG profiles that do not have this function already implemented in the SDK
|
||||
// or if you want to override the functionality. Check the prf_func array in the SDK
|
||||
// for your reference of which profiles are supported.
|
||||
static const struct prf_func_callbacks user_prf_funcs[] =
|
||||
{
|
||||
{TASK_ID_INVALID, NULL, NULL} // DO NOT MOVE. Must always be last
|
||||
};
|
||||
|
||||
#endif // _USER_CALLBACK_CONFIG_H_
|
||||
511
src/config/user_config.h
Normal file
511
src/config/user_config.h
Normal file
@@ -0,0 +1,511 @@
|
||||
/**
|
||||
****************************************************************************************
|
||||
*
|
||||
* @file user_config.h
|
||||
*
|
||||
* @brief User configuration file.
|
||||
*
|
||||
* Copyright (C) 2015-2023 Renesas Electronics Corporation and/or its affiliates.
|
||||
* All rights reserved. Confidential Information.
|
||||
*
|
||||
* This software ("Software") is supplied by Renesas Electronics Corporation and/or its
|
||||
* affiliates ("Renesas"). Renesas grants you a personal, non-exclusive, non-transferable,
|
||||
* revocable, non-sub-licensable right and license to use the Software, solely if used in
|
||||
* or together with Renesas products. You may make copies of this Software, provided this
|
||||
* copyright notice and disclaimer ("Notice") is included in all such copies. Renesas
|
||||
* reserves the right to change or discontinue the Software at any time without notice.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS". RENESAS DISCLAIMS ALL WARRANTIES OF ANY KIND,
|
||||
* WHETHER EXPRESS, IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. TO THE
|
||||
* MAXIMUM EXTENT PERMITTED UNDER LAW, IN NO EVENT SHALL RENESAS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE, EVEN IF RENESAS HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGES. USE OF THIS SOFTWARE MAY BE SUBJECT TO TERMS AND CONDITIONS CONTAINED IN
|
||||
* AN ADDITIONAL AGREEMENT BETWEEN YOU AND RENESAS. IN CASE OF CONFLICT BETWEEN THE TERMS
|
||||
* OF THIS NOTICE AND ANY SUCH ADDITIONAL LICENSE AGREEMENT, THE TERMS OF THE AGREEMENT
|
||||
* SHALL TAKE PRECEDENCE. BY CONTINUING TO USE THIS SOFTWARE, YOU AGREE TO THE TERMS OF
|
||||
* THIS NOTICE.IF YOU DO NOT AGREE TO THESE TERMS, YOU ARE NOT PERMITTED TO USE THIS
|
||||
* SOFTWARE.
|
||||
*
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _USER_CONFIG_H_
|
||||
#define _USER_CONFIG_H_
|
||||
|
||||
/*
|
||||
* INCLUDE FILES
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
#include "app_user_config.h"
|
||||
#include "arch_api.h"
|
||||
#include "app_default_handlers.h"
|
||||
#include "app_adv_data.h"
|
||||
#include "co_bt.h"
|
||||
|
||||
#include "arch_console.h"
|
||||
#define printk arch_printf
|
||||
|
||||
|
||||
/*
|
||||
* DEFINES
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
****************************************************************************************
|
||||
*
|
||||
* Privacy / Addressing configuration
|
||||
*
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
/*************************************************************************
|
||||
* Privacy Capabilities and address configuration of local device:
|
||||
* - APP_CFG_ADDR_PUB No Privacy, Public BDA
|
||||
* - APP_CFG_ADDR_STATIC No Privacy, Random Static BDA
|
||||
* - APP_CFG_HOST_PRIV_RPA Host Privacy, RPA, Public Identity
|
||||
* - APP_CFG_HOST_PRIV_NRPA Host Privacy, NRPA (non-connectable ONLY)
|
||||
* - APP_CFG_CNTL_PRIV_RPA_PUB Controller Privacy, RPA or PUB, Public Identity
|
||||
* - APP_CFG_CNTL_PRIV_RPA_RAND Controller Privacy, RPA, Public Identity
|
||||
*
|
||||
* Select only one option for privacy / addressing configuration.
|
||||
**************************************************************************
|
||||
*/
|
||||
#define USER_CFG_ADDRESS_MODE APP_CFG_ADDR_PUB
|
||||
|
||||
/*************************************************************************
|
||||
* Controller Privacy Mode:
|
||||
* - APP_CFG_CNTL_PRIV_MODE_NETWORK Controler Privacy Network mode (default)
|
||||
* - APP_CFG_CNTL_PRIV_MODE_DEVICE Controler Privacy Device mode
|
||||
*
|
||||
* Select only one option for controller privacy mode configuration.
|
||||
**************************************************************************
|
||||
*/
|
||||
#define USER_CFG_CNTL_PRIV_MODE APP_CFG_CNTL_PRIV_MODE_NETWORK
|
||||
|
||||
/*
|
||||
* VARIABLES
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
/******************************************
|
||||
* Default sleep mode. Possible values are:
|
||||
*
|
||||
* - ARCH_SLEEP_OFF
|
||||
* - ARCH_EXT_SLEEP_ON
|
||||
* - ARCH_EXT_SLEEP_OTP_COPY_ON
|
||||
*
|
||||
******************************************
|
||||
*/
|
||||
static const sleep_state_t app_default_sleep_mode = ARCH_EXT_SLEEP_ON;
|
||||
|
||||
/*
|
||||
****************************************************************************************
|
||||
*
|
||||
* Advertising configuration
|
||||
*
|
||||
****************************************************************************************
|
||||
*/
|
||||
static const struct advertise_configuration user_adv_conf = {
|
||||
|
||||
.addr_src = APP_CFG_ADDR_SRC(USER_CFG_ADDRESS_MODE),
|
||||
|
||||
/// Minimum interval for advertising
|
||||
.intv_min = MS_TO_BLESLOTS(687.5), // 687.5ms
|
||||
|
||||
/// Maximum interval for advertising
|
||||
.intv_max = MS_TO_BLESLOTS(687.5), // 687.5ms
|
||||
|
||||
/**
|
||||
* Advertising channels map:
|
||||
* - ADV_CHNL_37_EN: Advertising channel map for channel 37.
|
||||
* - ADV_CHNL_38_EN: Advertising channel map for channel 38.
|
||||
* - ADV_CHNL_39_EN: Advertising channel map for channel 39.
|
||||
* - ADV_ALL_CHNLS_EN: Advertising channel map for channel 37, 38 and 39.
|
||||
*/
|
||||
.channel_map = ADV_ALL_CHNLS_EN,
|
||||
|
||||
/*************************
|
||||
* Advertising information
|
||||
*************************
|
||||
*/
|
||||
|
||||
/// Host information advertising data (GAPM_ADV_NON_CONN and GAPM_ADV_UNDIRECT)
|
||||
/// Advertising mode :
|
||||
/// - GAP_NON_DISCOVERABLE: Non discoverable mode
|
||||
/// - GAP_GEN_DISCOVERABLE: General discoverable mode
|
||||
/// - GAP_LIM_DISCOVERABLE: Limited discoverable mode
|
||||
/// - GAP_BROADCASTER_MODE: Broadcaster mode
|
||||
.mode = GAP_GEN_DISCOVERABLE,
|
||||
|
||||
/// Host information advertising data (GAPM_ADV_NON_CONN and GAPM_ADV_UNDIRECT)
|
||||
/// Advertising filter policy:
|
||||
/// - ADV_ALLOW_SCAN_ANY_CON_ANY: Allow both scan and connection requests from anyone
|
||||
/// - ADV_ALLOW_SCAN_ANY_CON_WLST: Allow both scan req from anyone and connection req from
|
||||
/// White List devices only
|
||||
.adv_filt_policy = ADV_ALLOW_SCAN_ANY_CON_ANY,
|
||||
|
||||
/// Address of peer device
|
||||
/// NOTE: Meant for directed advertising (ADV_DIRECT_IND)
|
||||
.peer_addr = {0x1, 0x2, 0x3, 0x4, 0x5, 0x6},
|
||||
|
||||
/// Address type of peer device (0=public/1=random)
|
||||
/// NOTE: Meant for directed advertising (ADV_DIRECT_IND)
|
||||
.peer_addr_type = 0,
|
||||
};
|
||||
|
||||
/*
|
||||
****************************************************************************************
|
||||
*
|
||||
* Advertising or scan response data for the following cases:
|
||||
*
|
||||
* - ADV_IND: Connectable undirected advertising event.
|
||||
* - The maximum length of the user defined advertising data shall be 28 bytes.
|
||||
* - The Flags data type are written by the related ROM function, hence the user shall
|
||||
* not include them in the advertising data. The related ROM function adds 3 bytes in
|
||||
* the start of the advertising data that are to be transmitted over the air.
|
||||
* - The maximum length of the user defined response data shall be 31 bytes.
|
||||
*
|
||||
* - ADV_NONCONN_IND: Non-connectable undirected advertising event.
|
||||
* - The maximum length of the user defined advertising data shall be 31 bytes.
|
||||
* - The Flags data type may be omitted, hence the user can use all the 31 bytes for
|
||||
* data.
|
||||
* - The scan response data shall be empty.
|
||||
*
|
||||
* - ADV_SCAN_IND: Scannable undirected advertising event.
|
||||
* - The maximum length of the user defined advertising data shall be 31 bytes.
|
||||
* - The Flags data type may be omitted, hence the user can use all the 31 bytes for
|
||||
* data.
|
||||
* - The maximum length of the user defined response data shall be 31 bytes.
|
||||
****************************************************************************************
|
||||
*/
|
||||
/// Advertising data
|
||||
#define USER_ADVERTISE_DATA ("\x03"\
|
||||
ADV_TYPE_COMPLETE_LIST_16BIT_SERVICE_IDS\
|
||||
ADV_UUID_DEVICE_INFORMATION_SERVICE\
|
||||
"\x11"\
|
||||
ADV_TYPE_COMPLETE_LIST_128BIT_SERVICE_IDS\
|
||||
"\x59\x5A\x08\xE4\x86\x2A\x9E\x8F\xE9\x11\xBC\x7C\x98\x43\x42\x18")
|
||||
|
||||
/// Advertising data length - maximum 28 bytes, 3 bytes are reserved to set
|
||||
#define USER_ADVERTISE_DATA_LEN (sizeof(USER_ADVERTISE_DATA)-1)
|
||||
|
||||
/// Scan response data
|
||||
#define USER_ADVERTISE_SCAN_RESPONSE_DATA ""
|
||||
|
||||
/// Scan response data length- maximum 31 bytes
|
||||
#define USER_ADVERTISE_SCAN_RESPONSE_DATA_LEN (sizeof(USER_ADVERTISE_SCAN_RESPONSE_DATA)-1)
|
||||
|
||||
/*
|
||||
****************************************************************************************
|
||||
*
|
||||
* Device name.
|
||||
*
|
||||
* - If there is space left in the advertising or scan response data the device name is
|
||||
* copied there. The device name can be anytime read by a connected peer, if the
|
||||
* application supports it.
|
||||
* - The Bluetooth device name can be up to 248 bytes.
|
||||
*
|
||||
****************************************************************************************
|
||||
*/
|
||||
/// Device name
|
||||
#define USER_DEVICE_NAME "DLG-CLOCK"
|
||||
|
||||
/// Device name length
|
||||
#define USER_DEVICE_NAME_LEN (sizeof(USER_DEVICE_NAME)-1)
|
||||
|
||||
/*
|
||||
****************************************************************************************
|
||||
*
|
||||
* GAPM configuration
|
||||
*
|
||||
****************************************************************************************
|
||||
*/
|
||||
static const struct gapm_configuration user_gapm_conf = {
|
||||
/// Device Role: Central, Peripheral, Observer, Broadcaster or All roles. (@see enum gap_role)
|
||||
.role = GAP_ROLE_PERIPHERAL,
|
||||
|
||||
/// Maximal MTU. Shall be set to 23 if Legacy Pairing is used, 65 if Secure Connection is used,
|
||||
/// more if required by the application
|
||||
.max_mtu = 23,
|
||||
|
||||
/// Device Address Type
|
||||
.addr_type = APP_CFG_ADDR_TYPE(USER_CFG_ADDRESS_MODE),
|
||||
/// Duration before regenerating the Random Private Address when privacy is enabled
|
||||
.renew_dur = 15000, // 15000 * 10ms = 150s is the minimum value
|
||||
|
||||
/***********************
|
||||
* Privacy configuration
|
||||
***********************
|
||||
*/
|
||||
|
||||
/// Random Static address
|
||||
// NOTE: The address shall comply with the following requirements:
|
||||
// - the two most significant bits of the address shall be equal to 1,
|
||||
// - all the remaining bits of the address shall NOT be equal to 1,
|
||||
// - all the remaining bits of the address shall NOT be equal to 0.
|
||||
// In case the {0x00, 0x00, 0x00, 0x00, 0x00, 0x00} null address is used, a
|
||||
// random static address will be automatically generated.
|
||||
.addr = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
|
||||
|
||||
/// Device IRK used for Resolvable Private Address generation (LSB first)
|
||||
.irk = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f},
|
||||
|
||||
/****************************
|
||||
* ATT database configuration
|
||||
****************************
|
||||
*/
|
||||
|
||||
/// Attribute database configuration (@see enum gapm_att_cfg_flag)
|
||||
/// 7 6 5 4 3 2 1 0
|
||||
/// +-----+-----+----+-----+-----+----+----+----+
|
||||
/// | DBG | RFU | SC | PCP | APP_PERM |NAME_PERM|
|
||||
/// +-----+-----+----+-----+-----+----+----+----+
|
||||
/// - Bit [0-1]: Device Name write permission requirements for peer device (@see device_name_write_perm)
|
||||
/// - Bit [2-3]: Device Appearance write permission requirements for peer device (@see device_appearance_write_perm)
|
||||
/// - Bit [4] : Slave Preferred Connection Parameters present
|
||||
/// - Bit [5] : Service change feature present in GATT attribute database.
|
||||
/// - Bit [6] : Reserved
|
||||
/// - Bit [7] : Enable Debug Mode
|
||||
.att_cfg = GAPM_MASK_ATT_SVC_CHG_EN,
|
||||
|
||||
/// GAP service start handle
|
||||
.gap_start_hdl = 0,
|
||||
|
||||
/// GATT service start handle
|
||||
.gatt_start_hdl = 0,
|
||||
|
||||
/**************************************************
|
||||
* Data packet length extension configuration (4.2)
|
||||
**************************************************
|
||||
*/
|
||||
|
||||
/// Maximal MPS
|
||||
.max_mps = 0,
|
||||
|
||||
/// Maximal Tx octets (connInitialMaxTxOctets value, as defined in 4.2 Specification)
|
||||
.max_txoctets = 251,
|
||||
|
||||
/// Maximal Tx time (connInitialMaxTxTime value, as defined in 4.2 Specification)
|
||||
.max_txtime = 2120,
|
||||
};
|
||||
|
||||
/*
|
||||
****************************************************************************************
|
||||
*
|
||||
* Parameter update configuration
|
||||
*
|
||||
****************************************************************************************
|
||||
*/
|
||||
static const struct connection_param_configuration user_connection_param_conf = {
|
||||
/// Connection interval minimum measured in ble double slots (1.25ms)
|
||||
/// use the macro MS_TO_DOUBLESLOTS to convert from milliseconds (ms) to double slots
|
||||
.intv_min = MS_TO_DOUBLESLOTS(10),
|
||||
|
||||
/// Connection interval maximum measured in ble double slots (1.25ms)
|
||||
/// use the macro MS_TO_DOUBLESLOTS to convert from milliseconds (ms) to double slots
|
||||
.intv_max = MS_TO_DOUBLESLOTS(20),
|
||||
|
||||
/// Latency measured in connection events
|
||||
.latency = 0,
|
||||
|
||||
/// Supervision timeout measured in timer units (10 ms)
|
||||
/// use the macro MS_TO_TIMERUNITS to convert from milliseconds (ms) to timer units
|
||||
.time_out = MS_TO_TIMERUNITS(2500),
|
||||
|
||||
/// Minimum Connection Event Duration measured in ble double slots (1.25ms)
|
||||
/// use the macro MS_TO_DOUBLESLOTS to convert from milliseconds (ms) to double slots
|
||||
.ce_len_min = MS_TO_DOUBLESLOTS(0),
|
||||
|
||||
/// Maximum Connection Event Duration measured in ble double slots (1.25ms)
|
||||
/// use the macro MS_TO_DOUBLESLOTS to convert from milliseconds (ms) to double slots
|
||||
.ce_len_max = MS_TO_DOUBLESLOTS(0),
|
||||
};
|
||||
|
||||
/*
|
||||
****************************************************************************************
|
||||
*
|
||||
* Default handlers configuration (applies only for @app_default_handlers.c)
|
||||
*
|
||||
****************************************************************************************
|
||||
*/
|
||||
static const struct default_handlers_configuration user_default_hnd_conf = {
|
||||
// Configure the advertise operation used by the default handlers
|
||||
// Possible values:
|
||||
// - DEF_ADV_FOREVER
|
||||
// - DEF_ADV_WITH_TIMEOUT
|
||||
.adv_scenario = DEF_ADV_WITH_TIMEOUT,
|
||||
|
||||
// Configure the advertise period in case of DEF_ADV_WITH_TIMEOUT.
|
||||
// It is measured in timer units (3 min). Use MS_TO_TIMERUNITS macro to convert
|
||||
// from milliseconds (ms) to timer units.
|
||||
.advertise_period = MS_TO_TIMERUNITS(30000),
|
||||
|
||||
// Configure the security start operation of the default handlers
|
||||
// if the security is enabled (CFG_APP_SECURITY)
|
||||
// Possible values:
|
||||
// - DEF_SEC_REQ_NEVER
|
||||
// - DEF_SEC_REQ_ON_CONNECT
|
||||
.security_request_scenario = DEF_SEC_REQ_NEVER
|
||||
};
|
||||
|
||||
/*
|
||||
****************************************************************************************
|
||||
*
|
||||
* Central configuration (not used by current example)
|
||||
*
|
||||
****************************************************************************************
|
||||
*/
|
||||
static const struct central_configuration user_central_conf = {
|
||||
/// GAPM requested operation:
|
||||
/// - GAPM_CONNECTION_DIRECT: Direct connection operation
|
||||
/// - GAPM_CONNECTION_AUTO: Automatic connection operation
|
||||
/// - GAPM_CONNECTION_SELECTIVE: Selective connection operation
|
||||
/// - GAPM_CONNECTION_NAME_REQUEST: Name Request operation (requires to start a direct
|
||||
/// connection)
|
||||
.code = GAPM_CONNECTION_DIRECT,
|
||||
|
||||
/// Own BD address source of the device:
|
||||
.addr_src = APP_CFG_ADDR_SRC(USER_CFG_ADDRESS_MODE),
|
||||
|
||||
/// Scan interval
|
||||
.scan_interval = 0x180,
|
||||
|
||||
/// Scan window size
|
||||
.scan_window = 0x160,
|
||||
|
||||
/// Minimum of connection interval
|
||||
.con_intv_min = 100,
|
||||
|
||||
/// Maximum of connection interval
|
||||
.con_intv_max = 100,
|
||||
|
||||
/// Connection latency
|
||||
.con_latency = 0,
|
||||
|
||||
/// Link supervision timeout
|
||||
.superv_to = 0x1F4,
|
||||
|
||||
/// Minimum CE length
|
||||
.ce_len_min = 0,
|
||||
|
||||
/// Maximum CE length
|
||||
.ce_len_max = 0x5,
|
||||
|
||||
/**************************************************************************************
|
||||
* Peer device information (maximum number of peers = 8)
|
||||
**************************************************************************************
|
||||
*/
|
||||
|
||||
/// BD Address of device
|
||||
.peer_addr_0 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
|
||||
|
||||
/// Address type of the device 0=public/1=random
|
||||
.peer_addr_0_type = 0,
|
||||
|
||||
/// BD Address of device
|
||||
.peer_addr_1 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
|
||||
|
||||
/// Address type of the device 0=public/1=random
|
||||
.peer_addr_1_type = 0,
|
||||
|
||||
/// BD Address of device
|
||||
.peer_addr_2 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
|
||||
|
||||
/// Address type of the device 0=public/1=random
|
||||
.peer_addr_2_type = 0,
|
||||
|
||||
/// BD Address of device
|
||||
.peer_addr_3 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
|
||||
|
||||
/// Address type of the device 0=public/1=random
|
||||
.peer_addr_3_type = 0,
|
||||
|
||||
/// BD Address of device
|
||||
.peer_addr_4 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
|
||||
|
||||
/// Address type of the device 0=public/1=random
|
||||
.peer_addr_4_type = 0,
|
||||
|
||||
/// BD Address of device
|
||||
.peer_addr_5 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
|
||||
|
||||
/// Address type of the device 0=public/1=random
|
||||
.peer_addr_5_type = 0,
|
||||
|
||||
/// BD Address of device
|
||||
.peer_addr_6 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
|
||||
|
||||
/// Address type of the device 0=public/1=random
|
||||
.peer_addr_6_type = 0,
|
||||
|
||||
/// BD Address of device
|
||||
.peer_addr_7 = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0},
|
||||
|
||||
/// Address type of the device 0=public/1=random
|
||||
.peer_addr_7_type = 0,
|
||||
};
|
||||
|
||||
/*
|
||||
****************************************************************************************
|
||||
*
|
||||
* Security related configuration
|
||||
*
|
||||
****************************************************************************************
|
||||
*/
|
||||
static const struct security_configuration user_security_conf = {
|
||||
// IO Capabilities
|
||||
#if defined (USER_CFG_FEAT_IO_CAP)
|
||||
.iocap = USER_CFG_FEAT_IO_CAP,
|
||||
#else
|
||||
.iocap = GAP_IO_CAP_NO_INPUT_NO_OUTPUT,
|
||||
#endif
|
||||
|
||||
// OOB Capabilities
|
||||
#if defined (USER_CFG_FEAT_OOB)
|
||||
.oob = USER_CFG_FEAT_OOB,
|
||||
#else
|
||||
.oob = GAP_OOB_AUTH_DATA_NOT_PRESENT,
|
||||
#endif
|
||||
|
||||
// Authentication Requirements
|
||||
#if defined (USER_CFG_FEAT_AUTH_REQ)
|
||||
.auth = USER_CFG_FEAT_AUTH_REQ,
|
||||
#else
|
||||
.auth = GAP_AUTH_NONE,
|
||||
#endif
|
||||
|
||||
// LTK size
|
||||
#if defined (USER_CFG_FEAT_KEY_SIZE)
|
||||
.key_size = USER_CFG_FEAT_KEY_SIZE,
|
||||
#else
|
||||
.key_size = KEY_LEN,
|
||||
#endif
|
||||
|
||||
// Initiator key distribution
|
||||
#if defined (USER_CFG_FEAT_INIT_KDIST)
|
||||
.ikey_dist = USER_CFG_FEAT_INIT_KDIST,
|
||||
#else
|
||||
.ikey_dist = GAP_KDIST_NONE,
|
||||
#endif
|
||||
|
||||
// Responder key distribution
|
||||
#if defined (USER_CFG_FEAT_RESP_KDIST)
|
||||
.rkey_dist = USER_CFG_FEAT_RESP_KDIST,
|
||||
#else
|
||||
.rkey_dist = GAP_KDIST_ENCKEY,
|
||||
#endif
|
||||
|
||||
// Security requirements (minimum security level)
|
||||
#if defined (USER_CFG_FEAT_SEC_REQ)
|
||||
.sec_req = USER_CFG_FEAT_SEC_REQ,
|
||||
#else
|
||||
.sec_req = GAP_NO_SEC,
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif // _USER_CONFIG_H_
|
||||
79
src/config/user_modules_config.h
Normal file
79
src/config/user_modules_config.h
Normal file
@@ -0,0 +1,79 @@
|
||||
/**
|
||||
****************************************************************************************
|
||||
*
|
||||
* @file user_modules_config.h
|
||||
*
|
||||
* @brief User modules configuration file.
|
||||
*
|
||||
* Copyright (C) 2015-2023 Renesas Electronics Corporation and/or its affiliates.
|
||||
* All rights reserved. Confidential Information.
|
||||
*
|
||||
* This software ("Software") is supplied by Renesas Electronics Corporation and/or its
|
||||
* affiliates ("Renesas"). Renesas grants you a personal, non-exclusive, non-transferable,
|
||||
* revocable, non-sub-licensable right and license to use the Software, solely if used in
|
||||
* or together with Renesas products. You may make copies of this Software, provided this
|
||||
* copyright notice and disclaimer ("Notice") is included in all such copies. Renesas
|
||||
* reserves the right to change or discontinue the Software at any time without notice.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS". RENESAS DISCLAIMS ALL WARRANTIES OF ANY KIND,
|
||||
* WHETHER EXPRESS, IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. TO THE
|
||||
* MAXIMUM EXTENT PERMITTED UNDER LAW, IN NO EVENT SHALL RENESAS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE, EVEN IF RENESAS HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGES. USE OF THIS SOFTWARE MAY BE SUBJECT TO TERMS AND CONDITIONS CONTAINED IN
|
||||
* AN ADDITIONAL AGREEMENT BETWEEN YOU AND RENESAS. IN CASE OF CONFLICT BETWEEN THE TERMS
|
||||
* OF THIS NOTICE AND ANY SUCH ADDITIONAL LICENSE AGREEMENT, THE TERMS OF THE AGREEMENT
|
||||
* SHALL TAKE PRECEDENCE. BY CONTINUING TO USE THIS SOFTWARE, YOU AGREE TO THE TERMS OF
|
||||
* THIS NOTICE.IF YOU DO NOT AGREE TO THESE TERMS, YOU ARE NOT PERMITTED TO USE THIS
|
||||
* SOFTWARE.
|
||||
*
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef _USER_MODULES_CONFIG_H_
|
||||
#define _USER_MODULES_CONFIG_H_
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @addtogroup APP
|
||||
* @ingroup RICOW
|
||||
*
|
||||
* @brief User modules configuration.
|
||||
*
|
||||
* @{
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
* DEFINES
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
/***************************************************************************************/
|
||||
/* Exclude or not a module in user's application code. */
|
||||
/* */
|
||||
/* (0) - The module is included. The module's messages are handled by the SDK. */
|
||||
/* */
|
||||
/* (1) - The module is excluded. The user must handle the module's messages. */
|
||||
/* */
|
||||
/* Note: */
|
||||
/* This setting has no effect if the respective module is a BLE Profile */
|
||||
/* that is not used included in the user's application. */
|
||||
/***************************************************************************************/
|
||||
#define EXCLUDE_DLG_GAP (0)
|
||||
#define EXCLUDE_DLG_TIMER (0)
|
||||
#define EXCLUDE_DLG_MSG (1)
|
||||
#define EXCLUDE_DLG_SEC (1)
|
||||
#define EXCLUDE_DLG_DISS (1)
|
||||
#define EXCLUDE_DLG_PROXR (1)
|
||||
#define EXCLUDE_DLG_BASS (1)
|
||||
#define EXCLUDE_DLG_FINDL (1)
|
||||
#define EXCLUDE_DLG_FINDT (1)
|
||||
#define EXCLUDE_DLG_SUOTAR (1)
|
||||
#define EXCLUDE_DLG_CUSTS1 (0)
|
||||
#define EXCLUDE_DLG_CUSTS2 (1)
|
||||
|
||||
/// @} APP
|
||||
|
||||
#endif // _USER_MODULES_CONFIG_H_
|
||||
169
src/config/user_periph_setup.h
Normal file
169
src/config/user_periph_setup.h
Normal file
@@ -0,0 +1,169 @@
|
||||
/**
|
||||
****************************************************************************************
|
||||
*
|
||||
* @file user_periph_setup.h
|
||||
*
|
||||
* @brief Peripherals setup header file.
|
||||
*
|
||||
* Copyright (C) 2015-2023 Renesas Electronics Corporation and/or its affiliates.
|
||||
* All rights reserved. Confidential Information.
|
||||
*
|
||||
* This software ("Software") is supplied by Renesas Electronics Corporation and/or its
|
||||
* affiliates ("Renesas"). Renesas grants you a personal, non-exclusive, non-transferable,
|
||||
* revocable, non-sub-licensable right and license to use the Software, solely if used in
|
||||
* or together with Renesas products. You may make copies of this Software, provided this
|
||||
* copyright notice and disclaimer ("Notice") is included in all such copies. Renesas
|
||||
* reserves the right to change or discontinue the Software at any time without notice.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS". RENESAS DISCLAIMS ALL WARRANTIES OF ANY KIND,
|
||||
* WHETHER EXPRESS, IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. TO THE
|
||||
* MAXIMUM EXTENT PERMITTED UNDER LAW, IN NO EVENT SHALL RENESAS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE, EVEN IF RENESAS HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGES. USE OF THIS SOFTWARE MAY BE SUBJECT TO TERMS AND CONDITIONS CONTAINED IN
|
||||
* AN ADDITIONAL AGREEMENT BETWEEN YOU AND RENESAS. IN CASE OF CONFLICT BETWEEN THE TERMS
|
||||
* OF THIS NOTICE AND ANY SUCH ADDITIONAL LICENSE AGREEMENT, THE TERMS OF THE AGREEMENT
|
||||
* SHALL TAKE PRECEDENCE. BY CONTINUING TO USE THIS SOFTWARE, YOU AGREE TO THE TERMS OF
|
||||
* THIS NOTICE.IF YOU DO NOT AGREE TO THESE TERMS, YOU ARE NOT PERMITTED TO USE THIS
|
||||
* SOFTWARE.
|
||||
*
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef _USER_PERIPH_SETUP_H_
|
||||
#define _USER_PERIPH_SETUP_H_
|
||||
|
||||
/*
|
||||
* INCLUDE FILES
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
#include "gpio.h"
|
||||
#include "uart.h"
|
||||
#include "spi.h"
|
||||
#include "spi_flash.h"
|
||||
#include "i2c.h"
|
||||
#include "i2c_eeprom.h"
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* DEFINES
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
/****************************************************************************************/
|
||||
/* UART2 configuration */
|
||||
/****************************************************************************************/
|
||||
// Define UART2 Tx Pad
|
||||
#if defined (__DA14531__)
|
||||
#define UART2_TX_PORT GPIO_PORT_0
|
||||
#define UART2_TX_PIN GPIO_PIN_6
|
||||
#else
|
||||
#define UART2_TX_PORT GPIO_PORT_0
|
||||
#define UART2_TX_PIN GPIO_PIN_4
|
||||
#endif
|
||||
|
||||
// Define UART2 Settings
|
||||
#define UART2_BAUDRATE UART_BAUDRATE_115200
|
||||
#define UART2_DATABITS UART_DATABITS_8
|
||||
#define UART2_PARITY UART_PARITY_NONE
|
||||
#define UART2_STOPBITS UART_STOPBITS_1
|
||||
#define UART2_AFCE UART_AFCE_DIS
|
||||
#define UART2_FIFO UART_FIFO_EN
|
||||
#define UART2_TX_FIFO_LEVEL UART_TX_FIFO_LEVEL_0
|
||||
#define UART2_RX_FIFO_LEVEL UART_RX_FIFO_LEVEL_0
|
||||
|
||||
|
||||
/****************************************************************************************/
|
||||
/* LED configuration */
|
||||
/****************************************************************************************/
|
||||
#if defined (__DA14531__)
|
||||
#define GPIO_LED_PORT GPIO_PORT_0
|
||||
#define GPIO_LED_PIN GPIO_PIN_9
|
||||
#else
|
||||
#define GPIO_LED_PORT GPIO_PORT_1
|
||||
#define GPIO_LED_PIN GPIO_PIN_0
|
||||
#endif
|
||||
|
||||
/****************************************************************************************/
|
||||
/* SPI configuration */
|
||||
/****************************************************************************************/
|
||||
// Define SPI Pads
|
||||
#if defined (__DA14531__)
|
||||
#define SPI_EN_PORT GPIO_PORT_0
|
||||
#define SPI_EN_PIN GPIO_PIN_1
|
||||
|
||||
#define SPI_CLK_PORT GPIO_PORT_0
|
||||
#define SPI_CLK_PIN GPIO_PIN_4
|
||||
|
||||
#define SPI_DO_PORT GPIO_PORT_0
|
||||
#define SPI_DO_PIN GPIO_PIN_0
|
||||
|
||||
#define SPI_DI_PORT GPIO_PORT_0
|
||||
#define SPI_DI_PIN GPIO_PIN_3
|
||||
|
||||
#elif !defined (__DA14586__)
|
||||
#define SPI_EN_PORT GPIO_PORT_0
|
||||
#define SPI_EN_PIN GPIO_PIN_3
|
||||
|
||||
#define SPI_CLK_PORT GPIO_PORT_0
|
||||
#define SPI_CLK_PIN GPIO_PIN_0
|
||||
|
||||
#define SPI_DO_PORT GPIO_PORT_0
|
||||
#define SPI_DO_PIN GPIO_PIN_6
|
||||
|
||||
#define SPI_DI_PORT GPIO_PORT_0
|
||||
#define SPI_DI_PIN GPIO_PIN_5
|
||||
#endif
|
||||
|
||||
/***************************************************************************************/
|
||||
/* Production debug output configuration */
|
||||
/***************************************************************************************/
|
||||
#if PRODUCTION_DEBUG_OUTPUT
|
||||
#if defined (__DA14531__)
|
||||
#define PRODUCTION_DEBUG_PORT GPIO_PORT_0
|
||||
#define PRODUCTION_DEBUG_PIN GPIO_PIN_11
|
||||
#else
|
||||
#define PRODUCTION_DEBUG_PORT GPIO_PORT_2
|
||||
#define PRODUCTION_DEBUG_PIN GPIO_PIN_5
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* FUNCTION DECLARATIONS
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
#if DEVELOPMENT_DEBUG
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief Reserves application's specific GPIOs
|
||||
* @details Used only in Development mode (#if DEVELOPMENT_DEBUG)
|
||||
* i.e. to reserve P0_1 as Generic Purpose I/O:
|
||||
* RESERVE_GPIO(DESCRIPTIVE_NAME, GPIO_PORT_0, GPIO_PIN_1, PID_GPIO);
|
||||
****************************************************************************************
|
||||
*/
|
||||
void GPIO_reservations(void);
|
||||
#endif
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief Sets the functionality of application pads
|
||||
* @details i.e. to set P0_1 as Generic purpose Output:
|
||||
* GPIO_ConfigurePin(GPIO_PORT_0, GPIO_PIN_1, OUTPUT, PID_GPIO, false);
|
||||
****************************************************************************************
|
||||
*/
|
||||
void set_pad_functions(void);
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief Initializes application's peripherals and pins
|
||||
****************************************************************************************
|
||||
*/
|
||||
void periph_init(void);
|
||||
|
||||
|
||||
#endif // _USER_PERIPH_SETUP_H_
|
||||
73
src/config/user_profiles_config.h
Normal file
73
src/config/user_profiles_config.h
Normal file
@@ -0,0 +1,73 @@
|
||||
/**
|
||||
****************************************************************************************
|
||||
*
|
||||
* @file user_profiles_config.h
|
||||
*
|
||||
* @brief Configuration file for the profiles used in the application.
|
||||
*
|
||||
* Copyright (C) 2017-2023 Renesas Electronics Corporation and/or its affiliates.
|
||||
* All rights reserved. Confidential Information.
|
||||
*
|
||||
* This software ("Software") is supplied by Renesas Electronics Corporation and/or its
|
||||
* affiliates ("Renesas"). Renesas grants you a personal, non-exclusive, non-transferable,
|
||||
* revocable, non-sub-licensable right and license to use the Software, solely if used in
|
||||
* or together with Renesas products. You may make copies of this Software, provided this
|
||||
* copyright notice and disclaimer ("Notice") is included in all such copies. Renesas
|
||||
* reserves the right to change or discontinue the Software at any time without notice.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS". RENESAS DISCLAIMS ALL WARRANTIES OF ANY KIND,
|
||||
* WHETHER EXPRESS, IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. TO THE
|
||||
* MAXIMUM EXTENT PERMITTED UNDER LAW, IN NO EVENT SHALL RENESAS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE, EVEN IF RENESAS HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGES. USE OF THIS SOFTWARE MAY BE SUBJECT TO TERMS AND CONDITIONS CONTAINED IN
|
||||
* AN ADDITIONAL AGREEMENT BETWEEN YOU AND RENESAS. IN CASE OF CONFLICT BETWEEN THE TERMS
|
||||
* OF THIS NOTICE AND ANY SUCH ADDITIONAL LICENSE AGREEMENT, THE TERMS OF THE AGREEMENT
|
||||
* SHALL TAKE PRECEDENCE. BY CONTINUING TO USE THIS SOFTWARE, YOU AGREE TO THE TERMS OF
|
||||
* THIS NOTICE.IF YOU DO NOT AGREE TO THESE TERMS, YOU ARE NOT PERMITTED TO USE THIS
|
||||
* SOFTWARE.
|
||||
*
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef _USER_PROFILES_CONFIG_H_
|
||||
#define _USER_PROFILES_CONFIG_H_
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @defgroup APP_CONFIG
|
||||
* @ingroup APP
|
||||
* @brief Application configuration file
|
||||
*
|
||||
* This file contains the configuration of the profiles used by the application.
|
||||
*
|
||||
* @{
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
* DEFINITIONS
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
/***************************************************************************************/
|
||||
/* Used BLE profiles (used by "rwprf_config.h"). */
|
||||
/***************************************************************************************/
|
||||
|
||||
#define CFG_PRF_CUST1
|
||||
|
||||
/***************************************************************************************/
|
||||
/* Profile application configuration section */
|
||||
/***************************************************************************************/
|
||||
|
||||
|
||||
/*
|
||||
****************************************************************************************
|
||||
* CUST1 application profile configuration
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
/// @} APP_CONFIG
|
||||
|
||||
#endif // _USER_PROFILES_CONFIG_H_
|
||||
114
src/custom_profile/user_custs1_def.c
Normal file
114
src/custom_profile/user_custs1_def.c
Normal file
@@ -0,0 +1,114 @@
|
||||
/**
|
||||
****************************************************************************************
|
||||
*
|
||||
* @file user_custs1_def.c
|
||||
*
|
||||
* @brief Custom Server 1 (CUSTS1) profile database definitions.
|
||||
*
|
||||
* Copyright (C) 2016-2023 Renesas Electronics Corporation and/or its affiliates.
|
||||
* All rights reserved. Confidential Information.
|
||||
*
|
||||
* This software ("Software") is supplied by Renesas Electronics Corporation and/or its
|
||||
* affiliates ("Renesas"). Renesas grants you a personal, non-exclusive, non-transferable,
|
||||
* revocable, non-sub-licensable right and license to use the Software, solely if used in
|
||||
* or together with Renesas products. You may make copies of this Software, provided this
|
||||
* copyright notice and disclaimer ("Notice") is included in all such copies. Renesas
|
||||
* reserves the right to change or discontinue the Software at any time without notice.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS". RENESAS DISCLAIMS ALL WARRANTIES OF ANY KIND,
|
||||
* WHETHER EXPRESS, IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. TO THE
|
||||
* MAXIMUM EXTENT PERMITTED UNDER LAW, IN NO EVENT SHALL RENESAS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE, EVEN IF RENESAS HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGES. USE OF THIS SOFTWARE MAY BE SUBJECT TO TERMS AND CONDITIONS CONTAINED IN
|
||||
* AN ADDITIONAL AGREEMENT BETWEEN YOU AND RENESAS. IN CASE OF CONFLICT BETWEEN THE TERMS
|
||||
* OF THIS NOTICE AND ANY SUCH ADDITIONAL LICENSE AGREEMENT, THE TERMS OF THE AGREEMENT
|
||||
* SHALL TAKE PRECEDENCE. BY CONTINUING TO USE THIS SOFTWARE, YOU AGREE TO THE TERMS OF
|
||||
* THIS NOTICE.IF YOU DO NOT AGREE TO THESE TERMS, YOU ARE NOT PERMITTED TO USE THIS
|
||||
* SOFTWARE.
|
||||
*
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @defgroup USER_CONFIG
|
||||
* @ingroup USER
|
||||
* @brief Custom server 1 (CUSTS1) profile database definitions.
|
||||
*
|
||||
* @{
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
* INCLUDE FILES
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include "co_utils.h"
|
||||
#include "prf_types.h"
|
||||
#include "attm_db_128.h"
|
||||
#include "user_custs1_def.h"
|
||||
|
||||
/*
|
||||
* LOCAL VARIABLE DEFINITIONS
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
// Service 1 of the custom server 1
|
||||
static const att_svc_desc128_t custs1_svc1 = DEF_SVC1_UUID_128;
|
||||
|
||||
static const uint8_t SVC1_CTRL_POINT_UUID_128[ATT_UUID_128_LEN] = DEF_SVC1_CTRL_POINT_UUID_128;
|
||||
static const uint8_t SVC1_ADC_VAL_1_UUID_128[ATT_UUID_128_LEN] = DEF_SVC1_ADC_VAL_1_UUID_128;
|
||||
static const uint8_t SVC1_LONG_VALUE_UUID_128[ATT_UUID_128_LEN] = DEF_SVC1_LONG_VALUE_UUID_128;
|
||||
|
||||
|
||||
// Attribute specifications
|
||||
static const uint16_t att_decl_svc = ATT_DECL_PRIMARY_SERVICE;
|
||||
static const uint16_t att_decl_char = ATT_DECL_CHARACTERISTIC;
|
||||
static const uint16_t att_desc_cfg = ATT_DESC_CLIENT_CHAR_CFG;
|
||||
|
||||
/*
|
||||
* GLOBAL VARIABLE DEFINITIONS
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
const uint8_t custs1_services[] = {SVC1_IDX_SVC, CUSTS1_IDX_NB};
|
||||
const uint8_t custs1_services_size = ARRAY_LEN(custs1_services) - 1;
|
||||
const uint16_t custs1_att_max_nb = CUSTS1_IDX_NB;
|
||||
|
||||
|
||||
/// Full CUSTS1 Database Description - Used to add attributes into the database
|
||||
const struct attm_desc_128 custs1_att_db[CUSTS1_IDX_NB] =
|
||||
{
|
||||
/*************************
|
||||
* Service 1 configuration
|
||||
*************************
|
||||
*/
|
||||
|
||||
// Service 1 Declaration
|
||||
[SVC1_IDX_SVC] = {(uint8_t*)&att_decl_svc, ATT_UUID_128_LEN, PERM(RD, ENABLE),
|
||||
sizeof(custs1_svc1), sizeof(custs1_svc1), (uint8_t*)&custs1_svc1},
|
||||
|
||||
// Control Point Characteristic Declaration
|
||||
[SVC1_IDX_CONTROL_POINT_CHAR] = {(uint8_t*)&att_decl_char, ATT_UUID_16_LEN, PERM(RD, ENABLE), 0, 0, NULL},
|
||||
// Control Point Characteristic Value
|
||||
[SVC1_IDX_CONTROL_POINT_VAL] = {SVC1_CTRL_POINT_UUID_128, ATT_UUID_128_LEN, PERM(WR, ENABLE) | PERM(WRITE_REQ, ENABLE),
|
||||
DEF_SVC1_CTRL_POINT_CHAR_LEN, 0, 0},
|
||||
|
||||
// ADC Value 1 Characteristic Declaration
|
||||
[SVC1_IDX_ADC_VAL_1_CHAR] = {(uint8_t*)&att_decl_char, ATT_UUID_16_LEN, PERM(RD, ENABLE), 0, 0, NULL},
|
||||
// ADC Value 1 Characteristic Value
|
||||
[SVC1_IDX_ADC_VAL_1_VAL] = {SVC1_ADC_VAL_1_UUID_128, ATT_UUID_128_LEN, PERM(RD, ENABLE),
|
||||
DEF_SVC1_ADC_VAL_1_CHAR_LEN, 0, 0},
|
||||
|
||||
// Long Value Characteristic Declaration
|
||||
[SVC1_IDX_LONG_VALUE_CHAR] = {(uint8_t*)&att_decl_char, ATT_UUID_16_LEN, PERM(RD, ENABLE), 0, 0, NULL},
|
||||
// Long Value Characteristic Value
|
||||
[SVC1_IDX_LONG_VALUE_VAL] = {SVC1_LONG_VALUE_UUID_128, ATT_UUID_128_LEN, PERM(RD, ENABLE) | PERM(WR, ENABLE) | PERM(WRITE_REQ, ENABLE),
|
||||
DEF_SVC1_LONG_VALUE_CHAR_LEN, 0, 0},
|
||||
};
|
||||
|
||||
/// @} USER_CONFIG
|
||||
91
src/custom_profile/user_custs1_def.h
Normal file
91
src/custom_profile/user_custs1_def.h
Normal file
@@ -0,0 +1,91 @@
|
||||
/**
|
||||
****************************************************************************************
|
||||
*
|
||||
* @file user_custs1_def.h
|
||||
*
|
||||
* @brief Custom Server 1 (CUSTS1) profile database definitions.
|
||||
*
|
||||
* Copyright (C) 2016-2023 Renesas Electronics Corporation and/or its affiliates.
|
||||
* All rights reserved. Confidential Information.
|
||||
*
|
||||
* This software ("Software") is supplied by Renesas Electronics Corporation and/or its
|
||||
* affiliates ("Renesas"). Renesas grants you a personal, non-exclusive, non-transferable,
|
||||
* revocable, non-sub-licensable right and license to use the Software, solely if used in
|
||||
* or together with Renesas products. You may make copies of this Software, provided this
|
||||
* copyright notice and disclaimer ("Notice") is included in all such copies. Renesas
|
||||
* reserves the right to change or discontinue the Software at any time without notice.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS". RENESAS DISCLAIMS ALL WARRANTIES OF ANY KIND,
|
||||
* WHETHER EXPRESS, IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. TO THE
|
||||
* MAXIMUM EXTENT PERMITTED UNDER LAW, IN NO EVENT SHALL RENESAS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE, EVEN IF RENESAS HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGES. USE OF THIS SOFTWARE MAY BE SUBJECT TO TERMS AND CONDITIONS CONTAINED IN
|
||||
* AN ADDITIONAL AGREEMENT BETWEEN YOU AND RENESAS. IN CASE OF CONFLICT BETWEEN THE TERMS
|
||||
* OF THIS NOTICE AND ANY SUCH ADDITIONAL LICENSE AGREEMENT, THE TERMS OF THE AGREEMENT
|
||||
* SHALL TAKE PRECEDENCE. BY CONTINUING TO USE THIS SOFTWARE, YOU AGREE TO THE TERMS OF
|
||||
* THIS NOTICE.IF YOU DO NOT AGREE TO THESE TERMS, YOU ARE NOT PERMITTED TO USE THIS
|
||||
* SOFTWARE.
|
||||
*
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef _USER_CUSTS1_DEF_H_
|
||||
#define _USER_CUSTS1_DEF_H_
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @defgroup USER_CONFIG
|
||||
* @ingroup USER
|
||||
* @brief Custom Server 1 (CUSTS1) profile database definitions.
|
||||
*
|
||||
* @{
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
* INCLUDE FILES
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
#include "attm_db_128.h"
|
||||
|
||||
/*
|
||||
* DEFINES
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
// Service 1 of the custom server 1
|
||||
#define DEF_SVC1_UUID_128 {0x59, 0x5a, 0x08, 0xe4, 0x86, 0x2a, 0x9e, 0x8f, 0xe9, 0x11, 0xbc, 0x7c, 0x98, 0x43, 0x42, 0x18}
|
||||
|
||||
#define DEF_SVC1_CTRL_POINT_UUID_128 {0x20, 0xEE, 0x8D, 0x0C, 0xE1, 0xF0, 0x4A, 0x0C, 0xB3, 0x25, 0xDC, 0x53, 0x6A, 0x68, 0x86, 0x2D}
|
||||
#define DEF_SVC1_ADC_VAL_1_UUID_128 {0x17, 0xB9, 0x67, 0x98, 0x4C, 0x66, 0x4C, 0x01, 0x96, 0x33, 0x31, 0xB1, 0x91, 0x59, 0x00, 0x15}
|
||||
#define DEF_SVC1_LONG_VALUE_UUID_128 {0x8C, 0x09, 0xE0, 0xD1, 0x81, 0x54, 0x42, 0x40, 0x8E, 0x4F, 0xD2, 0xB3, 0x77, 0xE3, 0x2A, 0x77}
|
||||
|
||||
#define DEF_SVC1_CTRL_POINT_CHAR_LEN 1
|
||||
#define DEF_SVC1_ADC_VAL_1_CHAR_LEN 2
|
||||
#define DEF_SVC1_LONG_VALUE_CHAR_LEN 48
|
||||
|
||||
|
||||
/// Custom1 Service Data Base Characteristic enum
|
||||
enum
|
||||
{
|
||||
// Custom Service 1
|
||||
SVC1_IDX_SVC = 0,
|
||||
|
||||
SVC1_IDX_CONTROL_POINT_CHAR,
|
||||
SVC1_IDX_CONTROL_POINT_VAL,
|
||||
|
||||
SVC1_IDX_ADC_VAL_1_CHAR,
|
||||
SVC1_IDX_ADC_VAL_1_VAL,
|
||||
|
||||
SVC1_IDX_LONG_VALUE_CHAR,
|
||||
SVC1_IDX_LONG_VALUE_VAL,
|
||||
|
||||
CUSTS1_IDX_NB
|
||||
};
|
||||
|
||||
/// @} USER_CONFIG
|
||||
|
||||
#endif // _USER_CUSTS1_DEF_H_
|
||||
80
src/custom_profile/user_custs_config.c
Normal file
80
src/custom_profile/user_custs_config.c
Normal file
@@ -0,0 +1,80 @@
|
||||
/**
|
||||
****************************************************************************************
|
||||
*
|
||||
* @file user_custs_config.c
|
||||
*
|
||||
* @brief Custom1/2 Server (CUSTS1/2) profile database structure and initialization.
|
||||
*
|
||||
* Copyright (C) 2016-2023 Renesas Electronics Corporation and/or its affiliates.
|
||||
* All rights reserved. Confidential Information.
|
||||
*
|
||||
* This software ("Software") is supplied by Renesas Electronics Corporation and/or its
|
||||
* affiliates ("Renesas"). Renesas grants you a personal, non-exclusive, non-transferable,
|
||||
* revocable, non-sub-licensable right and license to use the Software, solely if used in
|
||||
* or together with Renesas products. You may make copies of this Software, provided this
|
||||
* copyright notice and disclaimer ("Notice") is included in all such copies. Renesas
|
||||
* reserves the right to change or discontinue the Software at any time without notice.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS". RENESAS DISCLAIMS ALL WARRANTIES OF ANY KIND,
|
||||
* WHETHER EXPRESS, IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. TO THE
|
||||
* MAXIMUM EXTENT PERMITTED UNDER LAW, IN NO EVENT SHALL RENESAS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE, EVEN IF RENESAS HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGES. USE OF THIS SOFTWARE MAY BE SUBJECT TO TERMS AND CONDITIONS CONTAINED IN
|
||||
* AN ADDITIONAL AGREEMENT BETWEEN YOU AND RENESAS. IN CASE OF CONFLICT BETWEEN THE TERMS
|
||||
* OF THIS NOTICE AND ANY SUCH ADDITIONAL LICENSE AGREEMENT, THE TERMS OF THE AGREEMENT
|
||||
* SHALL TAKE PRECEDENCE. BY CONTINUING TO USE THIS SOFTWARE, YOU AGREE TO THE TERMS OF
|
||||
* THIS NOTICE.IF YOU DO NOT AGREE TO THESE TERMS, YOU ARE NOT PERMITTED TO USE THIS
|
||||
* SOFTWARE.
|
||||
*
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @defgroup USER_CONFIG
|
||||
* @ingroup USER
|
||||
* @brief Custom1/2 Server (CUSTS1/2) profile database structure and initialization.
|
||||
*
|
||||
* @{
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
* INCLUDE FILES
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
#include "app_prf_types.h"
|
||||
#include "app_customs.h"
|
||||
#include "user_custs1_def.h"
|
||||
|
||||
/*
|
||||
* GLOBAL VARIABLE DEFINITIONS
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
#if (BLE_CUSTOM1_SERVER)
|
||||
extern const struct attm_desc_128 custs1_att_db[CUSTS1_IDX_NB];
|
||||
#endif
|
||||
|
||||
/// Custom1/2 server function callback table
|
||||
const struct cust_prf_func_callbacks cust_prf_funcs[] =
|
||||
{
|
||||
#if (BLE_CUSTOM1_SERVER)
|
||||
{ TASK_ID_CUSTS1,
|
||||
custs1_att_db,
|
||||
CUSTS1_IDX_NB,
|
||||
#if (BLE_APP_PRESENT)
|
||||
app_custs1_create_db, NULL,
|
||||
#else
|
||||
NULL, NULL,
|
||||
#endif
|
||||
NULL, NULL,
|
||||
},
|
||||
#endif
|
||||
{TASK_ID_INVALID, NULL, 0, NULL, NULL, NULL, NULL}, // DO NOT MOVE. Must always be last
|
||||
};
|
||||
|
||||
/// @} USER_CONFIG
|
||||
63
src/custom_profile/user_custs_config.h
Normal file
63
src/custom_profile/user_custs_config.h
Normal file
@@ -0,0 +1,63 @@
|
||||
/**
|
||||
****************************************************************************************
|
||||
*
|
||||
* @file user_custs_config.h
|
||||
*
|
||||
* @brief Custom1/2 Server (CUSTS1/2) profile database initialization.
|
||||
*
|
||||
* Copyright (C) 2016-2023 Renesas Electronics Corporation and/or its affiliates.
|
||||
* All rights reserved. Confidential Information.
|
||||
*
|
||||
* This software ("Software") is supplied by Renesas Electronics Corporation and/or its
|
||||
* affiliates ("Renesas"). Renesas grants you a personal, non-exclusive, non-transferable,
|
||||
* revocable, non-sub-licensable right and license to use the Software, solely if used in
|
||||
* or together with Renesas products. You may make copies of this Software, provided this
|
||||
* copyright notice and disclaimer ("Notice") is included in all such copies. Renesas
|
||||
* reserves the right to change or discontinue the Software at any time without notice.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS". RENESAS DISCLAIMS ALL WARRANTIES OF ANY KIND,
|
||||
* WHETHER EXPRESS, IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. TO THE
|
||||
* MAXIMUM EXTENT PERMITTED UNDER LAW, IN NO EVENT SHALL RENESAS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE, EVEN IF RENESAS HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGES. USE OF THIS SOFTWARE MAY BE SUBJECT TO TERMS AND CONDITIONS CONTAINED IN
|
||||
* AN ADDITIONAL AGREEMENT BETWEEN YOU AND RENESAS. IN CASE OF CONFLICT BETWEEN THE TERMS
|
||||
* OF THIS NOTICE AND ANY SUCH ADDITIONAL LICENSE AGREEMENT, THE TERMS OF THE AGREEMENT
|
||||
* SHALL TAKE PRECEDENCE. BY CONTINUING TO USE THIS SOFTWARE, YOU AGREE TO THE TERMS OF
|
||||
* THIS NOTICE.IF YOU DO NOT AGREE TO THESE TERMS, YOU ARE NOT PERMITTED TO USE THIS
|
||||
* SOFTWARE.
|
||||
*
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef _USER_CUSTS_CONFIG_H_
|
||||
#define _USER_CUSTS_CONFIG_H_
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @defgroup USER_CONFIG
|
||||
* @ingroup USER
|
||||
* @brief Custom1/2 Server (CUSTS1/2) profile database initialization.
|
||||
*
|
||||
* @{
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
* INCLUDE FILES
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
#include "app_prf_types.h"
|
||||
|
||||
/*
|
||||
* GLOBAL VARIABLE DECLARATIONS
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
extern const struct cust_prf_func_callbacks cust_prf_funcs[];
|
||||
|
||||
/// @} USER_CONFIG
|
||||
|
||||
#endif // _USER_CUSTS_CONFIG_H_
|
||||
451
src/epd/epd.c
Normal file
451
src/epd/epd.c
Normal file
@@ -0,0 +1,451 @@
|
||||
|
||||
|
||||
#include "epd.h"
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
// 硬件参数
|
||||
int scr_w;
|
||||
int scr_h;
|
||||
int scr_mode;
|
||||
int line_bytes;
|
||||
int scr_padding;
|
||||
|
||||
|
||||
// 窗口参数
|
||||
int win_w;
|
||||
int win_h;
|
||||
|
||||
|
||||
// x必须是8的倍数,且x2>x1, Y2>y1
|
||||
void epd_window(int x1, int y1, int x2, int y2)
|
||||
{
|
||||
int tmp;
|
||||
|
||||
x1 = x1&~0x07;
|
||||
x2 = x2&~0x07;
|
||||
win_w = x2-x1+8;
|
||||
win_h = y2-y1+1;
|
||||
|
||||
int rmode = scr_mode&3;
|
||||
if(rmode==0 || rmode==2){
|
||||
fb_w = win_w;
|
||||
fb_h = win_h;
|
||||
}else{
|
||||
fb_w = win_h;
|
||||
fb_h = win_w;
|
||||
}
|
||||
|
||||
//printk("epd_window: win: %d x %d fb: %d x %d\n", win_w, win_h, fb_w, fb_h);
|
||||
//printk(" [%d-%d] [%d-%d]\n", x1, x2, y1, y2);
|
||||
|
||||
if(scr_mode&MIRROR_H){
|
||||
tmp = x1;
|
||||
x1 = x2;
|
||||
x2 = tmp;
|
||||
}
|
||||
if(scr_mode&MIRROR_V){
|
||||
tmp = y1;
|
||||
y1 = y2;
|
||||
y2 = tmp;
|
||||
}
|
||||
|
||||
|
||||
int xinc = (x2>x1)? 1: 0;
|
||||
int yinc = (y2>y1)? 1: 0;
|
||||
|
||||
epd_cmd2(0x0f, y1-1, (y1-1)>>8);
|
||||
epd_cmd3(0x01, y2-1, (y2-1)>>8, 0x00); // Gate Driver output control
|
||||
|
||||
epd_cmd(0x11); // data entry mode
|
||||
epd_data((yinc<<1)|xinc);
|
||||
|
||||
epd_cmd(0x44); // set Ram-X address start/end position
|
||||
epd_data(x1>>3);
|
||||
epd_data(x2>>3);
|
||||
|
||||
epd_cmd(0x45); // set Ram-Y address start/end position
|
||||
epd_data(y1&0xff);
|
||||
epd_data(y1>>8);
|
||||
epd_data(y2&0xff);
|
||||
epd_data(y2>>8);
|
||||
|
||||
epd_cmd(0x4e); // set RAM-x address
|
||||
epd_data(x1>>3);
|
||||
epd_cmd(0x4f); // set RAM-y address
|
||||
epd_data(y1&0xff);
|
||||
epd_data(y1>>8);
|
||||
|
||||
}
|
||||
|
||||
|
||||
void epd_pos(int x, int y)
|
||||
{
|
||||
epd_cmd(0x4e); // set RAM-x address to 0
|
||||
epd_data(x);
|
||||
epd_cmd(0x4f); // set RAM-y address to 249
|
||||
epd_data(y&0xff);
|
||||
epd_data(y>>8);
|
||||
}
|
||||
|
||||
u8 lut[80] = {
|
||||
// RP0 RP1 RP2 RP3 RP4 RP5 RP6
|
||||
0x80, 0x60, 0x40, 0x00, 0x00, 0x00, 0x00, // LUT0
|
||||
0x10, 0x60, 0x20, 0x00, 0x00, 0x00, 0x00, // LUT1
|
||||
0x80, 0x60, 0x40, 0x00, 0x00, 0x00, 0x00, // LUT0
|
||||
0x10, 0x60, 0x20, 0x00, 0x00, 0x00, 0x00, // LUT1
|
||||
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // LUT4
|
||||
|
||||
0x03, 0x03, 0x00, 0x00, 0x02, // Group0
|
||||
0x09, 0x09, 0x00, 0x00, 0x02, // Group1
|
||||
0x03, 0x03, 0x00, 0x00, 0x02, // Group2
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, // Group3
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, // Group4
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, // Group5
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, // Group6
|
||||
|
||||
// VGH VSH1 VSH2 VSL FR1 FR2
|
||||
0x15, 0x41, 0xa8, 0x32, 0x30, 0x0a,
|
||||
};
|
||||
|
||||
u8 lut_p[80] = {
|
||||
// RP0 RP1 RP2 RP3 RP4 RP5 RP6
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // LUT0
|
||||
0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // LUT1
|
||||
0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // LUT2
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // LUT3
|
||||
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // LUT4
|
||||
|
||||
0x0a, 0x00, 0x00, 0x00, 0x01, // Group0
|
||||
0x00, 0x00, 0x00, 0x00, 0x01, // Group1
|
||||
0x00, 0x00, 0x00, 0x00, 0x01, // Group2
|
||||
0x00, 0x00, 0x00, 0x00, 0x01, // Group3
|
||||
0x00, 0x00, 0x00, 0x00, 0x01, // Group4
|
||||
0x00, 0x00, 0x00, 0x00, 0x01, // Group5
|
||||
0x00, 0x00, 0x00, 0x00, 0x01, // Group6
|
||||
|
||||
// VGH VSH1 VSH2 VSL FR1 FR2
|
||||
0x15, 0x41, 0xa8, 0x32, 0x0a, 0x2e,
|
||||
};
|
||||
|
||||
|
||||
u8 lut_otp[80] = {
|
||||
0x96, 0x82, 0x99, 0x21, 0x51, 0x00, 0x04, // LUT0
|
||||
0x96, 0x11, 0x99, 0x21, 0xa8, 0x20, 0x80, // LUT1
|
||||
0x96, 0x8a, 0x99, 0x21, 0x91, 0x2b, 0xaf, // LUT2
|
||||
0x96, 0x8a, 0x99, 0x21, 0x91, 0x2b, 0xaf, // LUT3
|
||||
0x5a, 0x01, 0x00, 0x12, 0x60, 0x00, 0x00, // LUTC
|
||||
|
||||
0x0a, 0x01, 0x0a, 0x01, 0x02, //Group0
|
||||
0x24, 0x58, 0x3e, 0x06, 0x00, //Group1
|
||||
0x03, 0x03, 0x03, 0x03, 0x0e, //Group2
|
||||
0x01, 0x14, 0x01, 0x14, 0x04, //Group3
|
||||
0x02, 0x02, 0x0a, 0x08, 0x02, //Group4
|
||||
0x04, 0x06, 0x03, 0x26, 0x04, //Group5
|
||||
0x04, 0x04, 0x03, 0x26, 0x03, //Group6
|
||||
|
||||
// VGH VSH1 VSH2 VSL FR1 FR2
|
||||
0x11, 0x37, 0xb2, 0x2a, 0x1b, 0x07
|
||||
};
|
||||
|
||||
|
||||
void epd_load_lut(u8 *lut)
|
||||
{
|
||||
epd_cmd(0x32);
|
||||
epd_data_array(lut, 70);
|
||||
epd_cmd1(0x03, lut[70]);
|
||||
epd_cmd3(0x04, lut[71], lut[72], lut[73]);
|
||||
//epd_cmd1(0x3a, lut[74]);
|
||||
//epd_cmd1(0x3b, lut[75]);
|
||||
}
|
||||
|
||||
|
||||
void epd_dump_lut(void)
|
||||
{
|
||||
u8 lut[256];
|
||||
int i, j;
|
||||
|
||||
epd_cmd_read(0x33, lut, 256);
|
||||
|
||||
for(i=0; i<5; i++){
|
||||
printk("\t");
|
||||
for(j=0; j<7; j++){
|
||||
printk("0x%02x, ", lut[i*7+j]);
|
||||
}
|
||||
printk(" // LUT%d\n", i);
|
||||
}
|
||||
|
||||
for(i=0; i<7; i++){
|
||||
printk("\t");
|
||||
for(j=0; j<5; j++){
|
||||
printk("0x%02x, ", lut[35+i*5+j]);
|
||||
}
|
||||
printk(" // Group%d\n", i);
|
||||
}
|
||||
|
||||
printk("\t");
|
||||
for(i=0; i<7; i++){
|
||||
printk("0x%02x, ", lut[70+i]);
|
||||
}
|
||||
printk("\n\n");
|
||||
|
||||
//hex_dump("LUT", lut, 256);
|
||||
}
|
||||
|
||||
|
||||
int epd_lut_size(void)
|
||||
{
|
||||
u8 lut[256];
|
||||
int i;
|
||||
|
||||
memset(lut, 0xa5, 256);
|
||||
epd_cmd(0x32);
|
||||
epd_data_array(lut, 256);
|
||||
|
||||
memset(lut, 0x00, 256);
|
||||
epd_cmd_read(0x33, lut, 256);
|
||||
|
||||
for(i=0; i<256; i++){
|
||||
if(lut[i]!=0xa5)
|
||||
break;
|
||||
}
|
||||
printk("LUT size: %d\n", i);
|
||||
//hex_dump("LUT", lut, 256);
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
void epd_init(int w, int h, int mode)
|
||||
{
|
||||
epd_hw_open();
|
||||
|
||||
scr_w = w;
|
||||
scr_h = h;
|
||||
scr_mode = mode;
|
||||
line_bytes = (scr_w+7)>>3;
|
||||
scr_padding = line_bytes*8-scr_w;
|
||||
printk("epd_init: scr: %d x %d\n", scr_w, scr_h);
|
||||
|
||||
epd_power(1);
|
||||
epd_reset();
|
||||
|
||||
epd_wait();
|
||||
epd_cmd(0x12); // SWRESET
|
||||
delay_ms(10);
|
||||
epd_wait();
|
||||
|
||||
//epd_lut_size();
|
||||
|
||||
epd_cmd1(0x74, 0x54);
|
||||
epd_cmd1(0x7e, 0x3b);
|
||||
|
||||
epd_cmd2(0x2b, 0x04, 0x63);
|
||||
epd_cmd4(0x0c, 0x8b, 0x9c, 0x96, 0x0f);
|
||||
|
||||
epd_cmd3(0x01, scr_h-1, (scr_h-1)>>8, 0x00); // Gate Driver output control
|
||||
epd_cmd1(0x11, 0x03); // data entry mode
|
||||
epd_cmd1(0x3c, 0x05); // border wavefrom
|
||||
|
||||
epd_window(0, 0, scr_w-1, scr_h-1);
|
||||
|
||||
epd_cmd1(0x18, 0x80); // Read Built-in temperature sensor
|
||||
#if 0
|
||||
|
||||
epd_cmd1(0x18, 0x80); // Read Built-in temperature sensor
|
||||
|
||||
epd_cmd1(0x22, 0xb1);
|
||||
epd_cmd(0x20);
|
||||
epd_wait();
|
||||
epd_dump_lut();
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void epd_update(int mode)
|
||||
{
|
||||
int seq;
|
||||
|
||||
if(mode==0){
|
||||
seq = 0xf7;
|
||||
}else{
|
||||
seq = mode;
|
||||
}
|
||||
|
||||
epd_cmd1(0x22, seq);
|
||||
epd_cmd(0x20);
|
||||
epd_wait();
|
||||
// epd_dump_lut();
|
||||
}
|
||||
|
||||
void epd_update_lut(u8 *lut)
|
||||
{
|
||||
epd_load_lut(lut);
|
||||
epd_cmd1(0x22, 0xc4);
|
||||
epd_cmd(0x20);
|
||||
epd_wait();
|
||||
}
|
||||
|
||||
|
||||
void epd_sleep(void)
|
||||
{
|
||||
epd_cmd1(0x10, 01);
|
||||
delay_ms(10);
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
void epd_screen_update(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
epd_cmd(0x24); // write RAM for black(0)/white(1)
|
||||
for(i=0; i<win_h*line_bytes; i++){
|
||||
epd_data(fb_bw[i]);
|
||||
}
|
||||
if(scr_mode&EPD_BWR){
|
||||
epd_cmd(0x26);
|
||||
for(i=0; i<win_h*line_bytes; i++){
|
||||
//epd_data(fb_rr[i]);
|
||||
epd_data(fb_bw[i]^0xff);
|
||||
//epd_data(0xff);
|
||||
}
|
||||
//memcpy(fb_rr, fb_bw, win_h*line_bytes);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void epd_screen_clean(int mode)
|
||||
{
|
||||
int x, y;
|
||||
|
||||
epd_cmd(0x24); // write RAM for black(0)/white(1)
|
||||
for(y=0; y<win_h; y++){
|
||||
for(x=0; x<win_w; x+=8){
|
||||
int d;
|
||||
if(mode==2){
|
||||
if(y<(win_h/2)){
|
||||
d = (x<win_w/2)? 0x77 : 0x00;
|
||||
}else{
|
||||
d = (x<win_w/2)? 0x00 : 0xff;
|
||||
}
|
||||
}else if(mode==1){
|
||||
d = 0xff;
|
||||
}else{
|
||||
d = 0x00;
|
||||
}
|
||||
epd_data(d);
|
||||
}
|
||||
}
|
||||
|
||||
if(scr_mode&EPD_BWR){
|
||||
epd_cmd(0x26); // write RAM for red(1)/other(0)
|
||||
for(y=0; y<win_h; y++){
|
||||
for(x=0; x<win_w; x+=8){
|
||||
int d = 0x00;
|
||||
if(mode==2){
|
||||
if(y<(win_h/2)){
|
||||
d = 0x00;
|
||||
}else{
|
||||
d = (x<win_w/2)? 0xff : 0x00;
|
||||
}
|
||||
}
|
||||
epd_data(d);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
#if 0
|
||||
|
||||
void epd_test(void)
|
||||
{
|
||||
// epd_hw_init(0x23200700, 0x05210006); // for 2.13 board BW
|
||||
|
||||
// epd_hw_init(0x23111000, 0x07210120); // for 2.13 board BWR
|
||||
// epd_init(104, 212, ROTATE_3);
|
||||
epd_init(104, 212, EPD_BWR|ROTATE_3);
|
||||
|
||||
// epd_hw_init(0x23111000, 0x07210120); // for 2.13 board BWR
|
||||
// epd_init(122, 250, EPD_BWR|ROTATE_3);
|
||||
|
||||
// epd_hw_init(0x23200700, 0x05210006); // for 2.90 board
|
||||
// epd_init(128, 296, EPD_BWR|ROTATE_3);
|
||||
|
||||
#if 0
|
||||
epd_screen_clean(2);
|
||||
#else
|
||||
fb_test();
|
||||
#endif
|
||||
//epd_load_lut(lut);
|
||||
//epd_cmd1(0x2c, 0x08);
|
||||
//epd_update(0xc7);
|
||||
epd_update(0xf4);
|
||||
|
||||
#if 0
|
||||
epd_window(32, 16, 96, 80);
|
||||
epd_screen_clean(1);
|
||||
epd_update_lut(lut);
|
||||
//epd_update(0);
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
epd_load_lut(lut_p);
|
||||
epd_cmd1(0x2c, 0x55);
|
||||
|
||||
#if 0
|
||||
epd_cmd(0x37);
|
||||
epd_data(0x00);
|
||||
epd_data(0x00);
|
||||
epd_data(0x00);
|
||||
epd_data(0x00);
|
||||
epd_data(0x40);
|
||||
epd_data(0x00);
|
||||
epd_data(0x00);
|
||||
#endif
|
||||
|
||||
epd_update(0xc0);
|
||||
|
||||
for(int i=0; i<10; i++)
|
||||
{
|
||||
delay_ms(3000);
|
||||
fb_test();
|
||||
epd_update(0x04);
|
||||
//epd_update(0xf7);
|
||||
//scr_mode += 1;
|
||||
//scr_mode &= 0xf3;
|
||||
}
|
||||
#endif
|
||||
|
||||
delay_ms(1000);
|
||||
printk("\nepd_test done.\n");
|
||||
epd_cmd1(0x10, 0x03);
|
||||
epd_power(0);
|
||||
epd_hw_close();
|
||||
//epd_update(0x03);
|
||||
}
|
||||
|
||||
void epd_test2(void)
|
||||
{
|
||||
|
||||
epd_init(104, 212, EPD_BWR|ROTATE_3);
|
||||
|
||||
epd_load_lut(lut);
|
||||
// epd_load_lut(lut_p);
|
||||
epd_cmd1(0x2c, 0x55);
|
||||
epd_update(0xc0);
|
||||
|
||||
fb_test();
|
||||
epd_update(0x04);
|
||||
|
||||
epd_cmd1(0x10, 0x03);
|
||||
epd_power(0);
|
||||
}
|
||||
#endif
|
||||
98
src/epd/epd.h
Normal file
98
src/epd/epd.h
Normal file
@@ -0,0 +1,98 @@
|
||||
|
||||
|
||||
#include "user_config.h"
|
||||
|
||||
|
||||
typedef unsigned char u8;
|
||||
typedef unsigned short u16;
|
||||
typedef unsigned int u32;
|
||||
|
||||
|
||||
void delay_ms(int ms);
|
||||
|
||||
// GPIO
|
||||
void gpio_config(int index, int mode, int value);
|
||||
void gpio_set(int index, int value);
|
||||
int gpio_get(int index);
|
||||
|
||||
|
||||
// spi flash
|
||||
int fspi_init(u32 gpio_word);
|
||||
int epcs_readid(void);
|
||||
int epcs_sector_erase(int addr);
|
||||
int epcs_page_write(int addr, u8 *buf, int size);
|
||||
int epcs_read(int addr, int len, u8 *buf);
|
||||
|
||||
// epd_hw
|
||||
void epd_hw_init(u32 config0, u32 config1);
|
||||
void epd_hw_open(void);
|
||||
void epd_hw_close(void);
|
||||
void epd_reset(void);
|
||||
void epd_wait(void);
|
||||
void epd_power(int on);
|
||||
|
||||
void epd_cmd(int cmd);
|
||||
void epd_cmd1(int cmd, int d0);
|
||||
void epd_cmd2(int cmd, int d0, int d1);
|
||||
void epd_cmd3(int cmd, int d0, int d1, int d2);
|
||||
void epd_cmd4(int cmd, int d0, int d1, int d2, int d3);
|
||||
void epd_data(int data);
|
||||
void epd_data_array(u8 *data, int len);
|
||||
void epd_read(u8 *data, int len);
|
||||
void epd_cmd_read(int cmd, u8 *data, int len);
|
||||
|
||||
// epd_xxx
|
||||
|
||||
void epd_init(int x, int y, int mode);
|
||||
void epd_load_lut(u8 *lut);
|
||||
void epd_update(int mode);
|
||||
void epd_sleep(void);
|
||||
void epd_window(int x1, int y1, int x2, int y2);
|
||||
void epd_screen_update(void);
|
||||
void epd_screen_clean(int mode);
|
||||
|
||||
|
||||
extern u8 lut_p[];
|
||||
|
||||
|
||||
// epd_gui
|
||||
void draw_pixel(int x, int y, int color);
|
||||
void draw_hline(int y, int x1, int x2, int color);
|
||||
void draw_vline(int x, int y1, int y2, int color);
|
||||
void draw_rect(int x1, int y1, int x2, int y2, int color);
|
||||
void draw_box(int x1, int y1, int x2, int y2, int color);
|
||||
void draw_char(int x, int y, int ch, int color);
|
||||
void draw_text(int x, int y, char *str, int color);
|
||||
int select_font(int id);
|
||||
void fb_test(void);
|
||||
|
||||
|
||||
#define EPD_BWR 0x20
|
||||
#define MIRROR_H 0x40
|
||||
#define MIRROR_V 0x80
|
||||
#define ROTATE_0 0x00 // 0
|
||||
#define ROTATE_1 0x01 // 90
|
||||
#define ROTATE_2 0x02 // 180
|
||||
#define ROTATE_3 0x03 // 270
|
||||
|
||||
#define BLACK 0
|
||||
#define WHITE 1
|
||||
#define RED 2
|
||||
|
||||
|
||||
extern int scr_w;
|
||||
extern int scr_h;
|
||||
extern int scr_mode;
|
||||
extern int line_bytes;
|
||||
extern int scr_padding;
|
||||
|
||||
extern int win_w;
|
||||
extern int win_h;
|
||||
|
||||
extern int fb_w;
|
||||
extern int fb_h;
|
||||
|
||||
extern u8 fb_bw[];
|
||||
extern u8 fb_rr[];
|
||||
|
||||
|
||||
268
src/epd/epd_gui.c
Normal file
268
src/epd/epd_gui.c
Normal file
@@ -0,0 +1,268 @@
|
||||
|
||||
|
||||
#include "epd.h"
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
|
||||
// FB参数
|
||||
int fb_w;
|
||||
int fb_h;
|
||||
|
||||
#define FB_SIZE 4096
|
||||
u8 fb_bw[FB_SIZE];
|
||||
u8 fb_rr[FB_SIZE];
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
|
||||
void draw_pixel(int x, int y, int color)
|
||||
{
|
||||
int nx, ny;
|
||||
int rmode = scr_mode&0x03;
|
||||
|
||||
if(rmode==0){
|
||||
nx = x;
|
||||
ny = y;
|
||||
}else if(rmode==1){
|
||||
nx = scr_w-1-y;
|
||||
ny = x;
|
||||
}else if(rmode==2){
|
||||
nx = scr_w-1-x;
|
||||
ny = scr_h-1-y;
|
||||
}else if(rmode==3){
|
||||
nx = y;
|
||||
ny = scr_h-1-x;
|
||||
}
|
||||
if(scr_mode&MIRROR_H){
|
||||
nx += scr_padding;
|
||||
}
|
||||
|
||||
int byte_pos = ny*line_bytes+(nx>>3);
|
||||
int bit_mask = 0x80>>(nx&7);
|
||||
|
||||
if(color==RED){
|
||||
fb_rr[byte_pos] |= bit_mask;
|
||||
fb_bw[byte_pos] |= bit_mask;
|
||||
}else{
|
||||
fb_rr[byte_pos] &= ~bit_mask;
|
||||
if(color==WHITE){
|
||||
fb_bw[byte_pos] |= bit_mask;
|
||||
}else{
|
||||
fb_bw[byte_pos] &= ~bit_mask;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void draw_hline(int y, int x1, int x2, int color)
|
||||
{
|
||||
int x;
|
||||
if(x1>x2){
|
||||
x = x1;
|
||||
x1 = x2;
|
||||
x2 = x;
|
||||
}
|
||||
|
||||
for(x=x1; x<=x2; x+=1){
|
||||
draw_pixel(x, y, color);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void draw_vline(int x, int y1, int y2, int color)
|
||||
{
|
||||
int y;
|
||||
if(y1>y2){
|
||||
x = y1;
|
||||
y1 = y2;
|
||||
y2 = x;
|
||||
}
|
||||
|
||||
for(y=y1; y<=y2; y+=1){
|
||||
draw_pixel(x, y, color);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void draw_rect(int x1, int y1, int x2, int y2, int color)
|
||||
{
|
||||
draw_hline(y1, x1, x2, color);
|
||||
draw_hline(y2, x1, x2, color);
|
||||
draw_vline(x1, y1, y2, color);
|
||||
draw_vline(x2, y1, y2, color);
|
||||
}
|
||||
|
||||
|
||||
void draw_box(int x1, int y1, int x2, int y2, int color)
|
||||
{
|
||||
int y;
|
||||
|
||||
for(y=y1; y<=y2; y++){
|
||||
draw_hline(y, x1, x2, color);
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
|
||||
#include "sfont.h"
|
||||
#include "font56.h"
|
||||
|
||||
u8 *current_font = (u8*)sfont;
|
||||
|
||||
int select_font(int id)
|
||||
{
|
||||
if(id==0)
|
||||
current_font = (u8*)sfont;
|
||||
else
|
||||
current_font = (u8*)F_DSEG7_56;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static u8 *find_font(u8 *font, int ucs)
|
||||
{
|
||||
int total = *(u16*)font;
|
||||
int i;
|
||||
|
||||
for(i=0; i<total; i++){
|
||||
if(*(u16*)(font+2+i*4+0)==ucs){
|
||||
int offset = *(u16*)(font+2+i*4+2);
|
||||
//printk(" %04x at %04x\n", ucs, offset);
|
||||
return font+offset;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
int fb_draw_font(int x, int y, int ucs, int color)
|
||||
{
|
||||
int r, c;
|
||||
u8 *font_data = find_font(current_font, ucs);
|
||||
if(font_data==NULL){
|
||||
printk("fb_draw %04x: not found!\n");
|
||||
}
|
||||
|
||||
int ft_adv = font_data[0];
|
||||
int ft_bw = font_data[1];
|
||||
int ft_bh = font_data[2];
|
||||
int ft_bx = (signed char)font_data[3];
|
||||
int ft_by = (signed char)font_data[4];
|
||||
int ft_lsize = (ft_bw+7)/8;
|
||||
font_data += 5;
|
||||
|
||||
x += ft_bx;
|
||||
y += ft_by;
|
||||
|
||||
for (r=0; r<ft_bh; r++) {
|
||||
for (c=0; c<ft_bw; c++) {
|
||||
int b = font_data[c>>3];
|
||||
int mask = 0x80>>(c%8);
|
||||
if(b&mask){
|
||||
draw_pixel(x+c, y, color);
|
||||
}
|
||||
mask >>= 1;
|
||||
}
|
||||
font_data += ft_lsize;
|
||||
y += 1;
|
||||
}
|
||||
|
||||
return ft_adv;
|
||||
}
|
||||
|
||||
|
||||
static int utf8_to_ucs(char **ustr)
|
||||
{
|
||||
u8 *str = (u8*)*ustr;
|
||||
int ucs = 0;
|
||||
|
||||
if(*str==0){
|
||||
return 0;
|
||||
}else if(*str<0x80){
|
||||
*ustr = (char*)str+1;
|
||||
return *str;
|
||||
}else if(*str<0xe0){
|
||||
ucs = ((str[0]&0x1f)<<6) | (str[1]&0x3f);
|
||||
*ustr = (char*)str+2;
|
||||
return ucs;
|
||||
}else{
|
||||
ucs = ((str[0]&0x0f)<<12) | ((str[1]&0x3f)<<6) | (str[2]&0x3f);
|
||||
*ustr = (char*)str+3;
|
||||
return ucs;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void draw_text(int x, int y, char *str, int color)
|
||||
{
|
||||
int ch;
|
||||
|
||||
while(1){
|
||||
ch = utf8_to_ucs(&str);
|
||||
if(ch==0)
|
||||
break;
|
||||
x += fb_draw_font(x, y, ch, color);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
#if 0
|
||||
char *wday_str[] = {
|
||||
"一",
|
||||
"二",
|
||||
"三",
|
||||
"四",
|
||||
"五",
|
||||
"六",
|
||||
"日",
|
||||
};
|
||||
|
||||
static int wday = 0;
|
||||
void fb_test(void)
|
||||
{
|
||||
memset(fb_bw, 0xff, scr_h*line_bytes);
|
||||
memset(fb_rr, 0x00, scr_h*line_bytes);
|
||||
|
||||
draw_rect(0, 0, fb_w-1, fb_h-1, BLACK);
|
||||
draw_rect(1, 1, fb_w-2, fb_h-2, BLACK);
|
||||
|
||||
#if 0
|
||||
for(int i=0; i<3; i++){
|
||||
int x = 8+i*38;
|
||||
int y = 30;
|
||||
draw_rect(x, y, x+29, y+29, BLACK);
|
||||
//draw_rect(x+1, y+1, x+29-1, y+29-1, BLACK);
|
||||
draw_box(x+2, y+2, x+29-2, y+29-2, i);
|
||||
}
|
||||
#endif
|
||||
|
||||
select_font(0);
|
||||
|
||||
char tbuf[64];
|
||||
// sprintf(tbuf, "%4d年%2d月%2d日 星期%s", 2025, 4, 29, wday_str[wday]);
|
||||
sprintf(tbuf, "2025年 4月29日 星期%s", wday_str[wday]);
|
||||
printk("tbuf: %s\n", tbuf);
|
||||
draw_text(15, 85, tbuf, BLACK);
|
||||
|
||||
wday += 1;
|
||||
if(wday==7)
|
||||
wday = 0;
|
||||
|
||||
select_font(1);
|
||||
draw_text(12, 20, "02:34", BLACK);
|
||||
|
||||
epd_screen_update();
|
||||
}
|
||||
#endif
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
|
||||
|
||||
270
src/epd/epd_hw.c
Normal file
270
src/epd/epd_hw.c
Normal file
@@ -0,0 +1,270 @@
|
||||
|
||||
|
||||
#include "epd.h"
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
static int epio_pwr;
|
||||
static int epio_busy;
|
||||
static int epio_rst;
|
||||
static int epio_dc;
|
||||
static int epio_cs;
|
||||
static int epio_clk;
|
||||
static int epio_sdi;
|
||||
|
||||
|
||||
#define EPD_CLK(n) gpio_set(epio_clk, (n))
|
||||
#define EPD_SDI(n) gpio_set(epio_sdi, (n))
|
||||
#define EPD_CS(n) gpio_set(epio_cs , (n))
|
||||
#define EPD_DC(n) gpio_set(epio_dc , (n))
|
||||
#define EPD_RST(n) gpio_set(epio_rst, (n))
|
||||
#define EPD_PWR(n) gpio_set(epio_pwr, (n))
|
||||
#define EPD_BUSY() gpio_get(epio_busy)
|
||||
|
||||
#define EPD_DIN() gpio_config(epio_sdi, 0x0100, 0)
|
||||
#define EPD_DOUT() gpio_config(epio_sdi, 0x0300, 0)
|
||||
#define EPD_SDO() gpio_get(epio_sdi)
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
void gpio_config(int index, int mode, int value)
|
||||
{
|
||||
int group = index>>4;
|
||||
index &= 0x0f;
|
||||
|
||||
GPIO_ConfigurePin(group, index, mode, PID_GPIO, value);
|
||||
}
|
||||
|
||||
void gpio_set(int index, int value)
|
||||
{
|
||||
int group = index>>4;
|
||||
index &= 0x0f;
|
||||
|
||||
if(value){
|
||||
GPIO_SetActive(group, index);
|
||||
}else{
|
||||
GPIO_SetInactive(group, index);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int gpio_get(int index)
|
||||
{
|
||||
int group = index>>4;
|
||||
index &= 0x0f;
|
||||
return GPIO_GetPinStatus(group, index)? 1: 0;
|
||||
}
|
||||
|
||||
|
||||
void delay_ms(int ms)
|
||||
{
|
||||
ms *= 1800;
|
||||
while(ms){
|
||||
__asm("nop");
|
||||
ms -= 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
|
||||
void epd_hw_init(u32 config0, u32 config1)
|
||||
{
|
||||
epio_pwr = (config0>>24)&0xff;
|
||||
epio_busy = (config0>>16)&0xff;
|
||||
epio_rst = (config0>> 8)&0xff;
|
||||
epio_dc = (config1>>24)&0xff;
|
||||
epio_cs = (config1>>16)&0xff;
|
||||
epio_clk = (config1>> 8)&0xff;
|
||||
epio_sdi = (config1>> 0)&0xff;
|
||||
}
|
||||
|
||||
void epd_hw_open(void)
|
||||
{
|
||||
gpio_config(epio_pwr , 0x0300, 0);
|
||||
gpio_config(epio_busy, 0x0000, 1);
|
||||
gpio_config(epio_rst , 0x0300, 0);
|
||||
gpio_config(epio_dc , 0x0300, 0);
|
||||
gpio_config(epio_cs , 0x0300, 1);
|
||||
gpio_config(epio_clk , 0x0300, 0);
|
||||
gpio_config(epio_sdi , 0x0300, 0);
|
||||
}
|
||||
|
||||
void epd_hw_close(void)
|
||||
{
|
||||
gpio_config(epio_pwr , 0x0300, 0);
|
||||
gpio_config(epio_busy, 0x0000, 0);
|
||||
gpio_config(epio_rst , 0x0300, 0);
|
||||
gpio_config(epio_dc , 0x0300, 0);
|
||||
gpio_config(epio_cs , 0x0300, 0);
|
||||
gpio_config(epio_clk , 0x0300, 0);
|
||||
gpio_config(epio_sdi , 0x0300, 0);
|
||||
}
|
||||
|
||||
static void epd_spi_write(int value)
|
||||
{
|
||||
int i;
|
||||
|
||||
for(i=0; i<8; i++){
|
||||
EPD_CLK(0);
|
||||
EPD_SDI(value&0x80);
|
||||
EPD_CLK(1);
|
||||
value <<= 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int epd_spi_read(void)
|
||||
{
|
||||
int i, value=0;
|
||||
|
||||
for(i=0; i<8; i++){
|
||||
EPD_CLK(0);
|
||||
value <<= 1;
|
||||
EPD_CLK(1);
|
||||
value |= EPD_SDO();
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
void epd_reset(void)
|
||||
{
|
||||
EPD_RST(0);
|
||||
delay_ms(20);
|
||||
EPD_RST(1);
|
||||
delay_ms(20);
|
||||
}
|
||||
|
||||
|
||||
void epd_wait(void)
|
||||
{
|
||||
while(EPD_BUSY());
|
||||
}
|
||||
|
||||
|
||||
void epd_power(int on)
|
||||
{
|
||||
EPD_PWR(on);
|
||||
}
|
||||
|
||||
|
||||
void epd_cmd(int cmd)
|
||||
{
|
||||
EPD_CS(0);
|
||||
EPD_DC(0);
|
||||
epd_spi_write(cmd);
|
||||
EPD_CS(1);
|
||||
}
|
||||
|
||||
|
||||
void epd_data(int data)
|
||||
{
|
||||
EPD_CS(0);
|
||||
EPD_DC(1);
|
||||
epd_spi_write(data);
|
||||
EPD_CS(1);
|
||||
}
|
||||
|
||||
|
||||
void epd_cmd1(int cmd, int d0)
|
||||
{
|
||||
EPD_CS(0);
|
||||
EPD_DC(0);
|
||||
epd_spi_write(cmd);
|
||||
EPD_DC(1);
|
||||
epd_spi_write(d0);
|
||||
EPD_CS(0);
|
||||
}
|
||||
|
||||
|
||||
void epd_cmd2(int cmd, int d0, int d1)
|
||||
{
|
||||
EPD_CS(0);
|
||||
EPD_DC(0);
|
||||
epd_spi_write(cmd);
|
||||
EPD_DC(1);
|
||||
epd_spi_write(d0);
|
||||
epd_spi_write(d1);
|
||||
EPD_CS(0);
|
||||
}
|
||||
|
||||
|
||||
void epd_cmd3(int cmd, int d0, int d1, int d2)
|
||||
{
|
||||
EPD_CS(0);
|
||||
EPD_DC(0);
|
||||
epd_spi_write(cmd);
|
||||
EPD_DC(1);
|
||||
epd_spi_write(d0);
|
||||
epd_spi_write(d1);
|
||||
epd_spi_write(d2);
|
||||
EPD_CS(0);
|
||||
}
|
||||
|
||||
|
||||
void epd_cmd4(int cmd, int d0, int d1, int d2, int d3)
|
||||
{
|
||||
EPD_CS(0);
|
||||
EPD_DC(0);
|
||||
epd_spi_write(cmd);
|
||||
EPD_DC(1);
|
||||
epd_spi_write(d0);
|
||||
epd_spi_write(d1);
|
||||
epd_spi_write(d2);
|
||||
epd_spi_write(d3);
|
||||
EPD_CS(0);
|
||||
}
|
||||
|
||||
|
||||
void epd_data_array(u8 *data, int len)
|
||||
{
|
||||
EPD_CS(0);
|
||||
EPD_DC(1);
|
||||
for(int i=0; i<len; i++){
|
||||
epd_spi_write(data[i]);
|
||||
}
|
||||
EPD_CS(1);
|
||||
}
|
||||
|
||||
|
||||
void epd_read(u8 *data, int len)
|
||||
{
|
||||
EPD_DIN();
|
||||
|
||||
EPD_CS(0);
|
||||
EPD_DC(1);
|
||||
|
||||
for(int i=0; i<len; i++){
|
||||
data[i] = epd_spi_read();
|
||||
}
|
||||
EPD_CS(1);
|
||||
|
||||
EPD_DOUT();
|
||||
}
|
||||
|
||||
|
||||
void epd_cmd_read(int cmd, u8 *data, int len)
|
||||
{
|
||||
EPD_CS(0);
|
||||
EPD_DC(0);
|
||||
epd_spi_write(cmd);
|
||||
|
||||
EPD_DC(1);
|
||||
EPD_DIN();
|
||||
|
||||
for(int i=0; i<len; i++){
|
||||
data[i] = epd_spi_read();
|
||||
}
|
||||
|
||||
EPD_DOUT();
|
||||
EPD_CS(1);
|
||||
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
169
src/epd/font56.h
Normal file
169
src/epd/font56.h
Normal file
@@ -0,0 +1,169 @@
|
||||
#ifndef __F_DSEG7_56__
|
||||
#define __F_DSEG7_56__
|
||||
|
||||
#define F_DSEG7_56_size 2567
|
||||
static unsigned char F_DSEG7_56[] = {
|
||||
0x0b, 0x00, 0x30, 0x00, 0x2e, 0x00, 0x31, 0x00, 0x46, 0x01, 0x32, 0x00, 0x7e, 0x01, 0x33, 0x00,
|
||||
0x96, 0x02, 0x34, 0x00, 0x77, 0x03, 0x35, 0x00, 0x7b, 0x04, 0x36, 0x00, 0x93, 0x05, 0x37, 0x00,
|
||||
0xab, 0x06, 0x38, 0x00, 0xb4, 0x07, 0x39, 0x00, 0xcc, 0x08, 0x3a, 0x00, 0xe4, 0x09, 0x2c, 0x22,
|
||||
0x37, 0x05, 0x01, 0x0f, 0xff, 0xff, 0xfc, 0x00, 0x1f, 0xff, 0xff, 0xfe, 0x00, 0x1f, 0xff, 0xff,
|
||||
0xfe, 0x00, 0x6f, 0xff, 0xff, 0xfd, 0x80, 0xf7, 0xff, 0xff, 0xfb, 0xc0, 0xf8, 0x00, 0x00, 0x07,
|
||||
0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0,
|
||||
0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8,
|
||||
0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00,
|
||||
0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00,
|
||||
0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07,
|
||||
0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf0, 0x00, 0x00, 0x03, 0xc0,
|
||||
0xe0, 0x00, 0x00, 0x01, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0,
|
||||
0x00, 0x00, 0x00, 0xc0, 0xe0, 0x00, 0x00, 0x01, 0xc0, 0xf0, 0x00, 0x00, 0x03, 0xc0, 0xf8, 0x00,
|
||||
0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00,
|
||||
0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07,
|
||||
0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0,
|
||||
0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8,
|
||||
0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00,
|
||||
0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf7, 0xff, 0xff,
|
||||
0xfb, 0xc0, 0x6f, 0xff, 0xff, 0xfd, 0x80, 0x1f, 0xff, 0xff, 0xfe, 0x00, 0x1f, 0xff, 0xff, 0xfe,
|
||||
0x00, 0x0f, 0xff, 0xff, 0xfc, 0x00, 0x2c, 0x05, 0x33, 0x22, 0x02, 0x10, 0x38, 0x78, 0xf8, 0xf8,
|
||||
0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8,
|
||||
0xf8, 0x78, 0x38, 0x18, 0x00, 0x18, 0x38, 0x78, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8,
|
||||
0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0xf8, 0x78, 0x38, 0x10, 0x2c, 0x22,
|
||||
0x37, 0x05, 0x01, 0x0f, 0xff, 0xff, 0xfc, 0x00, 0x1f, 0xff, 0xff, 0xfe, 0x00, 0x1f, 0xff, 0xff,
|
||||
0xfe, 0x00, 0x0f, 0xff, 0xff, 0xfd, 0x80, 0x07, 0xff, 0xff, 0xfb, 0xc0, 0x00, 0x00, 0x00, 0x07,
|
||||
0xc0, 0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x07, 0xc0,
|
||||
0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x07, 0xc0, 0x00,
|
||||
0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00,
|
||||
0x00, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00,
|
||||
0x07, 0xc0, 0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x07,
|
||||
0xc0, 0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x03, 0xc0,
|
||||
0x0f, 0xff, 0xff, 0xfd, 0xc0, 0x1f, 0xff, 0xff, 0xfc, 0xc0, 0x3f, 0xff, 0xff, 0xfe, 0x00, 0xdf,
|
||||
0xff, 0xff, 0xfe, 0x00, 0xef, 0xff, 0xff, 0xfc, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00,
|
||||
0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00,
|
||||
0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00,
|
||||
0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00,
|
||||
0xf8, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0xf8,
|
||||
0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00,
|
||||
0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0xf7, 0xff, 0xff,
|
||||
0xf8, 0x00, 0x6f, 0xff, 0xff, 0xfc, 0x00, 0x1f, 0xff, 0xff, 0xfe, 0x00, 0x1f, 0xff, 0xff, 0xfe,
|
||||
0x00, 0x0f, 0xff, 0xff, 0xfc, 0x00, 0x2c, 0x20, 0x37, 0x07, 0x01, 0x7f, 0xff, 0xff, 0xf8, 0xff,
|
||||
0xff, 0xff, 0xfc, 0x7f, 0xff, 0xff, 0xfa, 0x3f, 0xff, 0xff, 0xf6, 0x1f, 0xff, 0xff, 0xef, 0x00,
|
||||
0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x1f, 0x00,
|
||||
0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x1f, 0x00,
|
||||
0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x1f, 0x00,
|
||||
0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x1f, 0x00,
|
||||
0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x0f, 0x3f,
|
||||
0xff, 0xff, 0xf7, 0x7f, 0xff, 0xff, 0xfb, 0xff, 0xff, 0xff, 0xfc, 0x7f, 0xff, 0xff, 0xfb, 0x3f,
|
||||
0xff, 0xff, 0xf7, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x1f, 0x00,
|
||||
0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x1f, 0x00,
|
||||
0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x1f, 0x00,
|
||||
0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x1f, 0x00,
|
||||
0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x1f, 0x00,
|
||||
0x00, 0x00, 0x1f, 0x1f, 0xff, 0xff, 0xef, 0x3f, 0xff, 0xff, 0xf6, 0x7f, 0xff, 0xff, 0xf8, 0x7f,
|
||||
0xff, 0xff, 0xf8, 0x3f, 0xff, 0xff, 0xf0, 0x2c, 0x22, 0x33, 0x05, 0x02, 0x40, 0x00, 0x00, 0x00,
|
||||
0x80, 0xe0, 0x00, 0x00, 0x01, 0xc0, 0xf0, 0x00, 0x00, 0x03, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0,
|
||||
0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8,
|
||||
0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00,
|
||||
0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00,
|
||||
0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07,
|
||||
0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0,
|
||||
0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf0, 0x00, 0x00, 0x03, 0xc0, 0xef,
|
||||
0xff, 0xff, 0xfd, 0xc0, 0xdf, 0xff, 0xff, 0xfc, 0xc0, 0x3f, 0xff, 0xff, 0xfe, 0x00, 0x1f, 0xff,
|
||||
0xff, 0xfe, 0xc0, 0x0f, 0xff, 0xff, 0xfd, 0xc0, 0x00, 0x00, 0x00, 0x03, 0xc0, 0x00, 0x00, 0x00,
|
||||
0x07, 0xc0, 0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x07,
|
||||
0xc0, 0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x07, 0xc0,
|
||||
0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x07, 0xc0, 0x00,
|
||||
0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00,
|
||||
0x00, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00,
|
||||
0x07, 0xc0, 0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x03,
|
||||
0xc0, 0x00, 0x00, 0x00, 0x01, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x80, 0x2c, 0x22, 0x37, 0x05, 0x01,
|
||||
0x0f, 0xff, 0xff, 0xfc, 0x00, 0x1f, 0xff, 0xff, 0xfe, 0x00, 0x1f, 0xff, 0xff, 0xfe, 0x00, 0x6f,
|
||||
0xff, 0xff, 0xfc, 0x00, 0xf7, 0xff, 0xff, 0xf8, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00,
|
||||
0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00,
|
||||
0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00,
|
||||
0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00,
|
||||
0xf8, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0xf8,
|
||||
0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00,
|
||||
0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x00, 0xef, 0xff, 0xff,
|
||||
0xfc, 0x00, 0xdf, 0xff, 0xff, 0xfc, 0x00, 0x3f, 0xff, 0xff, 0xfe, 0x00, 0x1f, 0xff, 0xff, 0xfe,
|
||||
0xc0, 0x0f, 0xff, 0xff, 0xfd, 0xc0, 0x00, 0x00, 0x00, 0x03, 0xc0, 0x00, 0x00, 0x00, 0x07, 0xc0,
|
||||
0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x07, 0xc0, 0x00,
|
||||
0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00,
|
||||
0x00, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00,
|
||||
0x07, 0xc0, 0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x07,
|
||||
0xc0, 0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x07, 0xc0,
|
||||
0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x07, 0xc0, 0x07, 0xff, 0xff, 0xfb, 0xc0, 0x0f,
|
||||
0xff, 0xff, 0xfd, 0x80, 0x1f, 0xff, 0xff, 0xfe, 0x00, 0x1f, 0xff, 0xff, 0xfe, 0x00, 0x0f, 0xff,
|
||||
0xff, 0xfc, 0x00, 0x2c, 0x22, 0x37, 0x05, 0x01, 0x0f, 0xff, 0xff, 0xfc, 0x00, 0x1f, 0xff, 0xff,
|
||||
0xfe, 0x00, 0x1f, 0xff, 0xff, 0xfe, 0x00, 0x6f, 0xff, 0xff, 0xfc, 0x00, 0xf7, 0xff, 0xff, 0xf8,
|
||||
0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00,
|
||||
0xf8, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0xf8,
|
||||
0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00,
|
||||
0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00,
|
||||
0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00,
|
||||
0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x00, 0x00,
|
||||
0xf0, 0x00, 0x00, 0x00, 0x00, 0xef, 0xff, 0xff, 0xfc, 0x00, 0xdf, 0xff, 0xff, 0xfc, 0x00, 0x3f,
|
||||
0xff, 0xff, 0xfe, 0x00, 0xdf, 0xff, 0xff, 0xfe, 0xc0, 0xef, 0xff, 0xff, 0xfd, 0xc0, 0xf0, 0x00,
|
||||
0x00, 0x03, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00,
|
||||
0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07,
|
||||
0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0,
|
||||
0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8,
|
||||
0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00,
|
||||
0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00,
|
||||
0x07, 0xc0, 0xf7, 0xff, 0xff, 0xfb, 0xc0, 0x6f, 0xff, 0xff, 0xfd, 0x80, 0x1f, 0xff, 0xff, 0xfe,
|
||||
0x00, 0x1f, 0xff, 0xff, 0xfe, 0x00, 0x0f, 0xff, 0xff, 0xfc, 0x00, 0x2c, 0x22, 0x34, 0x05, 0x03,
|
||||
0x0f, 0xff, 0xff, 0xfc, 0x00, 0x1f, 0xff, 0xff, 0xfe, 0x00, 0x1f, 0xff, 0xff, 0xfe, 0x00, 0x6f,
|
||||
0xff, 0xff, 0xfd, 0x80, 0xf7, 0xff, 0xff, 0xfb, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00,
|
||||
0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00,
|
||||
0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07,
|
||||
0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0,
|
||||
0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8,
|
||||
0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00,
|
||||
0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf0, 0x00, 0x00, 0x03, 0xc0, 0xe0, 0x00, 0x00,
|
||||
0x01, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0xc0, 0x00, 0x00, 0x00, 0x01, 0xc0, 0x00, 0x00, 0x00, 0x03, 0xc0, 0x00, 0x00, 0x00, 0x07, 0xc0,
|
||||
0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x07, 0xc0, 0x00,
|
||||
0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00,
|
||||
0x00, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00,
|
||||
0x07, 0xc0, 0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x07,
|
||||
0xc0, 0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x07, 0xc0,
|
||||
0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x03, 0xc0, 0x00,
|
||||
0x00, 0x00, 0x01, 0x80, 0x2c, 0x22, 0x37, 0x05, 0x01, 0x0f, 0xff, 0xff, 0xfc, 0x00, 0x1f, 0xff,
|
||||
0xff, 0xfe, 0x00, 0x1f, 0xff, 0xff, 0xfe, 0x00, 0x6f, 0xff, 0xff, 0xfd, 0x80, 0xf7, 0xff, 0xff,
|
||||
0xfb, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07,
|
||||
0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0,
|
||||
0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8,
|
||||
0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00,
|
||||
0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00,
|
||||
0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07,
|
||||
0xc0, 0xf0, 0x00, 0x00, 0x03, 0xc0, 0xef, 0xff, 0xff, 0xfd, 0xc0, 0xdf, 0xff, 0xff, 0xfc, 0xc0,
|
||||
0x3f, 0xff, 0xff, 0xfe, 0x00, 0xdf, 0xff, 0xff, 0xfe, 0xc0, 0xef, 0xff, 0xff, 0xfd, 0xc0, 0xf0,
|
||||
0x00, 0x00, 0x03, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00,
|
||||
0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00,
|
||||
0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07,
|
||||
0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0,
|
||||
0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8,
|
||||
0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00,
|
||||
0x00, 0x07, 0xc0, 0xf7, 0xff, 0xff, 0xfb, 0xc0, 0x6f, 0xff, 0xff, 0xfd, 0x80, 0x1f, 0xff, 0xff,
|
||||
0xfe, 0x00, 0x1f, 0xff, 0xff, 0xfe, 0x00, 0x0f, 0xff, 0xff, 0xfc, 0x00, 0x2c, 0x22, 0x37, 0x05,
|
||||
0x01, 0x0f, 0xff, 0xff, 0xfc, 0x00, 0x1f, 0xff, 0xff, 0xfe, 0x00, 0x1f, 0xff, 0xff, 0xfe, 0x00,
|
||||
0x6f, 0xff, 0xff, 0xfd, 0x80, 0xf7, 0xff, 0xff, 0xfb, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8,
|
||||
0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00,
|
||||
0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00,
|
||||
0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07,
|
||||
0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0,
|
||||
0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf8,
|
||||
0x00, 0x00, 0x07, 0xc0, 0xf8, 0x00, 0x00, 0x07, 0xc0, 0xf0, 0x00, 0x00, 0x03, 0xc0, 0xef, 0xff,
|
||||
0xff, 0xfd, 0xc0, 0xdf, 0xff, 0xff, 0xfc, 0xc0, 0x3f, 0xff, 0xff, 0xfe, 0x00, 0x1f, 0xff, 0xff,
|
||||
0xfe, 0xc0, 0x0f, 0xff, 0xff, 0xfd, 0xc0, 0x00, 0x00, 0x00, 0x03, 0xc0, 0x00, 0x00, 0x00, 0x07,
|
||||
0xc0, 0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x07, 0xc0,
|
||||
0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x07, 0xc0, 0x00,
|
||||
0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00,
|
||||
0x00, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00,
|
||||
0x07, 0xc0, 0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x07,
|
||||
0xc0, 0x00, 0x00, 0x00, 0x07, 0xc0, 0x00, 0x00, 0x00, 0x07, 0xc0, 0x07, 0xff, 0xff, 0xfb, 0xc0,
|
||||
0x0f, 0xff, 0xff, 0xfd, 0x80, 0x1f, 0xff, 0xff, 0xfe, 0x00, 0x1f, 0xff, 0xff, 0xfe, 0x00, 0x0f,
|
||||
0xff, 0xff, 0xfc, 0x00, 0x0b, 0x07, 0x1e, 0x02, 0x0c, 0x38, 0x7c, 0xfe, 0xfe, 0xfe, 0x7c, 0x38,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x38, 0x7c, 0xfe, 0xfe, 0xfe, 0x7c, 0x38,
|
||||
};
|
||||
|
||||
#endif
|
||||
154
src/epd/sfont.h
Normal file
154
src/epd/sfont.h
Normal file
@@ -0,0 +1,154 @@
|
||||
#ifndef __sfont__
|
||||
#define __sfont__
|
||||
|
||||
#define sfont_size 2323
|
||||
static const unsigned char sfont[] = {
|
||||
0x72, 0x00, 0x20, 0x00, 0xca, 0x01, 0x21, 0x00, 0xd0, 0x01, 0x22, 0x00, 0xe0, 0x01, 0x23, 0x00,
|
||||
0xe8, 0x01, 0x24, 0x00, 0xf8, 0x01, 0x25, 0x00, 0x08, 0x02, 0x26, 0x00, 0x16, 0x02, 0x27, 0x00,
|
||||
0x24, 0x02, 0x28, 0x00, 0x2c, 0x02, 0x29, 0x00, 0x3d, 0x02, 0x2a, 0x00, 0x4e, 0x02, 0x2b, 0x00,
|
||||
0x5a, 0x02, 0x2c, 0x00, 0x66, 0x02, 0x2d, 0x00, 0x6f, 0x02, 0x2e, 0x00, 0x75, 0x02, 0x2f, 0x00,
|
||||
0x7c, 0x02, 0x30, 0x00, 0x8d, 0x02, 0x31, 0x00, 0x9b, 0x02, 0x32, 0x00, 0xa9, 0x02, 0x33, 0x00,
|
||||
0xb7, 0x02, 0x34, 0x00, 0xc5, 0x02, 0x35, 0x00, 0xd3, 0x02, 0x36, 0x00, 0xe1, 0x02, 0x37, 0x00,
|
||||
0xef, 0x02, 0x38, 0x00, 0xfd, 0x02, 0x39, 0x00, 0x0b, 0x03, 0x3a, 0x00, 0x19, 0x03, 0x3b, 0x00,
|
||||
0x25, 0x03, 0x3c, 0x00, 0x33, 0x03, 0x3d, 0x00, 0x43, 0x03, 0x3e, 0x00, 0x4c, 0x03, 0x3f, 0x00,
|
||||
0x5c, 0x03, 0x40, 0x00, 0x6b, 0x03, 0x41, 0x00, 0x84, 0x03, 0x42, 0x00, 0x92, 0x03, 0x43, 0x00,
|
||||
0xa0, 0x03, 0x44, 0x00, 0xae, 0x03, 0x45, 0x00, 0xbc, 0x03, 0x46, 0x00, 0xca, 0x03, 0x47, 0x00,
|
||||
0xd8, 0x03, 0x48, 0x00, 0xe6, 0x03, 0x49, 0x00, 0xf4, 0x03, 0x4a, 0x00, 0x02, 0x04, 0x4b, 0x00,
|
||||
0x13, 0x04, 0x4c, 0x00, 0x21, 0x04, 0x4d, 0x00, 0x2f, 0x04, 0x4e, 0x00, 0x3d, 0x04, 0x4f, 0x00,
|
||||
0x4b, 0x04, 0x50, 0x00, 0x59, 0x04, 0x51, 0x00, 0x67, 0x04, 0x52, 0x00, 0x76, 0x04, 0x53, 0x00,
|
||||
0x84, 0x04, 0x54, 0x00, 0x92, 0x04, 0x55, 0x00, 0xa0, 0x04, 0x56, 0x00, 0xae, 0x04, 0x57, 0x00,
|
||||
0xbc, 0x04, 0x58, 0x00, 0xd3, 0x04, 0x59, 0x00, 0xe1, 0x04, 0x5a, 0x00, 0xef, 0x04, 0x5b, 0x00,
|
||||
0xfd, 0x04, 0x5c, 0x00, 0x0e, 0x05, 0x5d, 0x00, 0x1d, 0x05, 0x5e, 0x00, 0x2e, 0x05, 0x5f, 0x00,
|
||||
0x36, 0x05, 0x60, 0x00, 0x3c, 0x05, 0x61, 0x00, 0x44, 0x05, 0x62, 0x00, 0x50, 0x05, 0x63, 0x00,
|
||||
0x5f, 0x05, 0x64, 0x00, 0x6b, 0x05, 0x65, 0x00, 0x7a, 0x05, 0x66, 0x00, 0x86, 0x05, 0x67, 0x00,
|
||||
0x95, 0x05, 0x68, 0x00, 0xa4, 0x05, 0x69, 0x00, 0xb3, 0x05, 0x6a, 0x00, 0xc1, 0x05, 0x6b, 0x00,
|
||||
0xd2, 0x05, 0x6c, 0x00, 0xe1, 0x05, 0x6d, 0x00, 0xf0, 0x05, 0x6e, 0x00, 0x03, 0x06, 0x6f, 0x00,
|
||||
0x0f, 0x06, 0x70, 0x00, 0x1b, 0x06, 0x71, 0x00, 0x2a, 0x06, 0x72, 0x00, 0x39, 0x06, 0x73, 0x00,
|
||||
0x45, 0x06, 0x74, 0x00, 0x51, 0x06, 0x75, 0x00, 0x5f, 0x06, 0x76, 0x00, 0x6b, 0x06, 0x77, 0x00,
|
||||
0x77, 0x06, 0x78, 0x00, 0x8a, 0x06, 0x79, 0x00, 0x96, 0x06, 0x7a, 0x00, 0xa5, 0x06, 0x7b, 0x00,
|
||||
0xb1, 0x06, 0x7c, 0x00, 0xc3, 0x06, 0x7d, 0x00, 0xd4, 0x06, 0x7e, 0x00, 0xe6, 0x06, 0x00, 0x4e,
|
||||
0xee, 0x06, 0x03, 0x4e, 0xf5, 0x06, 0x09, 0x4e, 0x14, 0x07, 0x5d, 0x4e, 0x31, 0x07, 0x8c, 0x4e,
|
||||
0x50, 0x07, 0x94, 0x4e, 0x67, 0x07, 0x6b, 0x51, 0x84, 0x07, 0x6d, 0x51, 0xa3, 0x07, 0x06, 0x52,
|
||||
0xc2, 0x07, 0x1d, 0x52, 0xe1, 0x07, 0x41, 0x53, 0x00, 0x08, 0xdb, 0x56, 0x1f, 0x08, 0x74, 0x5e,
|
||||
0x3c, 0x08, 0xe5, 0x65, 0x5b, 0x08, 0xf6, 0x65, 0x78, 0x08, 0x1f, 0x66, 0x97, 0x08, 0x08, 0x67,
|
||||
0xb6, 0x08, 0x1f, 0x67, 0xd5, 0x08, 0xd2, 0x79, 0xf4, 0x08, 0x04, 0x01, 0x01, 0x00, 0x0c, 0x00,
|
||||
0x07, 0x01, 0x0b, 0x03, 0x03, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x80, 0x80,
|
||||
0x06, 0x04, 0x03, 0x01, 0x02, 0x90, 0x90, 0x90, 0x07, 0x06, 0x0b, 0x00, 0x02, 0x48, 0x48, 0x48,
|
||||
0xfc, 0x48, 0x48, 0x48, 0xfc, 0x48, 0x48, 0x48, 0x07, 0x05, 0x0b, 0x01, 0x02, 0x20, 0x70, 0xa8,
|
||||
0xa0, 0x60, 0x30, 0x28, 0x28, 0xa8, 0x70, 0x20, 0x08, 0x07, 0x09, 0x00, 0x03, 0x42, 0xa4, 0xa8,
|
||||
0x48, 0x10, 0x24, 0x2a, 0x4a, 0x84, 0x08, 0x07, 0x09, 0x00, 0x03, 0x30, 0x48, 0x48, 0x50, 0x20,
|
||||
0x54, 0x88, 0x8c, 0x72, 0x05, 0x01, 0x03, 0x02, 0x02, 0x80, 0x80, 0x80, 0x07, 0x03, 0x0c, 0x02,
|
||||
0x02, 0x20, 0x40, 0x40, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x40, 0x40, 0x20, 0x07, 0x03, 0x0c,
|
||||
0x02, 0x02, 0x80, 0x40, 0x40, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x40, 0x40, 0x80, 0x08, 0x07,
|
||||
0x07, 0x00, 0x04, 0x10, 0x54, 0x38, 0xfe, 0x38, 0x54, 0x10, 0x07, 0x07, 0x07, 0x00, 0x04, 0x10,
|
||||
0x10, 0x10, 0xfe, 0x10, 0x10, 0x10, 0x05, 0x02, 0x04, 0x01, 0x0a, 0xc0, 0xc0, 0x40, 0x80, 0x07,
|
||||
0x06, 0x01, 0x00, 0x07, 0xfc, 0x05, 0x02, 0x02, 0x01, 0x0a, 0xc0, 0xc0, 0x07, 0x06, 0x0c, 0x00,
|
||||
0x02, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x40, 0x40, 0x80, 0x80, 0x07, 0x06, 0x09,
|
||||
0x00, 0x03, 0x78, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x84, 0x78, 0x06, 0x05, 0x09, 0x00, 0x03,
|
||||
0xe0, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xf8, 0x07, 0x06, 0x09, 0x00, 0x03, 0x78, 0x84,
|
||||
0x84, 0x08, 0x10, 0x20, 0x40, 0x80, 0xfc, 0x07, 0x06, 0x09, 0x00, 0x03, 0x78, 0x84, 0x04, 0x04,
|
||||
0x38, 0x04, 0x04, 0x84, 0x78, 0x07, 0x06, 0x09, 0x00, 0x03, 0x18, 0x28, 0x48, 0x48, 0x88, 0x88,
|
||||
0xfc, 0x08, 0x08, 0x07, 0x06, 0x09, 0x00, 0x03, 0xfc, 0x80, 0x80, 0xf8, 0x04, 0x04, 0x04, 0x84,
|
||||
0x78, 0x07, 0x06, 0x09, 0x00, 0x03, 0x78, 0x84, 0x80, 0xb8, 0xc4, 0x84, 0x84, 0x84, 0x78, 0x07,
|
||||
0x06, 0x09, 0x00, 0x03, 0xfc, 0x08, 0x08, 0x10, 0x10, 0x10, 0x20, 0x20, 0x20, 0x07, 0x06, 0x09,
|
||||
0x00, 0x03, 0x78, 0x84, 0x84, 0x84, 0x78, 0x84, 0x84, 0x84, 0x78, 0x07, 0x06, 0x09, 0x00, 0x03,
|
||||
0x78, 0x84, 0x84, 0x84, 0x7c, 0x04, 0x04, 0x84, 0x78, 0x06, 0x02, 0x07, 0x02, 0x04, 0xc0, 0xc0,
|
||||
0x00, 0x00, 0x00, 0xc0, 0xc0, 0x06, 0x02, 0x09, 0x02, 0x04, 0xc0, 0xc0, 0x00, 0x00, 0x00, 0xc0,
|
||||
0xc0, 0x40, 0x80, 0x07, 0x06, 0x0b, 0x00, 0x03, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x40, 0x20,
|
||||
0x10, 0x08, 0x04, 0x07, 0x06, 0x04, 0x00, 0x06, 0xfc, 0x00, 0x00, 0xfc, 0x07, 0x06, 0x0b, 0x00,
|
||||
0x03, 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x07, 0x06, 0x0a, 0x00,
|
||||
0x03, 0x78, 0x84, 0x84, 0x04, 0x18, 0x10, 0x10, 0x00, 0x10, 0x10, 0x0a, 0x09, 0x0a, 0x00, 0x02,
|
||||
0x3e, 0x00, 0x41, 0x00, 0x9c, 0x80, 0xa2, 0x80, 0x9e, 0x80, 0xa2, 0x80, 0xa2, 0x80, 0x9e, 0x80,
|
||||
0x41, 0x00, 0x3e, 0x00, 0x09, 0x08, 0x09, 0x00, 0x03, 0x18, 0x18, 0x24, 0x24, 0x42, 0x42, 0x7e,
|
||||
0x81, 0x81, 0x07, 0x06, 0x09, 0x00, 0x03, 0xf8, 0x84, 0x84, 0x84, 0xf8, 0x84, 0x84, 0x84, 0xf8,
|
||||
0x07, 0x06, 0x09, 0x00, 0x03, 0x3c, 0x40, 0x80, 0x80, 0x80, 0x80, 0x80, 0x40, 0x3c, 0x08, 0x07,
|
||||
0x09, 0x00, 0x03, 0xf8, 0x84, 0x82, 0x82, 0x82, 0x82, 0x82, 0x84, 0xf8, 0x07, 0x06, 0x09, 0x00,
|
||||
0x03, 0xfc, 0x80, 0x80, 0x80, 0xf8, 0x80, 0x80, 0x80, 0xfc, 0x07, 0x06, 0x09, 0x00, 0x03, 0xfc,
|
||||
0x80, 0x80, 0x80, 0xf8, 0x80, 0x80, 0x80, 0x80, 0x08, 0x07, 0x09, 0x00, 0x03, 0x3c, 0x42, 0x80,
|
||||
0x80, 0x8e, 0x82, 0x82, 0x42, 0x3e, 0x08, 0x07, 0x09, 0x00, 0x03, 0x82, 0x82, 0x82, 0x82, 0xfe,
|
||||
0x82, 0x82, 0x82, 0x82, 0x04, 0x03, 0x09, 0x00, 0x03, 0xe0, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
|
||||
0x40, 0xe0, 0x04, 0x03, 0x0c, 0x00, 0x03, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0xc0, 0x07, 0x06, 0x09, 0x00, 0x03, 0x84, 0x88, 0x90, 0xa0, 0xc0, 0xa0, 0x90, 0x88,
|
||||
0x84, 0x07, 0x06, 0x09, 0x00, 0x03, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xfc, 0x09,
|
||||
0x08, 0x09, 0x00, 0x03, 0xc3, 0xc3, 0xa5, 0xa5, 0x99, 0x99, 0x81, 0x81, 0x81, 0x08, 0x07, 0x09,
|
||||
0x00, 0x03, 0xc2, 0xc2, 0xa2, 0xa2, 0x92, 0x92, 0x8a, 0x8a, 0x86, 0x08, 0x07, 0x09, 0x00, 0x03,
|
||||
0x38, 0x44, 0x82, 0x82, 0x82, 0x82, 0x82, 0x44, 0x38, 0x07, 0x06, 0x09, 0x00, 0x03, 0xf8, 0x84,
|
||||
0x84, 0x84, 0x84, 0xf8, 0x80, 0x80, 0x80, 0x08, 0x07, 0x0a, 0x00, 0x03, 0x38, 0x44, 0x82, 0x82,
|
||||
0x82, 0x82, 0x82, 0x44, 0x38, 0x06, 0x07, 0x06, 0x09, 0x00, 0x03, 0xf8, 0x84, 0x84, 0x84, 0xf8,
|
||||
0x90, 0x88, 0x88, 0x84, 0x07, 0x06, 0x09, 0x00, 0x03, 0x78, 0x84, 0x80, 0x80, 0x78, 0x04, 0x04,
|
||||
0x84, 0x78, 0x08, 0x07, 0x09, 0x00, 0x03, 0xfe, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
|
||||
0x08, 0x07, 0x09, 0x00, 0x03, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x82, 0x44, 0x38, 0x08, 0x07,
|
||||
0x09, 0x00, 0x03, 0x82, 0x82, 0x82, 0x44, 0x44, 0x28, 0x28, 0x10, 0x10, 0x0c, 0x0b, 0x09, 0x00,
|
||||
0x03, 0x84, 0x20, 0x84, 0x20, 0x8a, 0x20, 0x4a, 0x40, 0x51, 0x40, 0x51, 0x40, 0x51, 0x40, 0x20,
|
||||
0x80, 0x20, 0x80, 0x08, 0x07, 0x09, 0x00, 0x03, 0x82, 0x82, 0x44, 0x28, 0x10, 0x28, 0x44, 0x82,
|
||||
0x82, 0x08, 0x07, 0x09, 0x00, 0x03, 0x82, 0x44, 0x28, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x08,
|
||||
0x07, 0x09, 0x00, 0x03, 0xfe, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0xfe, 0x07, 0x03, 0x0c,
|
||||
0x02, 0x01, 0xe0, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xe0, 0x07, 0x05,
|
||||
0x0a, 0x01, 0x02, 0x80, 0x80, 0x40, 0x40, 0x20, 0x20, 0x10, 0x10, 0x08, 0x08, 0x07, 0x03, 0x0c,
|
||||
0x02, 0x01, 0xe0, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xe0, 0x07, 0x05,
|
||||
0x03, 0x01, 0x02, 0x20, 0x50, 0x88, 0x07, 0x06, 0x01, 0x00, 0x0c, 0xfc, 0x07, 0x03, 0x03, 0x02,
|
||||
0x03, 0xc0, 0x40, 0x20, 0x07, 0x06, 0x07, 0x00, 0x05, 0x78, 0x04, 0x7c, 0x84, 0x84, 0x84, 0x7c,
|
||||
0x07, 0x06, 0x0a, 0x00, 0x02, 0x80, 0x80, 0x80, 0xb8, 0xc4, 0x84, 0x84, 0x84, 0xc4, 0xb8, 0x06,
|
||||
0x05, 0x07, 0x00, 0x05, 0x78, 0x80, 0x80, 0x80, 0x80, 0x80, 0x78, 0x07, 0x06, 0x0a, 0x00, 0x02,
|
||||
0x04, 0x04, 0x04, 0x74, 0x8c, 0x84, 0x84, 0x84, 0x8c, 0x74, 0x07, 0x06, 0x07, 0x00, 0x05, 0x78,
|
||||
0x84, 0x84, 0xfc, 0x80, 0x84, 0x78, 0x06, 0x05, 0x0a, 0x00, 0x02, 0x38, 0x40, 0x40, 0xf8, 0x40,
|
||||
0x40, 0x40, 0x40, 0x40, 0x40, 0x07, 0x06, 0x0a, 0x00, 0x05, 0x7c, 0x84, 0x84, 0x84, 0x84, 0x8c,
|
||||
0x74, 0x04, 0x04, 0x78, 0x07, 0x06, 0x0a, 0x00, 0x02, 0x80, 0x80, 0x80, 0xb8, 0xc4, 0x84, 0x84,
|
||||
0x84, 0x84, 0x84, 0x02, 0x01, 0x09, 0x00, 0x03, 0x80, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
|
||||
0x80, 0x03, 0x02, 0x0c, 0x00, 0x03, 0x40, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
|
||||
0x40, 0x80, 0x06, 0x05, 0x0a, 0x00, 0x02, 0x80, 0x80, 0x80, 0x88, 0x90, 0xa0, 0xc0, 0xa0, 0x90,
|
||||
0x88, 0x03, 0x01, 0x0a, 0x01, 0x02, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
|
||||
0x0a, 0x09, 0x07, 0x00, 0x05, 0xb3, 0x00, 0xcc, 0x80, 0x88, 0x80, 0x88, 0x80, 0x88, 0x80, 0x88,
|
||||
0x80, 0x88, 0x80, 0x07, 0x06, 0x07, 0x00, 0x05, 0xb8, 0xc4, 0x84, 0x84, 0x84, 0x84, 0x84, 0x08,
|
||||
0x07, 0x07, 0x00, 0x05, 0x38, 0x44, 0x82, 0x82, 0x82, 0x44, 0x38, 0x07, 0x06, 0x0a, 0x00, 0x05,
|
||||
0xb8, 0xc4, 0x84, 0x84, 0x84, 0xc4, 0xb8, 0x80, 0x80, 0x80, 0x07, 0x06, 0x0a, 0x00, 0x05, 0x74,
|
||||
0x8c, 0x84, 0x84, 0x84, 0x8c, 0x74, 0x04, 0x04, 0x04, 0x05, 0x04, 0x07, 0x00, 0x05, 0xb0, 0xc0,
|
||||
0x80, 0x80, 0x80, 0x80, 0x80, 0x06, 0x05, 0x07, 0x00, 0x05, 0x70, 0x88, 0x80, 0x70, 0x08, 0x88,
|
||||
0x70, 0x05, 0x04, 0x09, 0x00, 0x03, 0x40, 0x40, 0xf0, 0x40, 0x40, 0x40, 0x40, 0x40, 0x30, 0x07,
|
||||
0x06, 0x07, 0x00, 0x05, 0x84, 0x84, 0x84, 0x84, 0x84, 0x8c, 0x74, 0x08, 0x07, 0x07, 0x00, 0x05,
|
||||
0x82, 0x44, 0x44, 0x28, 0x28, 0x10, 0x10, 0x0a, 0x09, 0x07, 0x00, 0x05, 0x88, 0x80, 0x88, 0x80,
|
||||
0x55, 0x00, 0x55, 0x00, 0x55, 0x00, 0x22, 0x00, 0x22, 0x00, 0x06, 0x05, 0x07, 0x00, 0x05, 0x88,
|
||||
0x88, 0x50, 0x20, 0x50, 0x88, 0x88, 0x08, 0x07, 0x0a, 0x00, 0x05, 0x82, 0x82, 0x44, 0x44, 0x28,
|
||||
0x28, 0x10, 0x10, 0x20, 0x20, 0x06, 0x05, 0x07, 0x00, 0x05, 0xf8, 0x08, 0x10, 0x20, 0x40, 0x80,
|
||||
0xf8, 0x07, 0x03, 0x0d, 0x02, 0x01, 0x20, 0x40, 0x40, 0x40, 0x40, 0x40, 0x80, 0x80, 0x40, 0x40,
|
||||
0x40, 0x40, 0x20, 0x07, 0x01, 0x0c, 0x03, 0x01, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
|
||||
0x80, 0x80, 0x80, 0x80, 0x07, 0x03, 0x0d, 0x02, 0x01, 0x80, 0x40, 0x40, 0x40, 0x40, 0x40, 0x20,
|
||||
0x20, 0x40, 0x40, 0x40, 0x40, 0x80, 0x07, 0x05, 0x03, 0x01, 0x06, 0x40, 0xa8, 0x10, 0x0e, 0x0d,
|
||||
0x01, 0x00, 0x06, 0xff, 0xf8, 0x0e, 0x0d, 0x0d, 0x00, 0x00, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00,
|
||||
0x04, 0x00, 0x04, 0x78, 0x0f, 0x80, 0xf4, 0x00, 0x04, 0x00, 0x04, 0x08, 0x04, 0x08, 0x04, 0x08,
|
||||
0x04, 0x08, 0x03, 0xf8, 0x0e, 0x0d, 0x0c, 0x00, 0x01, 0x7f, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x3f, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff,
|
||||
0xf8, 0x0e, 0x0d, 0x0d, 0x00, 0x00, 0x08, 0x00, 0x08, 0x00, 0x08, 0x40, 0xff, 0xe0, 0x08, 0x40,
|
||||
0x08, 0x40, 0x08, 0x40, 0x08, 0x40, 0x10, 0x40, 0x10, 0x40, 0x10, 0x48, 0x20, 0x48, 0xc0, 0x38,
|
||||
0x0e, 0x0d, 0x09, 0x00, 0x02, 0x3f, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xf8, 0x0e, 0x0d, 0x0c, 0x00, 0x01, 0x3f, 0xe0, 0x02, 0x00,
|
||||
0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x3f, 0xc0, 0x04, 0x40, 0x04, 0x40, 0x04, 0x40, 0x08, 0x40,
|
||||
0x08, 0x40, 0xff, 0xf8, 0x0e, 0x0d, 0x0d, 0x00, 0x00, 0x00, 0x80, 0x08, 0x80, 0x08, 0x80, 0x08,
|
||||
0x80, 0x08, 0x80, 0x08, 0x40, 0x10, 0x40, 0x10, 0x40, 0x10, 0x40, 0x20, 0x20, 0x20, 0x20, 0x40,
|
||||
0x10, 0x80, 0x08, 0x0e, 0x0d, 0x0d, 0x00, 0x00, 0x04, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00,
|
||||
0xff, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x08, 0x80, 0x08, 0x40, 0x10, 0x20, 0x10, 0x20, 0x20, 0x10,
|
||||
0x40, 0x10, 0x0e, 0x0d, 0x0d, 0x00, 0x00, 0x01, 0x00, 0x09, 0x00, 0x08, 0x80, 0x10, 0x80, 0x10,
|
||||
0x40, 0x20, 0x20, 0x5f, 0xd0, 0x84, 0x48, 0x04, 0x40, 0x08, 0x40, 0x08, 0x40, 0x11, 0x40, 0x60,
|
||||
0x80, 0x0e, 0x0d, 0x0d, 0x00, 0x00, 0x40, 0x00, 0x23, 0xf8, 0xf8, 0x88, 0x10, 0x88, 0x20, 0x88,
|
||||
0x28, 0x88, 0x70, 0x88, 0xa8, 0x88, 0x21, 0x08, 0x21, 0x08, 0x22, 0x08, 0x24, 0x50, 0x28, 0x20,
|
||||
0x0e, 0x0d, 0x0d, 0x00, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0xff,
|
||||
0xf8, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x0e,
|
||||
0x0b, 0x0c, 0x01, 0x01, 0xff, 0xe0, 0x92, 0x20, 0x92, 0x20, 0x92, 0x20, 0x92, 0x20, 0xa2, 0x20,
|
||||
0xc1, 0xe0, 0x80, 0x20, 0x80, 0x20, 0x80, 0x20, 0xff, 0xe0, 0x80, 0x20, 0x0e, 0x0d, 0x0d, 0x00,
|
||||
0x00, 0x10, 0x00, 0x10, 0x00, 0x1f, 0xf8, 0x21, 0x00, 0x41, 0x00, 0x9f, 0xe0, 0x11, 0x00, 0x11,
|
||||
0x00, 0x11, 0x00, 0xff, 0xf8, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x0e, 0x09, 0x0c, 0x02, 0x01,
|
||||
0xff, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xff, 0x80, 0x80, 0x80, 0x80, 0x80,
|
||||
0x80, 0x80, 0x80, 0x80, 0xff, 0x80, 0x80, 0x80, 0x0e, 0x0c, 0x0d, 0x01, 0x00, 0x00, 0x40, 0xf0,
|
||||
0x40, 0x90, 0x40, 0x9f, 0xf0, 0x90, 0x40, 0xf4, 0x40, 0x92, 0x40, 0x92, 0x40, 0x90, 0x40, 0xf0,
|
||||
0x40, 0x90, 0x40, 0x01, 0x40, 0x00, 0x80, 0x0e, 0x0d, 0x0d, 0x00, 0x00, 0x3f, 0xe0, 0x20, 0x20,
|
||||
0x3f, 0xe0, 0x20, 0x20, 0x3f, 0xe0, 0x02, 0x00, 0x22, 0x00, 0x3f, 0xf0, 0x42, 0x00, 0x3f, 0xe0,
|
||||
0x02, 0x00, 0x02, 0x00, 0xff, 0xf8, 0x0e, 0x09, 0x0d, 0x02, 0x00, 0x3f, 0x80, 0x20, 0x80, 0x20,
|
||||
0x80, 0x3f, 0x80, 0x20, 0x80, 0x20, 0x80, 0x3f, 0x80, 0x20, 0x80, 0x20, 0x80, 0x20, 0x80, 0x40,
|
||||
0x80, 0x42, 0x80, 0x81, 0x00, 0x0e, 0x0d, 0x0d, 0x00, 0x00, 0x44, 0x00, 0x44, 0xf8, 0xfe, 0x88,
|
||||
0x44, 0x88, 0x7c, 0xf8, 0x44, 0x88, 0x7c, 0x88, 0x44, 0xf8, 0xff, 0x88, 0x00, 0x88, 0x44, 0x88,
|
||||
0x43, 0x28, 0x82, 0x10, 0x0e, 0x0d, 0x0d, 0x00, 0x00, 0x18, 0x80, 0xe0, 0x80, 0x20, 0x80, 0x22,
|
||||
0xa0, 0xfa, 0x90, 0x24, 0x88, 0x70, 0x80, 0x68, 0x90, 0xa0, 0x90, 0xa0, 0x20, 0x20, 0x40, 0x20,
|
||||
0x80, 0x27, 0x00,
|
||||
};
|
||||
|
||||
#endif
|
||||
235
src/epd/spi_flash.c
Normal file
235
src/epd/spi_flash.c
Normal file
@@ -0,0 +1,235 @@
|
||||
|
||||
#include "epd.h"
|
||||
|
||||
|
||||
|
||||
|
||||
static int spio_clk;
|
||||
static int spio_cs;
|
||||
static int spio_di;
|
||||
static int spio_do;
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
|
||||
#define FSPI_DELAY 10
|
||||
|
||||
void fspi_delay(void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for(i=0; i<FSPI_DELAY; i++){
|
||||
__asm("nop");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#define FSPI_CS(n) gpio_set(spio_cs, (n));
|
||||
#define FSPI_CK(n) gpio_set(spio_clk, (n));
|
||||
#define FSPI_SI(n) gpio_set(spio_di, (n));
|
||||
#define FSPI_SO() gpio_get(spio_do);
|
||||
|
||||
|
||||
int fspi_trans(int byte)
|
||||
{
|
||||
int i, data;
|
||||
|
||||
data = 0;
|
||||
for(i=0; i<8; i++){
|
||||
FSPI_SI(byte&0x80);
|
||||
FSPI_CK(0);
|
||||
fspi_delay();
|
||||
|
||||
data <<= 1;
|
||||
data |= FSPI_SO();
|
||||
|
||||
FSPI_CK(1);
|
||||
fspi_delay();
|
||||
byte <<= 1;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
int fspi_init(u32 gpio_word)
|
||||
{
|
||||
spio_clk = (gpio_word>>24)&0xff;
|
||||
spio_cs = (gpio_word>>16)&0xff;
|
||||
spio_di = (gpio_word>> 8)&0xff;
|
||||
spio_do = (gpio_word>> 0)&0xff;
|
||||
|
||||
gpio_config(spio_clk, 0x0300, 0);
|
||||
gpio_config(spio_cs, 0x0300, 1);
|
||||
gpio_config(spio_di, 0x0300, 1);
|
||||
gpio_config(spio_do, 0x0100, 1);
|
||||
|
||||
FSPI_CS(0);
|
||||
fspi_delay();
|
||||
fspi_trans(0xab);
|
||||
FSPI_CS(1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/******************************************************************************/
|
||||
/* SPI flash */
|
||||
/******************************************************************************/
|
||||
|
||||
int epcs_readid(void)
|
||||
{
|
||||
int mid, pid;
|
||||
|
||||
FSPI_CS(0);
|
||||
fspi_delay();
|
||||
|
||||
fspi_trans(0x90);
|
||||
fspi_trans(0);
|
||||
fspi_trans(0);
|
||||
fspi_trans(0);
|
||||
|
||||
mid = fspi_trans(0);
|
||||
pid = fspi_trans(0);
|
||||
|
||||
FSPI_CS(1);
|
||||
fspi_delay();
|
||||
|
||||
return (mid<<8)|pid;
|
||||
}
|
||||
|
||||
int epcs_status(void)
|
||||
{
|
||||
int status;
|
||||
|
||||
FSPI_CS(0);
|
||||
fspi_delay();
|
||||
fspi_trans(0x05);
|
||||
status = fspi_trans(0);
|
||||
FSPI_CS(1);
|
||||
fspi_delay();
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
int epcs_wstat(int stat)
|
||||
{
|
||||
// status write enable
|
||||
FSPI_CS(0);
|
||||
fspi_delay();
|
||||
fspi_trans(0x50);
|
||||
FSPI_CS(1);
|
||||
fspi_delay();
|
||||
|
||||
FSPI_CS(0);
|
||||
fspi_delay();
|
||||
fspi_trans(0x01);
|
||||
fspi_trans(stat);
|
||||
FSPI_CS(1);
|
||||
fspi_delay();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int epcs_wen(int en)
|
||||
{
|
||||
FSPI_CS(0);
|
||||
fspi_delay();
|
||||
if(en)
|
||||
fspi_trans(0x06);
|
||||
else
|
||||
fspi_trans(0x04);
|
||||
FSPI_CS(1);
|
||||
fspi_delay();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int epcs_wait()
|
||||
{
|
||||
int status;
|
||||
|
||||
while(1){
|
||||
status = epcs_status();
|
||||
if((status&1)==0)
|
||||
break;
|
||||
fspi_delay();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int epcs_sector_erase(int addr)
|
||||
{
|
||||
epcs_wen(1);
|
||||
|
||||
FSPI_CS(0);
|
||||
fspi_delay();
|
||||
|
||||
fspi_trans(0x20);
|
||||
fspi_trans((addr>>16)&0xff);
|
||||
fspi_trans((addr>> 8)&0xff);
|
||||
fspi_trans((addr>> 0)&0xff);
|
||||
|
||||
FSPI_CS(1);
|
||||
fspi_delay();
|
||||
|
||||
epcs_wait();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int epcs_page_write(int addr, u8 *buf, int size)
|
||||
{
|
||||
int i;
|
||||
|
||||
epcs_wen(1);
|
||||
|
||||
FSPI_CS(0);
|
||||
fspi_delay();
|
||||
|
||||
fspi_trans(0x02);
|
||||
fspi_trans((addr>>16)&0xff);
|
||||
fspi_trans((addr>> 8)&0xff);
|
||||
fspi_trans((addr>> 0)&0xff);
|
||||
|
||||
for(i=0; i<size; i++){
|
||||
fspi_trans(buf[i]);
|
||||
}
|
||||
|
||||
FSPI_CS(1);
|
||||
fspi_delay();
|
||||
|
||||
epcs_wait();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int epcs_read(int addr, int len, u8 *buf)
|
||||
{
|
||||
int i;
|
||||
|
||||
FSPI_CS(0);
|
||||
fspi_delay();
|
||||
|
||||
fspi_trans(0x0b);
|
||||
fspi_trans((addr>>16)&0xff);
|
||||
fspi_trans((addr>> 8)&0xff);
|
||||
fspi_trans((addr>> 0)&0xff);
|
||||
|
||||
fspi_trans(0);
|
||||
|
||||
for(i=0; i<len; i++){
|
||||
buf[i] = fspi_trans(0);
|
||||
}
|
||||
|
||||
FSPI_CS(1);
|
||||
fspi_delay();
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
/******************************************************************************/
|
||||
|
||||
158
src/platform/user_periph_setup.c
Normal file
158
src/platform/user_periph_setup.c
Normal file
@@ -0,0 +1,158 @@
|
||||
/**
|
||||
****************************************************************************************
|
||||
*
|
||||
* @file user_periph_setup.c
|
||||
*
|
||||
* @brief Peripherals setup and initialization.
|
||||
*
|
||||
* Copyright (C) 2015-2023 Renesas Electronics Corporation and/or its affiliates.
|
||||
* All rights reserved. Confidential Information.
|
||||
*
|
||||
* This software ("Software") is supplied by Renesas Electronics Corporation and/or its
|
||||
* affiliates ("Renesas"). Renesas grants you a personal, non-exclusive, non-transferable,
|
||||
* revocable, non-sub-licensable right and license to use the Software, solely if used in
|
||||
* or together with Renesas products. You may make copies of this Software, provided this
|
||||
* copyright notice and disclaimer ("Notice") is included in all such copies. Renesas
|
||||
* reserves the right to change or discontinue the Software at any time without notice.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS". RENESAS DISCLAIMS ALL WARRANTIES OF ANY KIND,
|
||||
* WHETHER EXPRESS, IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. TO THE
|
||||
* MAXIMUM EXTENT PERMITTED UNDER LAW, IN NO EVENT SHALL RENESAS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE, EVEN IF RENESAS HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGES. USE OF THIS SOFTWARE MAY BE SUBJECT TO TERMS AND CONDITIONS CONTAINED IN
|
||||
* AN ADDITIONAL AGREEMENT BETWEEN YOU AND RENESAS. IN CASE OF CONFLICT BETWEEN THE TERMS
|
||||
* OF THIS NOTICE AND ANY SUCH ADDITIONAL LICENSE AGREEMENT, THE TERMS OF THE AGREEMENT
|
||||
* SHALL TAKE PRECEDENCE. BY CONTINUING TO USE THIS SOFTWARE, YOU AGREE TO THE TERMS OF
|
||||
* THIS NOTICE.IF YOU DO NOT AGREE TO THESE TERMS, YOU ARE NOT PERMITTED TO USE THIS
|
||||
* SOFTWARE.
|
||||
*
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
* INCLUDE FILES
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
#include "user_periph_setup.h"
|
||||
#include "datasheet.h"
|
||||
#include "system_library.h"
|
||||
#include "rwip_config.h"
|
||||
#include "gpio.h"
|
||||
#include "uart.h"
|
||||
#include "syscntl.h"
|
||||
#include "fpga_helper.h"
|
||||
|
||||
/*
|
||||
* GLOBAL VARIABLE DEFINITIONS
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief Each application reserves its own GPIOs here.
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
#if DEVELOPMENT_DEBUG
|
||||
|
||||
void GPIO_reservations(void)
|
||||
{
|
||||
/*
|
||||
i.e. to reserve P0_1 as Generic Purpose I/O:
|
||||
RESERVE_GPIO(DESCRIPTIVE_NAME, GPIO_PORT_0, GPIO_PIN_1, PID_GPIO);
|
||||
*/
|
||||
|
||||
#if defined (CFG_PRINTF_UART2)
|
||||
RESERVE_GPIO(UART2_TX, UART2_TX_PORT, UART2_TX_PIN, PID_UART2_TX);
|
||||
#endif
|
||||
|
||||
RESERVE_GPIO(LED, GPIO_LED_PORT, GPIO_LED_PIN, PID_GPIO);
|
||||
|
||||
#if !defined (__DA14586__)
|
||||
RESERVE_GPIO(SPI_EN, SPI_EN_PORT, SPI_EN_PIN, PID_SPI_EN);
|
||||
#endif
|
||||
|
||||
RESERVE_GPIO("EPD_Pwr", GPIO_PORT_2, GPIO_PIN_3, PID_GPIO);
|
||||
RESERVE_GPIO("EPD_Bsy", GPIO_PORT_2, GPIO_PIN_0, PID_GPIO);
|
||||
RESERVE_GPIO("EPD_Rst", GPIO_PORT_0, GPIO_PIN_7, PID_GPIO);
|
||||
RESERVE_GPIO("EPD_DC ", GPIO_PORT_0, GPIO_PIN_5, PID_GPIO);
|
||||
RESERVE_GPIO("EPD_CS ", GPIO_PORT_2, GPIO_PIN_1, PID_GPIO);
|
||||
RESERVE_GPIO("EPD_CLK", GPIO_PORT_0, GPIO_PIN_0, PID_GPIO);
|
||||
RESERVE_GPIO("EPD_SDI", GPIO_PORT_0, GPIO_PIN_6, PID_GPIO);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void set_pad_functions(void)
|
||||
{
|
||||
/*
|
||||
i.e. to set P0_1 as Generic purpose Output:
|
||||
GPIO_ConfigurePin(GPIO_PORT_0, GPIO_PIN_1, OUTPUT, PID_GPIO, false);
|
||||
*/
|
||||
|
||||
#if defined (__DA14586__)
|
||||
// Disallow spontaneous DA14586 SPI Flash wake-up
|
||||
GPIO_ConfigurePin(GPIO_PORT_2, GPIO_PIN_3, OUTPUT, PID_GPIO, true);
|
||||
#else
|
||||
// Disallow spontaneous SPI Flash wake-up
|
||||
GPIO_ConfigurePin(SPI_EN_PORT, SPI_EN_PIN, OUTPUT, PID_SPI_EN, true);
|
||||
#endif
|
||||
|
||||
#if defined (CFG_PRINTF_UART2)
|
||||
// Configure UART2 TX Pad
|
||||
GPIO_ConfigurePin(UART2_TX_PORT, UART2_TX_PIN, OUTPUT, PID_UART2_TX, false);
|
||||
#endif
|
||||
|
||||
//GPIO_ConfigurePin(GPIO_LED_PORT, GPIO_LED_PIN, OUTPUT, PID_GPIO, false);
|
||||
}
|
||||
|
||||
#if defined (CFG_PRINTF_UART2)
|
||||
// Configuration struct for UART2
|
||||
static const uart_cfg_t uart_cfg = {
|
||||
.baud_rate = UART2_BAUDRATE,
|
||||
.data_bits = UART2_DATABITS,
|
||||
.parity = UART2_PARITY,
|
||||
.stop_bits = UART2_STOPBITS,
|
||||
.auto_flow_control = UART2_AFCE,
|
||||
.use_fifo = UART2_FIFO,
|
||||
.tx_fifo_tr_lvl = UART2_TX_FIFO_LEVEL,
|
||||
.rx_fifo_tr_lvl = UART2_RX_FIFO_LEVEL,
|
||||
.intr_priority = 2,
|
||||
};
|
||||
#endif
|
||||
|
||||
void periph_init(void)
|
||||
{
|
||||
#if defined (__DA14531__)
|
||||
// Select FPGA GPIO_MAP 1
|
||||
// set debugger SWD to SW_CLK = P0[2], SW_DIO=P0[5]
|
||||
FPGA_HELPER(FPGA_GPIO_MAP_1, SWD_DATA_AT_P0_5);
|
||||
|
||||
// In Boost mode enable the DCDC converter to supply VBAT_HIGH for the used GPIOs
|
||||
// Assumption: The connected external peripheral is powered by 3V
|
||||
syscntl_dcdc_turn_on_in_boost(SYSCNTL_DCDC_LEVEL_3V0);
|
||||
#else
|
||||
// Power up peripherals' power domain
|
||||
SetBits16(PMU_CTRL_REG, PERIPH_SLEEP, 0);
|
||||
while (!(GetWord16(SYS_STAT_REG) & PER_IS_UP));
|
||||
SetBits16(CLK_16M_REG, XTAL16_BIAS_SH_ENABLE, 1);
|
||||
#endif
|
||||
|
||||
// ROM patch
|
||||
patch_func();
|
||||
|
||||
// Initialize peripherals
|
||||
#if defined (CFG_PRINTF_UART2)
|
||||
// Initialize UART2
|
||||
uart_initialize(UART2, &uart_cfg);
|
||||
#endif
|
||||
|
||||
// Set pad functionality
|
||||
set_pad_functions();
|
||||
|
||||
// Enable the pads
|
||||
GPIO_set_pad_latch_en(true);
|
||||
}
|
||||
265
src/user_custs1_impl.c
Normal file
265
src/user_custs1_impl.c
Normal file
@@ -0,0 +1,265 @@
|
||||
/**
|
||||
****************************************************************************************
|
||||
*
|
||||
* @file user_custs1_impl.c
|
||||
*
|
||||
* @brief Peripheral project Custom1 Server implementation source code.
|
||||
*
|
||||
* Copyright (C) 2015-2023 Renesas Electronics Corporation and/or its affiliates.
|
||||
* All rights reserved. Confidential Information.
|
||||
*
|
||||
* This software ("Software") is supplied by Renesas Electronics Corporation and/or its
|
||||
* affiliates ("Renesas"). Renesas grants you a personal, non-exclusive, non-transferable,
|
||||
* revocable, non-sub-licensable right and license to use the Software, solely if used in
|
||||
* or together with Renesas products. You may make copies of this Software, provided this
|
||||
* copyright notice and disclaimer ("Notice") is included in all such copies. Renesas
|
||||
* reserves the right to change or discontinue the Software at any time without notice.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS". RENESAS DISCLAIMS ALL WARRANTIES OF ANY KIND,
|
||||
* WHETHER EXPRESS, IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. TO THE
|
||||
* MAXIMUM EXTENT PERMITTED UNDER LAW, IN NO EVENT SHALL RENESAS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE, EVEN IF RENESAS HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGES. USE OF THIS SOFTWARE MAY BE SUBJECT TO TERMS AND CONDITIONS CONTAINED IN
|
||||
* AN ADDITIONAL AGREEMENT BETWEEN YOU AND RENESAS. IN CASE OF CONFLICT BETWEEN THE TERMS
|
||||
* OF THIS NOTICE AND ANY SUCH ADDITIONAL LICENSE AGREEMENT, THE TERMS OF THE AGREEMENT
|
||||
* SHALL TAKE PRECEDENCE. BY CONTINUING TO USE THIS SOFTWARE, YOU AGREE TO THE TERMS OF
|
||||
* THIS NOTICE.IF YOU DO NOT AGREE TO THESE TERMS, YOU ARE NOT PERMITTED TO USE THIS
|
||||
* SOFTWARE.
|
||||
*
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
* INCLUDE FILES
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
#include "gpio.h"
|
||||
#include "app_api.h"
|
||||
#include "app.h"
|
||||
#include "prf_utils.h"
|
||||
#include "custs1.h"
|
||||
#include "custs1_task.h"
|
||||
#include "user_custs1_def.h"
|
||||
#include "user_custs1_impl.h"
|
||||
#include "user_peripheral.h"
|
||||
#include "user_periph_setup.h"
|
||||
#include "adc.h"
|
||||
|
||||
#include "epd.h"
|
||||
|
||||
/*
|
||||
* GLOBAL VARIABLE DEFINITIONS
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
ke_msg_id_t timer_used __SECTION_ZERO("retention_mem_area0"); //@RETENTION MEMORY
|
||||
uint16_t indication_counter __SECTION_ZERO("retention_mem_area0"); //@RETENTION MEMORY
|
||||
uint16_t non_db_val_counter __SECTION_ZERO("retention_mem_area0"); //@RETENTION MEMORY
|
||||
|
||||
/*
|
||||
* FUNCTION DEFINITIONS
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
int adc1_update(void)
|
||||
{
|
||||
adc_offset_calibrate(ADC_INPUT_MODE_SINGLE_ENDED);
|
||||
int adcval = adc_get_vbat_sample(false);
|
||||
adcval = (adcval*225)>>7;
|
||||
|
||||
struct custs1_val_set_req *req = KE_MSG_ALLOC_DYN(CUSTS1_VAL_SET_REQ, prf_get_task_from_id(TASK_ID_CUSTS1), TASK_APP, custs1_val_set_req, DEF_SVC1_ADC_VAL_1_CHAR_LEN);
|
||||
req->conidx = app_env->conidx;
|
||||
req->handle = SVC1_IDX_ADC_VAL_1_VAL;
|
||||
req->length = DEF_SVC1_ADC_VAL_1_CHAR_LEN;
|
||||
req->value[0] = adcval&0xff;
|
||||
req->value[1] = adcval>>8;
|
||||
KE_MSG_SEND(req);
|
||||
|
||||
return adcval;
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
int year=2025, month=0, date=0, wday=2;
|
||||
int hour=0, minute=0, second=0;
|
||||
|
||||
// 增加1天
|
||||
void date_inc(void)
|
||||
{
|
||||
uint8_t d2m[12] = {31,28,31,30,31,30,31,31,30,31,30,31};
|
||||
int is_leap = (year%4)? 0 : (year%100)? 1: (year%400)? 0: 1;
|
||||
d2m[1] += is_leap;
|
||||
|
||||
wday += 1;
|
||||
if(wday>=7)
|
||||
wday = 0;
|
||||
|
||||
date += 1;
|
||||
if(date==d2m[month]){
|
||||
date = 0;
|
||||
month += 1;
|
||||
if(month>=12){
|
||||
month = 0;
|
||||
year += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int clock_update(int inc)
|
||||
{
|
||||
int retv = 0;
|
||||
|
||||
second += inc;
|
||||
if(second<60)
|
||||
return retv;
|
||||
second -= 60;
|
||||
|
||||
minute += 1;
|
||||
retv = 1;
|
||||
if((minute%10)==0)
|
||||
retv = 2;
|
||||
|
||||
if(minute>=60){
|
||||
minute = 0;
|
||||
hour += 1;
|
||||
retv = 3;
|
||||
if(hour>=24){
|
||||
hour = 0;
|
||||
date_inc();
|
||||
retv = 4;
|
||||
}
|
||||
}
|
||||
|
||||
return retv;
|
||||
}
|
||||
|
||||
void clock_set(uint8_t *buf)
|
||||
{
|
||||
year = buf[1] + buf[2]*256;
|
||||
month = buf[3];
|
||||
date = buf[4]-1;
|
||||
hour = buf[5];
|
||||
minute = buf[6];
|
||||
second = buf[7];
|
||||
wday = buf[8];
|
||||
}
|
||||
|
||||
|
||||
void clock_push(void)
|
||||
{
|
||||
uint8_t buf[8];
|
||||
struct custs1_val_set_req *req = KE_MSG_ALLOC_DYN(CUSTS1_VAL_SET_REQ, prf_get_task_from_id(TASK_ID_CUSTS1), TASK_APP, custs1_val_set_req, 8);
|
||||
|
||||
req->conidx = app_env->conidx;
|
||||
req->handle = SVC1_IDX_LONG_VALUE_VAL;
|
||||
req->length = 8;
|
||||
req->value[0] = year&0xff;
|
||||
req->value[1] = year>>8;
|
||||
req->value[2] = month;
|
||||
req->value[3] = date+1;
|
||||
req->value[4] = hour;
|
||||
req->value[5] = minute;
|
||||
req->value[6] = second;
|
||||
req->value[7] = 0;
|
||||
KE_MSG_SEND(req);
|
||||
}
|
||||
|
||||
|
||||
void clock_print(void)
|
||||
{
|
||||
printk("\n%04d-%02d-%02d %02d:%02d:%02d\n", year, month+1, date+1, hour, minute, second);
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
char *wday_str[] = {"一", "二", "三", "四", "五", "六", "日"};
|
||||
|
||||
void clock_draw(int full)
|
||||
{
|
||||
char tbuf[64];
|
||||
|
||||
epd_init(104, 212, EPD_BWR|ROTATE_3);
|
||||
|
||||
memset(fb_bw, 0xff, scr_h*line_bytes);
|
||||
memset(fb_rr, 0x00, scr_h*line_bytes);
|
||||
|
||||
select_font(1);
|
||||
sprintf(tbuf, "%02d:%02d", hour, minute);
|
||||
draw_text(12, 20, tbuf, BLACK);
|
||||
|
||||
sprintf(tbuf, "%4d年%2d月%2d日 星期%s", year, month+1, date+1, wday_str[wday]);
|
||||
select_font(0);
|
||||
draw_text(15, 85, tbuf, BLACK);
|
||||
|
||||
epd_screen_update();
|
||||
|
||||
if(full){
|
||||
epd_update(0xf4);
|
||||
}else{
|
||||
epd_load_lut(lut_p);
|
||||
epd_cmd1(0x2c, 0x55);
|
||||
epd_update(0xc0);
|
||||
epd_update(0x04);
|
||||
}
|
||||
epd_cmd1(0x10, 0x03);
|
||||
epd_power(0);
|
||||
epd_hw_close();
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************************/
|
||||
|
||||
|
||||
void user_svc1_ctrl_wr_ind_handler(ke_msg_id_t const msgid, struct custs1_val_write_ind const *param, ke_task_id_t const dest_id, ke_task_id_t const src_id)
|
||||
{
|
||||
printk("Control Point: %02x\n", param->value[0]);
|
||||
|
||||
}
|
||||
|
||||
void user_svc1_long_val_wr_ind_handler(ke_msg_id_t const msgid, struct custs1_val_write_ind const *param, ke_task_id_t const dest_id, ke_task_id_t const src_id)
|
||||
{
|
||||
printk("Long value: %d\n", param->length);
|
||||
if(param->value[0]==0x91){
|
||||
clock_set((uint8_t*)param->value);
|
||||
clock_draw(1);
|
||||
clock_print();
|
||||
}
|
||||
}
|
||||
|
||||
void user_svc1_long_val_att_info_req_handler(ke_msg_id_t const msgid, struct custs1_att_info_req const *param, ke_task_id_t const dest_id, ke_task_id_t const src_id)
|
||||
{
|
||||
struct custs1_att_info_rsp *rsp = KE_MSG_ALLOC(CUSTS1_ATT_INFO_RSP, src_id, dest_id, custs1_att_info_rsp);
|
||||
rsp->conidx = app_env[param->conidx].conidx;
|
||||
rsp->att_idx = param->att_idx;
|
||||
rsp->length = 0;
|
||||
rsp->status = ATT_ERR_NO_ERROR;
|
||||
|
||||
KE_MSG_SEND(rsp);
|
||||
}
|
||||
|
||||
void user_svc1_rest_att_info_req_handler(ke_msg_id_t const msgid,
|
||||
struct custs1_att_info_req const *param,
|
||||
ke_task_id_t const dest_id,
|
||||
ke_task_id_t const src_id)
|
||||
{
|
||||
struct custs1_att_info_rsp *rsp = KE_MSG_ALLOC(CUSTS1_ATT_INFO_RSP,
|
||||
src_id,
|
||||
dest_id,
|
||||
custs1_att_info_rsp);
|
||||
// Provide the connection index.
|
||||
rsp->conidx = app_env[param->conidx].conidx;
|
||||
// Provide the attribute index.
|
||||
rsp->att_idx = param->att_idx;
|
||||
// Force current length to zero.
|
||||
rsp->length = 0;
|
||||
// Provide the ATT error code.
|
||||
rsp->status = ATT_ERR_WRITE_NOT_PERMITTED;
|
||||
|
||||
KE_MSG_SEND(rsp);
|
||||
}
|
||||
|
||||
224
src/user_custs1_impl.h
Normal file
224
src/user_custs1_impl.h
Normal file
@@ -0,0 +1,224 @@
|
||||
/**
|
||||
****************************************************************************************
|
||||
*
|
||||
* @file user_custs1_impl.h
|
||||
*
|
||||
* @brief Peripheral project Custom1 Server implementation header file.
|
||||
*
|
||||
* Copyright (C) 2015-2023 Renesas Electronics Corporation and/or its affiliates.
|
||||
* All rights reserved. Confidential Information.
|
||||
*
|
||||
* This software ("Software") is supplied by Renesas Electronics Corporation and/or its
|
||||
* affiliates ("Renesas"). Renesas grants you a personal, non-exclusive, non-transferable,
|
||||
* revocable, non-sub-licensable right and license to use the Software, solely if used in
|
||||
* or together with Renesas products. You may make copies of this Software, provided this
|
||||
* copyright notice and disclaimer ("Notice") is included in all such copies. Renesas
|
||||
* reserves the right to change or discontinue the Software at any time without notice.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS". RENESAS DISCLAIMS ALL WARRANTIES OF ANY KIND,
|
||||
* WHETHER EXPRESS, IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. TO THE
|
||||
* MAXIMUM EXTENT PERMITTED UNDER LAW, IN NO EVENT SHALL RENESAS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE, EVEN IF RENESAS HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGES. USE OF THIS SOFTWARE MAY BE SUBJECT TO TERMS AND CONDITIONS CONTAINED IN
|
||||
* AN ADDITIONAL AGREEMENT BETWEEN YOU AND RENESAS. IN CASE OF CONFLICT BETWEEN THE TERMS
|
||||
* OF THIS NOTICE AND ANY SUCH ADDITIONAL LICENSE AGREEMENT, THE TERMS OF THE AGREEMENT
|
||||
* SHALL TAKE PRECEDENCE. BY CONTINUING TO USE THIS SOFTWARE, YOU AGREE TO THE TERMS OF
|
||||
* THIS NOTICE.IF YOU DO NOT AGREE TO THESE TERMS, YOU ARE NOT PERMITTED TO USE THIS
|
||||
* SOFTWARE.
|
||||
*
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef _USER_CUSTS1_IMPL_H_
|
||||
#define _USER_CUSTS1_IMPL_H_
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @addtogroup APP
|
||||
* @ingroup RICOW
|
||||
*
|
||||
* @brief
|
||||
*
|
||||
* @{
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
* DEFINES
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
enum
|
||||
{
|
||||
CUSTS1_CP_ADC_VAL1_DISABLE = 0,
|
||||
CUSTS1_CP_ADC_VAL1_ENABLE,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
CUSTS1_LED_OFF = 0,
|
||||
CUSTS1_LED_ON,
|
||||
};
|
||||
|
||||
/*
|
||||
* INCLUDE FILES
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
#include "gapc_task.h" // gap functions and messages
|
||||
#include "gapm_task.h" // gap functions and messages
|
||||
#include "custs1_task.h"
|
||||
|
||||
|
||||
/*
|
||||
* FUNCTION DECLARATIONS
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
|
||||
int adc1_update(void);
|
||||
int clock_update(int inc);
|
||||
void clock_print(void);
|
||||
void clock_set(uint8_t *buf);
|
||||
void clock_push(void);
|
||||
void clock_draw(int full);
|
||||
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief Control point write indication handler.
|
||||
* @param[in] msgid Id of the message received.
|
||||
* @param[in] param Pointer to the parameters of the message.
|
||||
* @param[in] dest_id ID of the receiving task instance.
|
||||
* @param[in] src_id ID of the sending task instance.
|
||||
****************************************************************************************
|
||||
*/
|
||||
void user_svc1_ctrl_wr_ind_handler(ke_msg_id_t const msgid,
|
||||
struct custs1_val_write_ind const *param,
|
||||
ke_task_id_t const dest_id,
|
||||
ke_task_id_t const src_id);
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief Led state value write indication handler.
|
||||
* @param[in] msgid Id of the message received.
|
||||
* @param[in] param Pointer to the parameters of the message.
|
||||
* @param[in] dest_id ID of the receiving task instance.
|
||||
* @param[in] src_id ID of the sending task instance.
|
||||
****************************************************************************************
|
||||
*/
|
||||
void user_svc1_led_wr_ind_handler(ke_msg_id_t const msgid,
|
||||
struct custs1_val_write_ind const *param,
|
||||
ke_task_id_t const dest_id,
|
||||
ke_task_id_t const src_id);
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief Long value configuration indication handler.
|
||||
* @param[in] msgid Id of the message received.
|
||||
* @param[in] param Pointer to the parameters of the message.
|
||||
* @param[in] dest_id ID of the receiving task instance.
|
||||
* @param[in] src_id ID of the sending task instance.
|
||||
****************************************************************************************
|
||||
*/
|
||||
void user_svc1_long_val_cfg_ind_handler(ke_msg_id_t const msgid,
|
||||
struct custs1_val_write_ind const *param,
|
||||
ke_task_id_t const dest_id,
|
||||
ke_task_id_t const src_id);
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief Long value write indication handler.
|
||||
* @param[in] msgid Id of the message received.
|
||||
* @param[in] param Pointer to the parameters of the message.
|
||||
* @param[in] dest_id ID of the receiving task instance.
|
||||
* @param[in] src_id ID of the sending task instance.
|
||||
****************************************************************************************
|
||||
*/
|
||||
void user_svc1_long_val_wr_ind_handler(ke_msg_id_t const msgid,
|
||||
struct custs1_val_write_ind const *param,
|
||||
ke_task_id_t const dest_id,
|
||||
ke_task_id_t const src_id);
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief ADC value 1 configuration indication handler.
|
||||
* @param[in] msgid Id of the message received.
|
||||
* @param[in] param Pointer to the parameters of the message.
|
||||
* @param[in] dest_id ID of the receiving task instance.
|
||||
* @param[in] src_id ID of the sending task instance.
|
||||
****************************************************************************************
|
||||
*/
|
||||
void user_svc1_adc_val_1_cfg_ind_handler(ke_msg_id_t const msgid,
|
||||
struct custs1_val_write_ind const *param,
|
||||
ke_task_id_t const dest_id,
|
||||
ke_task_id_t const src_id);
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief Button configuration indication handler.
|
||||
* @param[in] msgid Id of the message received.
|
||||
* @param[in] param Pointer to the parameters of the message.
|
||||
* @param[in] dest_id ID of the receiving task instance.
|
||||
* @param[in] src_id ID of the sending task instance.
|
||||
****************************************************************************************
|
||||
*/
|
||||
void user_svc1_button_cfg_ind_handler(ke_msg_id_t const msgid,
|
||||
struct custs1_val_write_ind const *param,
|
||||
ke_task_id_t const dest_id,
|
||||
ke_task_id_t const src_id);
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief Long value attribute info request handler.
|
||||
* @param[in] msgid Id of the message received.
|
||||
* @param[in] param Pointer to the parameters of the message.
|
||||
* @param[in] dest_id ID of the receiving task instance.
|
||||
* @param[in] src_id ID of the sending task instance.
|
||||
****************************************************************************************
|
||||
*/
|
||||
void user_svc1_long_val_att_info_req_handler(ke_msg_id_t const msgid,
|
||||
struct custs1_att_info_req const *param,
|
||||
ke_task_id_t const dest_id,
|
||||
ke_task_id_t const src_id);
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief Remaining attribute info request handler.
|
||||
* @param[in] msgid Id of the message received.
|
||||
* @param[in] param Pointer to the parameters of the message.
|
||||
* @param[in] dest_id ID of the receiving task instance.
|
||||
* @param[in] src_id ID of the sending task instance.
|
||||
****************************************************************************************
|
||||
*/
|
||||
void user_svc1_rest_att_info_req_handler(ke_msg_id_t const msgid,
|
||||
struct custs1_att_info_req const *param,
|
||||
ke_task_id_t const dest_id,
|
||||
ke_task_id_t const src_id);
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief ADC sampling timer callback handler.
|
||||
****************************************************************************************
|
||||
*/
|
||||
void app_adcval1_timer_cb_handler(void);
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief Read the value of a non-database characteristic handler.
|
||||
* @param[in] msgid Id of the message received.
|
||||
* @param[in] param Pointer to the parameters of the message.
|
||||
* @param[in] dest_id ID of the receiving task instance.
|
||||
* @param[in] src_id ID of the sending task instance.
|
||||
****************************************************************************************
|
||||
*/
|
||||
void user_svc3_read_non_db_val_handler(ke_msg_id_t const msgid,
|
||||
struct custs1_value_req_ind const *param,
|
||||
ke_task_id_t const dest_id,
|
||||
ke_task_id_t const src_id);
|
||||
|
||||
/// @} APP
|
||||
|
||||
#endif // _USER_CUSTS1_IMPL_H_
|
||||
496
src/user_peripheral.c
Normal file
496
src/user_peripheral.c
Normal file
@@ -0,0 +1,496 @@
|
||||
/**
|
||||
****************************************************************************************
|
||||
*
|
||||
* @file user_peripheral.c
|
||||
*
|
||||
* @brief Peripheral project source code.
|
||||
*
|
||||
* Copyright (C) 2015-2023 Renesas Electronics Corporation and/or its affiliates.
|
||||
* All rights reserved. Confidential Information.
|
||||
*
|
||||
* This software ("Software") is supplied by Renesas Electronics Corporation and/or its
|
||||
* affiliates ("Renesas"). Renesas grants you a personal, non-exclusive, non-transferable,
|
||||
* revocable, non-sub-licensable right and license to use the Software, solely if used in
|
||||
* or together with Renesas products. You may make copies of this Software, provided this
|
||||
* copyright notice and disclaimer ("Notice") is included in all such copies. Renesas
|
||||
* reserves the right to change or discontinue the Software at any time without notice.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS". RENESAS DISCLAIMS ALL WARRANTIES OF ANY KIND,
|
||||
* WHETHER EXPRESS, IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. TO THE
|
||||
* MAXIMUM EXTENT PERMITTED UNDER LAW, IN NO EVENT SHALL RENESAS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE, EVEN IF RENESAS HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGES. USE OF THIS SOFTWARE MAY BE SUBJECT TO TERMS AND CONDITIONS CONTAINED IN
|
||||
* AN ADDITIONAL AGREEMENT BETWEEN YOU AND RENESAS. IN CASE OF CONFLICT BETWEEN THE TERMS
|
||||
* OF THIS NOTICE AND ANY SUCH ADDITIONAL LICENSE AGREEMENT, THE TERMS OF THE AGREEMENT
|
||||
* SHALL TAKE PRECEDENCE. BY CONTINUING TO USE THIS SOFTWARE, YOU AGREE TO THE TERMS OF
|
||||
* THIS NOTICE.IF YOU DO NOT AGREE TO THESE TERMS, YOU ARE NOT PERMITTED TO USE THIS
|
||||
* SOFTWARE.
|
||||
*
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @addtogroup APP
|
||||
* @{
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
* INCLUDE FILES
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
#include "rwip_config.h" // SW configuration
|
||||
#include "gattc_task.h"
|
||||
#include "gap.h"
|
||||
#include "app_easy_timer.h"
|
||||
#include "user_peripheral.h"
|
||||
#include "user_custs1_impl.h"
|
||||
#include "user_custs1_def.h"
|
||||
#include "co_bt.h"
|
||||
|
||||
#include "epd.h"
|
||||
|
||||
/*
|
||||
* TYPE DEFINITIONS
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
// Manufacturer Specific Data ADV structure type
|
||||
struct mnf_specific_data_ad_structure
|
||||
{
|
||||
uint8_t ad_structure_size;
|
||||
uint8_t ad_structure_type;
|
||||
uint8_t company_id[APP_AD_MSD_COMPANY_ID_LEN];
|
||||
uint8_t proprietary_data[APP_AD_MSD_DATA_LEN];
|
||||
};
|
||||
|
||||
/*
|
||||
* GLOBAL VARIABLE DEFINITIONS
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
uint8_t app_connection_idx __SECTION_ZERO("retention_mem_area0");
|
||||
timer_hnd app_clock_timer_used __SECTION_ZERO("retention_mem_area0"); //@RETENTION MEMORY
|
||||
timer_hnd app_adv_data_update_timer_used __SECTION_ZERO("retention_mem_area0");
|
||||
timer_hnd app_param_update_request_timer_used __SECTION_ZERO("retention_mem_area0");
|
||||
|
||||
// Retained variables
|
||||
struct mnf_specific_data_ad_structure mnf_data __SECTION_ZERO("retention_mem_area0"); //@RETENTION MEMORY
|
||||
// Index of manufacturer data in advertising data or scan response data (when MSB is 1)
|
||||
uint8_t mnf_data_index __SECTION_ZERO("retention_mem_area0"); //@RETENTION MEMORY
|
||||
uint8_t stored_adv_data_len __SECTION_ZERO("retention_mem_area0"); //@RETENTION MEMORY
|
||||
uint8_t stored_scan_rsp_data_len __SECTION_ZERO("retention_mem_area0"); //@RETENTION MEMORY
|
||||
uint8_t stored_adv_data[ADV_DATA_LEN] __SECTION_ZERO("retention_mem_area0"); //@RETENTION MEMORY
|
||||
uint8_t stored_scan_rsp_data[SCAN_RSP_DATA_LEN] __SECTION_ZERO("retention_mem_area0"); //@RETENTION MEMORY
|
||||
|
||||
/*
|
||||
* FUNCTION DEFINITIONS
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief Initialize Manufacturer Specific Data
|
||||
****************************************************************************************
|
||||
*/
|
||||
static void mnf_data_init()
|
||||
{
|
||||
mnf_data.ad_structure_size = sizeof(struct mnf_specific_data_ad_structure ) - sizeof(uint8_t); // minus the size of the ad_structure_size field
|
||||
mnf_data.ad_structure_type = GAP_AD_TYPE_MANU_SPECIFIC_DATA;
|
||||
mnf_data.company_id[0] = APP_AD_MSD_COMPANY_ID & 0xFF; // LSB
|
||||
mnf_data.company_id[1] = (APP_AD_MSD_COMPANY_ID >> 8 )& 0xFF; // MSB
|
||||
mnf_data.proprietary_data[0] = 0;
|
||||
mnf_data.proprietary_data[1] = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief Update Manufacturer Specific Data
|
||||
****************************************************************************************
|
||||
*/
|
||||
static void mnf_data_update()
|
||||
{
|
||||
uint16_t data;
|
||||
|
||||
data = mnf_data.proprietary_data[0] | (mnf_data.proprietary_data[1] << 8);
|
||||
data += 1;
|
||||
mnf_data.proprietary_data[0] = data & 0xFF;
|
||||
mnf_data.proprietary_data[1] = (data >> 8) & 0xFF;
|
||||
|
||||
if (data == 0xFFFF) {
|
||||
mnf_data.proprietary_data[0] = 0;
|
||||
mnf_data.proprietary_data[1] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief Add an AD structure in the Advertising or Scan Response Data of the
|
||||
* GAPM_START_ADVERTISE_CMD parameter struct.
|
||||
* @param[in] cmd GAPM_START_ADVERTISE_CMD parameter struct
|
||||
* @param[in] ad_struct_data AD structure buffer
|
||||
* @param[in] ad_struct_len AD structure length
|
||||
* @param[in] adv_connectable Connectable advertising event or not. It controls whether
|
||||
* the advertising data use the full 31 bytes length or only
|
||||
* 28 bytes (Document CCSv6 - Part 1.3 Flags).
|
||||
****************************************************************************************
|
||||
*/
|
||||
static void app_add_ad_struct(struct gapm_start_advertise_cmd *cmd, void *ad_struct_data, uint8_t ad_struct_len, uint8_t adv_connectable)
|
||||
{
|
||||
uint8_t adv_data_max_size = (adv_connectable) ? (ADV_DATA_LEN - 3) : (ADV_DATA_LEN);
|
||||
|
||||
if ((adv_data_max_size - cmd->info.host.adv_data_len) >= ad_struct_len)
|
||||
{
|
||||
// Append manufacturer data to advertising data
|
||||
memcpy(&cmd->info.host.adv_data[cmd->info.host.adv_data_len], ad_struct_data, ad_struct_len);
|
||||
|
||||
// Update Advertising Data Length
|
||||
cmd->info.host.adv_data_len += ad_struct_len;
|
||||
|
||||
// Store index of manufacturer data which are included in the advertising data
|
||||
mnf_data_index = cmd->info.host.adv_data_len - sizeof(struct mnf_specific_data_ad_structure);
|
||||
}
|
||||
else if ((SCAN_RSP_DATA_LEN - cmd->info.host.scan_rsp_data_len) >= ad_struct_len)
|
||||
{
|
||||
// Append manufacturer data to scan response data
|
||||
memcpy(&cmd->info.host.scan_rsp_data[cmd->info.host.scan_rsp_data_len], ad_struct_data, ad_struct_len);
|
||||
|
||||
// Update Scan Response Data Length
|
||||
cmd->info.host.scan_rsp_data_len += ad_struct_len;
|
||||
|
||||
// Store index of manufacturer data which are included in the scan response data
|
||||
mnf_data_index = cmd->info.host.scan_rsp_data_len - sizeof(struct mnf_specific_data_ad_structure);
|
||||
// Mark that manufacturer data is in scan response and not advertising data
|
||||
mnf_data_index |= 0x80;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Manufacturer Specific Data do not fit in either Advertising Data or Scan Response Data
|
||||
ASSERT_WARNING(0);
|
||||
}
|
||||
// Store advertising data length
|
||||
stored_adv_data_len = cmd->info.host.adv_data_len;
|
||||
// Store advertising data
|
||||
memcpy(stored_adv_data, cmd->info.host.adv_data, stored_adv_data_len);
|
||||
// Store scan response data length
|
||||
stored_scan_rsp_data_len = cmd->info.host.scan_rsp_data_len;
|
||||
// Store scan_response data
|
||||
memcpy(stored_scan_rsp_data, cmd->info.host.scan_rsp_data, stored_scan_rsp_data_len);
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief Advertisement data update timer callback function.
|
||||
****************************************************************************************
|
||||
*/
|
||||
static void adv_data_update_timer_cb()
|
||||
{
|
||||
printk("adv_data_update_timer_cb!\n");
|
||||
// If mnd_data_index has MSB set, manufacturer data is stored in scan response
|
||||
uint8_t *mnf_data_storage = (mnf_data_index & 0x80) ? stored_scan_rsp_data : stored_adv_data;
|
||||
|
||||
// Update manufacturer data
|
||||
mnf_data_update();
|
||||
|
||||
// Update the selected fields of the advertising data (manufacturer data)
|
||||
memcpy(mnf_data_storage + (mnf_data_index & 0x7F), &mnf_data, sizeof(struct mnf_specific_data_ad_structure));
|
||||
|
||||
// Update advertising data on the fly
|
||||
app_easy_gap_update_adv_data(stored_adv_data, stored_adv_data_len, stored_scan_rsp_data, stored_scan_rsp_data_len);
|
||||
|
||||
// Restart timer for the next advertising update
|
||||
app_adv_data_update_timer_used = app_easy_timer(APP_ADV_DATA_UPDATE_TO, adv_data_update_timer_cb);
|
||||
}
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief Parameter update request timer callback function.
|
||||
****************************************************************************************
|
||||
*/
|
||||
static void param_update_request_timer_cb()
|
||||
{
|
||||
app_easy_gap_param_update_start(app_connection_idx);
|
||||
app_param_update_request_timer_used = EASY_TIMER_INVALID_TIMER;
|
||||
}
|
||||
|
||||
static int adv_count;
|
||||
|
||||
void user_app_init(void)
|
||||
{
|
||||
printk("\n\nuser_app_init!\n");
|
||||
app_param_update_request_timer_used = EASY_TIMER_INVALID_TIMER;
|
||||
app_clock_timer_used = EASY_TIMER_INVALID_TIMER;
|
||||
|
||||
adv_count = 0;
|
||||
epd_hw_init(0x23200700, 0x05210006); // for 2.13 board BW
|
||||
|
||||
// Initialize Manufacturer Specific Data
|
||||
mnf_data_init();
|
||||
|
||||
// Initialize Advertising and Scan Response Data
|
||||
memcpy(stored_adv_data, USER_ADVERTISE_DATA, USER_ADVERTISE_DATA_LEN);
|
||||
stored_adv_data_len = USER_ADVERTISE_DATA_LEN;
|
||||
memcpy(stored_scan_rsp_data, USER_ADVERTISE_SCAN_RESPONSE_DATA, USER_ADVERTISE_SCAN_RESPONSE_DATA_LEN);
|
||||
stored_scan_rsp_data_len = USER_ADVERTISE_SCAN_RESPONSE_DATA_LEN;
|
||||
|
||||
default_app_on_init();
|
||||
}
|
||||
|
||||
void user_app_before_sleep(void)
|
||||
{
|
||||
epd_hw_close();
|
||||
}
|
||||
|
||||
|
||||
void epd_test(void);
|
||||
void epd_test2(void);
|
||||
|
||||
|
||||
static void app_clock_timer_cb(void)
|
||||
{
|
||||
app_clock_timer_used = app_easy_timer(1000, app_clock_timer_cb);
|
||||
|
||||
int stat = clock_update(10);
|
||||
clock_print();
|
||||
|
||||
if(stat>0){
|
||||
int full = (stat>1)? 1:0;
|
||||
clock_draw(full);
|
||||
}
|
||||
|
||||
if(adv_count<20){
|
||||
if(adv_count>=12){
|
||||
adv_count = 0;
|
||||
user_app_adv_start();
|
||||
}else{
|
||||
adv_count += 1;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
void user_app_on_db_init_complete( void )
|
||||
{
|
||||
app_clock_timer_used = app_easy_timer(1000, app_clock_timer_cb);
|
||||
printk("\nuser_app_on_db_init_complete! %08x\n", app_clock_timer_used);
|
||||
|
||||
int adcval = adc1_update();
|
||||
printk("Voltage: %d\n", adcval);
|
||||
|
||||
clock_print();
|
||||
clock_push();
|
||||
|
||||
clock_draw(1);
|
||||
|
||||
user_app_adv_start();
|
||||
}
|
||||
|
||||
void user_app_adv_start(void)
|
||||
{
|
||||
// Schedule the next advertising data update
|
||||
//app_adv_data_update_timer_used = app_easy_timer(APP_ADV_DATA_UPDATE_TO, adv_data_update_timer_cb);
|
||||
|
||||
struct gapm_start_advertise_cmd* cmd;
|
||||
cmd = app_easy_gap_undirected_advertise_get_active();
|
||||
|
||||
// Add manufacturer data to initial advertising or scan response data, if there is enough space
|
||||
app_add_ad_struct(cmd, &mnf_data, sizeof(struct mnf_specific_data_ad_structure), 1);
|
||||
|
||||
//default_advertise_operation();
|
||||
//app_easy_gap_undirected_advertise_start();
|
||||
app_easy_gap_undirected_advertise_with_timeout_start(user_default_hnd_conf.advertise_period, NULL);
|
||||
printk("\nuser_app_adv_start!\n");
|
||||
}
|
||||
|
||||
void user_app_connection(uint8_t connection_idx, struct gapc_connection_req_ind const *param)
|
||||
{
|
||||
printk("user_app_connection: %d\n", connection_idx);
|
||||
|
||||
if (app_env[connection_idx].conidx != GAP_INVALID_CONIDX)
|
||||
{
|
||||
adv_count = 20;
|
||||
app_connection_idx = connection_idx;
|
||||
|
||||
printk(" interval: %d\n", param->con_interval);
|
||||
printk(" latency : %d\n", param->con_latency);
|
||||
printk(" sup_to : %d\n", param->sup_to);
|
||||
// Check if the parameters of the established connection are the preferred ones.
|
||||
// If not then schedule a connection parameter update request.
|
||||
if ((param->con_interval < user_connection_param_conf.intv_min) ||
|
||||
(param->con_interval > user_connection_param_conf.intv_max) ||
|
||||
(param->con_latency != user_connection_param_conf.latency) ||
|
||||
(param->sup_to != user_connection_param_conf.time_out))
|
||||
{
|
||||
// Connection params are not these that we expect
|
||||
app_param_update_request_timer_used = app_easy_timer(APP_PARAM_UPDATE_REQUEST_TO, param_update_request_timer_cb);
|
||||
}
|
||||
|
||||
clock_push();
|
||||
} else {
|
||||
// No connection has been established, restart advertising
|
||||
//user_app_adv_start();
|
||||
adv_count = 0;
|
||||
}
|
||||
|
||||
default_app_on_connection(connection_idx, param);
|
||||
}
|
||||
|
||||
void user_app_adv_undirect_complete(uint8_t status)
|
||||
{
|
||||
printk("user_app_adv_undirect_complete: %02x\n", status);
|
||||
}
|
||||
|
||||
|
||||
void user_app_disconnect(struct gapc_disconnect_ind const *param)
|
||||
{
|
||||
printk("user_app_disconnect! reason=%02x\n", param->reason);
|
||||
|
||||
// Cancel the parameter update request timer
|
||||
if (app_param_update_request_timer_used != EASY_TIMER_INVALID_TIMER)
|
||||
{
|
||||
app_easy_timer_cancel(app_param_update_request_timer_used);
|
||||
app_param_update_request_timer_used = EASY_TIMER_INVALID_TIMER;
|
||||
}
|
||||
|
||||
if(param->reason!=CO_ERROR_REMOTE_USER_TERM_CON){
|
||||
// 非主动断开连接时, 重新广播.
|
||||
user_app_adv_start();
|
||||
}
|
||||
|
||||
adv_count = 0;
|
||||
}
|
||||
|
||||
|
||||
void user_catch_rest_hndl(ke_msg_id_t const msgid,
|
||||
void const *param,
|
||||
ke_task_id_t const dest_id,
|
||||
ke_task_id_t const src_id)
|
||||
{
|
||||
switch(msgid)
|
||||
{
|
||||
case CUSTS1_VAL_WRITE_IND:
|
||||
{
|
||||
/* 写特征值通知. 值已经写入Database中了. */
|
||||
printk("CUSTS1_VAL_WRITE_IND!\n");
|
||||
struct custs1_val_write_ind const *msg_param = (struct custs1_val_write_ind const *)(param);
|
||||
|
||||
switch (msg_param->handle)
|
||||
{
|
||||
case SVC1_IDX_CONTROL_POINT_VAL:
|
||||
user_svc1_ctrl_wr_ind_handler(msgid, msg_param, dest_id, src_id);
|
||||
break;
|
||||
|
||||
case SVC1_IDX_LONG_VALUE_VAL:
|
||||
user_svc1_long_val_wr_ind_handler(msgid, msg_param, dest_id, src_id);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} break;
|
||||
|
||||
case CUSTS1_VAL_NTF_CFM:
|
||||
{
|
||||
/* Notification确认. 请求已经发出. */
|
||||
} break;
|
||||
|
||||
case CUSTS1_VAL_IND_CFM:
|
||||
{
|
||||
/* Indication确认. 请求已经发出. */
|
||||
} break;
|
||||
|
||||
case CUSTS1_ATT_INFO_REQ:
|
||||
{
|
||||
/* 读ATT_INFO请求. 需要返回数据. */
|
||||
printk("CUSTS1_ATT_INFO_REQ!\n");
|
||||
struct custs1_att_info_req const *msg_param = (struct custs1_att_info_req const *)param;
|
||||
|
||||
switch (msg_param->att_idx)
|
||||
{
|
||||
case SVC1_IDX_LONG_VALUE_VAL:
|
||||
user_svc1_long_val_att_info_req_handler(msgid, msg_param, dest_id, src_id);
|
||||
break;
|
||||
|
||||
default:
|
||||
user_svc1_rest_att_info_req_handler(msgid, msg_param, dest_id, src_id);
|
||||
break;
|
||||
}
|
||||
} break;
|
||||
|
||||
case GAPC_PARAM_UPDATED_IND:
|
||||
{
|
||||
// Cast the "param" pointer to the appropriate message structure
|
||||
struct gapc_param_updated_ind const *msg_param = (struct gapc_param_updated_ind const *)(param);
|
||||
printk("GAPC_PARAM_UPDATED_IND!\n");
|
||||
printk(" interval: %d\n", msg_param->con_interval);
|
||||
printk(" latency : %d\n", msg_param->con_latency);
|
||||
printk(" sup_to : %d\n", msg_param->sup_to);
|
||||
|
||||
// Check if updated Conn Params filled to preferred ones
|
||||
if ((msg_param->con_interval >= user_connection_param_conf.intv_min) &&
|
||||
(msg_param->con_interval <= user_connection_param_conf.intv_max) &&
|
||||
(msg_param->con_latency == user_connection_param_conf.latency) &&
|
||||
(msg_param->sup_to == user_connection_param_conf.time_out))
|
||||
{
|
||||
printk(" match!\n");
|
||||
}
|
||||
} break;
|
||||
|
||||
case CUSTS1_VALUE_REQ_IND:
|
||||
{
|
||||
/* 读特征值. 什么时候会有这个事件? */
|
||||
printk("CUSTS1_VALUE_REQ_IND!\n");
|
||||
struct custs1_value_req_ind const *msg_param = (struct custs1_value_req_ind const *) param;
|
||||
|
||||
switch (msg_param->att_idx)
|
||||
{
|
||||
default:
|
||||
{
|
||||
// Send Error message
|
||||
struct custs1_value_req_rsp *rsp = KE_MSG_ALLOC(CUSTS1_VALUE_REQ_RSP,
|
||||
src_id,
|
||||
dest_id,
|
||||
custs1_value_req_rsp);
|
||||
|
||||
// Provide the connection index.
|
||||
rsp->conidx = app_env[msg_param->conidx].conidx;
|
||||
// Provide the attribute index.
|
||||
rsp->att_idx = msg_param->att_idx;
|
||||
// Force current length to zero.
|
||||
rsp->length = 0;
|
||||
// Set Error status
|
||||
rsp->status = ATT_ERR_APP_ERROR;
|
||||
// Send message
|
||||
KE_MSG_SEND(rsp);
|
||||
} break;
|
||||
}
|
||||
} break;
|
||||
|
||||
case GATTC_EVENT_REQ_IND:
|
||||
{
|
||||
// Confirm unhandled indication to avoid GATT timeout
|
||||
struct gattc_event_ind const *ind = (struct gattc_event_ind const *) param;
|
||||
struct gattc_event_cfm *cfm = KE_MSG_ALLOC(GATTC_EVENT_CFM, src_id, dest_id, gattc_event_cfm);
|
||||
cfm->handle = ind->handle;
|
||||
KE_MSG_SEND(cfm);
|
||||
} break;
|
||||
|
||||
case GATTC_MTU_CHANGED_IND:
|
||||
{
|
||||
struct gattc_mtu_changed_ind *ind = (struct gattc_mtu_changed_ind *) param;
|
||||
printk("GATTC_MTU_CHANGED_IND: %d\n", ind->mtu);
|
||||
} break;
|
||||
|
||||
default:
|
||||
{
|
||||
printk("Unhandled msgid=%08x\n", msgid);
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
/// @} APP
|
||||
154
src/user_peripheral.h
Normal file
154
src/user_peripheral.h
Normal file
@@ -0,0 +1,154 @@
|
||||
/**
|
||||
****************************************************************************************
|
||||
*
|
||||
* @file user_peripheral_proj.h
|
||||
*
|
||||
* @brief Peripheral project header file.
|
||||
*
|
||||
* Copyright (C) 2015-2023 Renesas Electronics Corporation and/or its affiliates.
|
||||
* All rights reserved. Confidential Information.
|
||||
*
|
||||
* This software ("Software") is supplied by Renesas Electronics Corporation and/or its
|
||||
* affiliates ("Renesas"). Renesas grants you a personal, non-exclusive, non-transferable,
|
||||
* revocable, non-sub-licensable right and license to use the Software, solely if used in
|
||||
* or together with Renesas products. You may make copies of this Software, provided this
|
||||
* copyright notice and disclaimer ("Notice") is included in all such copies. Renesas
|
||||
* reserves the right to change or discontinue the Software at any time without notice.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS". RENESAS DISCLAIMS ALL WARRANTIES OF ANY KIND,
|
||||
* WHETHER EXPRESS, IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. TO THE
|
||||
* MAXIMUM EXTENT PERMITTED UNDER LAW, IN NO EVENT SHALL RENESAS BE LIABLE FOR ANY DIRECT,
|
||||
* INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING FROM, OUT OF OR IN
|
||||
* CONNECTION WITH THE SOFTWARE, EVEN IF RENESAS HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGES. USE OF THIS SOFTWARE MAY BE SUBJECT TO TERMS AND CONDITIONS CONTAINED IN
|
||||
* AN ADDITIONAL AGREEMENT BETWEEN YOU AND RENESAS. IN CASE OF CONFLICT BETWEEN THE TERMS
|
||||
* OF THIS NOTICE AND ANY SUCH ADDITIONAL LICENSE AGREEMENT, THE TERMS OF THE AGREEMENT
|
||||
* SHALL TAKE PRECEDENCE. BY CONTINUING TO USE THIS SOFTWARE, YOU AGREE TO THE TERMS OF
|
||||
* THIS NOTICE.IF YOU DO NOT AGREE TO THESE TERMS, YOU ARE NOT PERMITTED TO USE THIS
|
||||
* SOFTWARE.
|
||||
*
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
#ifndef _USER_PERIPHERAL_H_
|
||||
#define _USER_PERIPHERAL_H_
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @addtogroup APP
|
||||
* @ingroup RICOW
|
||||
*
|
||||
* @brief
|
||||
*
|
||||
* @{
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
* INCLUDE FILES
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
#include "rwble_config.h"
|
||||
#include "app_task.h" // application task
|
||||
#include "gapc_task.h" // gap functions and messages
|
||||
#include "gapm_task.h" // gap functions and messages
|
||||
#include "app.h" // application definitions
|
||||
#include "co_error.h" // error code definitions
|
||||
#include "arch_wdg.h"
|
||||
|
||||
#include "app_callback.h"
|
||||
#include "app_default_handlers.h"
|
||||
|
||||
|
||||
/*
|
||||
* DEFINES
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
/* Duration of timer for connection parameter update request */
|
||||
#define APP_PARAM_UPDATE_REQUEST_TO (100) // 1000*10ms = 10sec, The maximum allowed value is 41943sec (4194300 * 10ms)
|
||||
|
||||
/* Advertising data update timer */
|
||||
#define APP_ADV_DATA_UPDATE_TO (3000) // 3000*10ms = 30sec, The maximum allowed value is 41943sec (4194300 * 10ms)
|
||||
|
||||
/* Manufacturer specific data constants */
|
||||
#define APP_AD_MSD_COMPANY_ID (0xABCD)
|
||||
#define APP_AD_MSD_COMPANY_ID_LEN (2)
|
||||
#define APP_AD_MSD_DATA_LEN (sizeof(uint16_t))
|
||||
|
||||
#define APP_PERIPHERAL_CTRL_TIMER_DELAY 100
|
||||
|
||||
/*
|
||||
* TYPE DEFINITIONS
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
/*
|
||||
* FUNCTION DECLARATIONS
|
||||
****************************************************************************************
|
||||
*/
|
||||
|
||||
void user_app_on_db_init_complete( void );
|
||||
|
||||
void user_app_before_sleep(void);
|
||||
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief Application initialization function.
|
||||
****************************************************************************************
|
||||
*/
|
||||
void user_app_init(void);
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief Advertising function.
|
||||
****************************************************************************************
|
||||
*/
|
||||
void user_app_adv_start(void);
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief Connection function.
|
||||
* @param[in] connection_idx Connection Id index
|
||||
* @param[in] param Pointer to GAPC_CONNECTION_REQ_IND message
|
||||
****************************************************************************************
|
||||
*/
|
||||
void user_app_connection(uint8_t connection_idx,
|
||||
struct gapc_connection_req_ind const *param);
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief Undirect advertising completion function.
|
||||
* @param[in] status Command complete event message status
|
||||
****************************************************************************************
|
||||
*/
|
||||
void user_app_adv_undirect_complete(uint8_t status);
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief Disconnection function.
|
||||
* @param[in] param Pointer to GAPC_DISCONNECT_IND message
|
||||
****************************************************************************************
|
||||
*/
|
||||
void user_app_disconnect(struct gapc_disconnect_ind const *param);
|
||||
|
||||
/**
|
||||
****************************************************************************************
|
||||
* @brief Handles the messages that are not handled by the SDK internal mechanisms.
|
||||
* @param[in] msgid Id of the message received.
|
||||
* @param[in] param Pointer to the parameters of the message.
|
||||
* @param[in] dest_id ID of the receiving task instance.
|
||||
* @param[in] src_id ID of the sending task instance.
|
||||
****************************************************************************************
|
||||
*/
|
||||
void user_catch_rest_hndl(ke_msg_id_t const msgid,
|
||||
void const *param,
|
||||
ke_task_id_t const dest_id,
|
||||
ke_task_id_t const src_id);
|
||||
|
||||
/// @} APP
|
||||
|
||||
#endif // _USER_PERIPHERAL_H_
|
||||
64
weble/log.js
Normal file
64
weble/log.js
Normal file
@@ -0,0 +1,64 @@
|
||||
// 创建日志容器与清除按钮
|
||||
const logDiv = document.createElement("div");
|
||||
logDiv.id = "fixed-log-window";
|
||||
document.body.appendChild(logDiv);
|
||||
|
||||
// 添加清除按钮
|
||||
const clearBtn = document.createElement("button");
|
||||
clearBtn.textContent = "清空日志";
|
||||
clearBtn.className = "clear-log-btn";
|
||||
logDiv.appendChild(clearBtn);
|
||||
|
||||
// 按钮点击事件
|
||||
clearBtn.onclick = () => {
|
||||
logDiv.querySelectorAll(".log-entry").forEach(entry => entry.remove());
|
||||
};
|
||||
|
||||
// 覆盖 console.log(保持原有功能)
|
||||
const originalLog = console.log;
|
||||
console.log = function(...args) {
|
||||
originalLog(...args);
|
||||
const logLine = document.createElement("div");
|
||||
logLine.className = "log-entry";
|
||||
logLine.textContent = args.join(" ");
|
||||
logDiv.appendChild(logLine);
|
||||
logDiv.scrollTop = logDiv.scrollHeight; // 自动滚动
|
||||
};
|
||||
|
||||
// 样式增强
|
||||
const style = document.createElement("style");
|
||||
style.textContent = `
|
||||
#fixed-log-window {
|
||||
/* 原有样式保持不变 */
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 200px;
|
||||
background: rgba(0, 0, 0, 0.85);
|
||||
color: #fff;
|
||||
overflow-y: auto;
|
||||
padding: 40px 10px 10px; /* 顶部留出按钮空间 */
|
||||
font-family: monospace;
|
||||
}
|
||||
.clear-log-btn {
|
||||
position: fixed;
|
||||
right: 20px;
|
||||
bottom: 215px;
|
||||
padding: 4px 12px;
|
||||
background: #ff4444;
|
||||
border: none;
|
||||
color: white;
|
||||
cursor: pointer;
|
||||
border-radius: 3px;
|
||||
}
|
||||
.clear-log-btn:hover {
|
||||
background: #cc0000;
|
||||
}
|
||||
.log-entry {
|
||||
padding: 4px 0;
|
||||
border-bottom: 1px solid rgba(255,255,255,0.1);
|
||||
}
|
||||
`;
|
||||
document.head.appendChild(style);
|
||||
|
||||
130
weble/weble.html
Normal file
130
weble/weble.html
Normal file
@@ -0,0 +1,130 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Web Bluetooth Example</title>
|
||||
</head>
|
||||
<body>
|
||||
<button id="connect-button">连接</button>
|
||||
<div id="device_name"></div>
|
||||
<div id="current_voltage"></div>
|
||||
<div id="current_time"></div>
|
||||
<div id="system_time"></div>
|
||||
|
||||
<script src="log.js"></script>
|
||||
|
||||
<script>
|
||||
var connected = false;
|
||||
var device = null;
|
||||
|
||||
function formatTime(year, month, mday, hour, min, sec) {
|
||||
month += 1;
|
||||
if(month<10) month = '0'+month;
|
||||
if(mday<10) mday = '0'+mday;
|
||||
if(hour<10) hour = '0'+hour;
|
||||
if(min<10) min = '0'+min;
|
||||
if(sec<10) sec = '0'+sec;
|
||||
return year+"-"+month+"-"+mday+" "+hour+":"+min+":"+sec+" ";
|
||||
}
|
||||
|
||||
function onClick() {
|
||||
if(connected) {
|
||||
disconnect();
|
||||
}else{
|
||||
connectToDevice();
|
||||
}
|
||||
}
|
||||
|
||||
async function connectToDevice() {
|
||||
try {
|
||||
console.log('请求设备...');
|
||||
device = await navigator.bluetooth.requestDevice({
|
||||
filters: [{ namePrefix: "DLG"}]
|
||||
, optionalServices: ['18424398-7cbc-11e9-8f9e-2a86e4085a59']
|
||||
});
|
||||
console.log('device: ', device.name);
|
||||
document.getElementById('device_name').textContent = "设备名: "+device.name;
|
||||
device.ongattserverdisconnected = onDisconnect;
|
||||
|
||||
var server = await device.gatt.connect();
|
||||
console.log('设备已连接!');
|
||||
|
||||
var service = await server.getPrimaryService('18424398-7cbc-11e9-8f9e-2a86e4085a59');
|
||||
console.log('获得service: ', service.uuid);
|
||||
|
||||
var ctrlPoint = await service.getCharacteristic('2d86686a-53dc-25b3-0c4a-f0e10c8dee20');
|
||||
var adc1Value = await service.getCharacteristic('15005991-b131-3396-014c-664c9867b917');
|
||||
var longValue = await service.getCharacteristic('772ae377-b3d2-4f8e-4042-5481d1e0098c');
|
||||
|
||||
cur_voltage = await adc1Value.readValue();
|
||||
console.log('cur_voltage:', cur_voltage);
|
||||
document.getElementById('current_voltage').textContent = "当前电压: "+cur_voltage.getUint16(0, true);
|
||||
|
||||
var year, month, mday, wday, hour, minute, second;
|
||||
cur_time = await longValue.readValue();
|
||||
year = cur_time.getUint16(0, true);
|
||||
month = cur_time.getUint8(2);
|
||||
mday = cur_time.getUint8(3);
|
||||
hour = cur_time.getUint8(4);
|
||||
minute = cur_time.getUint8(5);
|
||||
second = cur_time.getUint8(6);
|
||||
|
||||
document.getElementById('current_time').textContent = "当前时间: "+formatTime(year, month, mday, hour, minute, second);
|
||||
|
||||
var buf = new Uint8Array(10);
|
||||
var today = new Date();
|
||||
year = today.getFullYear();
|
||||
month = today.getMonth();
|
||||
mday = today.getDate();
|
||||
wday = today.getDay();
|
||||
hour = today.getHours();
|
||||
minute = today.getMinutes();
|
||||
second = today.getSeconds();
|
||||
console.log('today:',today);
|
||||
buf[0] = 0x91;
|
||||
buf[1] = year%256;
|
||||
buf[2] = year/256;
|
||||
buf[3] = month;
|
||||
buf[4] = mday;
|
||||
buf[5] = hour;
|
||||
buf[6] = minute;
|
||||
buf[7] = second;
|
||||
buf[8] = wday;
|
||||
buf[9] = 0;
|
||||
await longValue.writeValue(buf);
|
||||
|
||||
document.getElementById('system_time').textContent = "系统时间: "+formatTime(year, month, mday, hour, minute, second);
|
||||
|
||||
connected = true;
|
||||
document.getElementById('connect-button').textContent = "断开";
|
||||
|
||||
console.log('同步时间成功!');
|
||||
} catch (error) {
|
||||
console.log('连接失败:', error);
|
||||
disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
function disconnect() {
|
||||
if(!device)
|
||||
return;
|
||||
if(device.gatt.connected){
|
||||
device.gatt.disconnect();
|
||||
}
|
||||
onDisconnect();
|
||||
}
|
||||
|
||||
function onDisconnect() {
|
||||
device = null;
|
||||
console.log('设备已断开连接');
|
||||
connected = false;
|
||||
document.getElementById('connect-button').textContent = "连接";
|
||||
}
|
||||
|
||||
document.getElementById('connect-button').addEventListener('click', onClick);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user