Import of the watch repository from Pebble

This commit is contained in:
Matthieu Jeanson 2024-12-12 16:43:03 -08:00 committed by Katharine Berry
commit 3b92768480
10334 changed files with 2564465 additions and 0 deletions

View file

@ -0,0 +1,151 @@
/* Copyright 2015 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* Copyright (C) 2014 -2016 Espressif System
*
*/
#ifndef __ESP82666_GPIO_H__
#define __ESP82666_GPIO_H__
#define GPIO_Pin_0 (BIT(0)) /* Pin 0 selected */
#define GPIO_Pin_1 (BIT(1)) /* Pin 1 selected */
#define GPIO_Pin_2 (BIT(2)) /* Pin 2 selected */
#define GPIO_Pin_3 (BIT(3)) /* Pin 3 selected */
#define GPIO_Pin_4 (BIT(4)) /* Pin 4 selected */
#define GPIO_Pin_5 (BIT(5)) /* Pin 5 selected */
#define GPIO_Pin_6 (BIT(6)) /* Pin 6 selected */
#define GPIO_Pin_7 (BIT(7)) /* Pin 7 selected */
#define GPIO_Pin_8 (BIT(8)) /* Pin 8 selected */
#define GPIO_Pin_9 (BIT(9)) /* Pin 9 selected */
#define GPIO_Pin_10 (BIT(10)) /* Pin 10 selected */
#define GPIO_Pin_11 (BIT(11)) /* Pin 11 selected */
#define GPIO_Pin_12 (BIT(12)) /* Pin 12 selected */
#define GPIO_Pin_13 (BIT(13)) /* Pin 13 selected */
#define GPIO_Pin_14 (BIT(14)) /* Pin 14 selected */
#define GPIO_Pin_15 (BIT(15)) /* Pin 15 selected */
#define GPIO_Pin_All (0xFFFF) /* All pins selected */
#define GPIO_PIN_REG_0 PERIPHS_IO_MUX_GPIO0_U
#define GPIO_PIN_REG_1 PERIPHS_IO_MUX_U0TXD_U
#define GPIO_PIN_REG_2 PERIPHS_IO_MUX_GPIO2_U
#define GPIO_PIN_REG_3 PERIPHS_IO_MUX_U0RXD_U
#define GPIO_PIN_REG_4 PERIPHS_IO_MUX_GPIO4_U
#define GPIO_PIN_REG_5 PERIPHS_IO_MUX_GPIO5_U
#define GPIO_PIN_REG_6 PERIPHS_IO_MUX_SD_CLK_U
#define GPIO_PIN_REG_7 PERIPHS_IO_MUX_SD_DATA0_U
#define GPIO_PIN_REG_8 PERIPHS_IO_MUX_SD_DATA1_U
#define GPIO_PIN_REG_9 PERIPHS_IO_MUX_SD_DATA2_U
#define GPIO_PIN_REG_10 PERIPHS_IO_MUX_SD_DATA3_U
#define GPIO_PIN_REG_11 PERIPHS_IO_MUX_SD_CMD_U
#define GPIO_PIN_REG_12 PERIPHS_IO_MUX_MTDI_U
#define GPIO_PIN_REG_13 PERIPHS_IO_MUX_MTCK_U
#define GPIO_PIN_REG_14 PERIPHS_IO_MUX_MTMS_U
#define GPIO_PIN_REG_15 PERIPHS_IO_MUX_MTDO_U
#define GPIO_PIN_REG(i) \
(i==0) ? GPIO_PIN_REG_0: \
(i==1) ? GPIO_PIN_REG_1: \
(i==2) ? GPIO_PIN_REG_2: \
(i==3) ? GPIO_PIN_REG_3: \
(i==4) ? GPIO_PIN_REG_4: \
(i==5) ? GPIO_PIN_REG_5: \
(i==6) ? GPIO_PIN_REG_6: \
(i==7) ? GPIO_PIN_REG_7: \
(i==8) ? GPIO_PIN_REG_8: \
(i==9) ? GPIO_PIN_REG_9: \
(i==10)? GPIO_PIN_REG_10: \
(i==11)? GPIO_PIN_REG_11: \
(i==12)? GPIO_PIN_REG_12: \
(i==13)? GPIO_PIN_REG_13: \
(i==14)? GPIO_PIN_REG_14: \
GPIO_PIN_REG_15
#define GPIO_PIN_ADDR(i) (GPIO_PIN0_ADDRESS + i*4)
#define GPIO_ID_IS_PIN_REGISTER(reg_id) ((reg_id >= GPIO_ID_PIN0) && (reg_id <= GPIO_ID_PIN(GPIO_PIN_COUNT-1)))
#define GPIO_REGID_TO_PINIDX(reg_id) ((reg_id) - GPIO_ID_PIN0)
typedef enum
{
GPIO_PIN_INTR_DISABLE = 0,
GPIO_PIN_INTR_POSEDGE = 1,
GPIO_PIN_INTR_NEGEDGE = 2,
GPIO_PIN_INTR_ANYEGDE = 3,
GPIO_PIN_INTR_LOLEVEL = 4,
GPIO_PIN_INTR_HILEVEL = 5
} GPIO_INT_TYPE;
typedef enum
{
GPIO_Mode_Input = 0x0,
GPIO_Mode_Out_OD,
GPIO_Mode_Output ,
GPIO_Mode_Sigma_Delta
} GPIOMode_TypeDef;
typedef enum
{
GPIO_PullUp_DIS = 0x0,
GPIO_PullUp_EN = 0x1
} GPIO_Pullup_IF;
typedef struct
{
uint16 GPIO_Pin;
GPIOMode_TypeDef GPIO_Mode;
GPIO_Pullup_IF GPIO_Pullup;
GPIO_INT_TYPE GPIO_IntrType;
} GPIO_ConfigTypeDef;
#define GPIO_OUTPUT_SET(gpio_no, bit_value) gpio_output_conf (bit_value<<gpio_no, \
((~bit_value)&0x01)<<gpio_no, 1<<gpio_no, 0)
#define GPIO_OUTPUT(gpio_bits, bit_value) do { \
if (bit_value) { gpio_output_conf (gpio_bits, 0, gpio_bits, 0); } \
else { gpio_output_conf(0, gpio_bits, gpio_bits, 0); } \
} while (0)
#define GPIO_DIS_OUTPUT(gpio_no) gpio_output_conf (0, 0, 0, 1 << gpio_no)
#define GPIO_AS_INPUT(gpio_bits) gpio_output_conf (0, 0, 0, gpio_bits)
#define GPIO_AS_OUTPUT(gpio_bits) gpio_output_conf (0, 0, gpio_bits, 0)
#define GPIO_INPUT_GET(gpio_no) ((gpio_input_get () >> gpio_no)&BIT0)
#ifdef __cplusplus
extern "C" {
#endif
void gpio16_output_conf (void);
void gpio16_output_set (uint8 value);
void gpio16_input_conf (void);
uint8 gpio16_input_get (void);
void gpio_output_conf (uint32 set_mask, uint32 clear_mask, uint32 enable_mask, uint32 disable_mask);
void gpio_intr_handler_register (void *fn);
void gpio_pin_wakeup_enable (uint32 i, GPIO_INT_TYPE intr_state);
void gpio_pin_wakeup_disable ();
void gpio_pin_intr_state_set (uint32 i, GPIO_INT_TYPE intr_state);
uint32 gpio_input_get (void);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,48 @@
/* Copyright 2015 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* Copyright (C) 2014 -2016 Espressif System
*
*/
#ifndef __ESP8266_UART_H__
#define __ESP8266_UART_H__
typedef enum {
UART0 = 0x0,
UART1 = 0x1,
} UART_Port;
typedef enum {
BIT_RATE_300 = 300,
BIT_RATE_600 = 600,
BIT_RATE_1200 = 1200,
BIT_RATE_2400 = 2400,
BIT_RATE_4800 = 4800,
BIT_RATE_9600 = 9600,
BIT_RATE_19200 = 19200,
BIT_RATE_38400 = 38400,
BIT_RATE_57600 = 57600,
BIT_RATE_74880 = 74880,
BIT_RATE_115200 = 115200,
BIT_RATE_230400 = 230400,
BIT_RATE_460800 = 460800,
BIT_RATE_921600 = 921600,
BIT_RATE_1843200 = 1843200,
BIT_RATE_3686400 = 3686400,
} UART_BautRate;
#endif

View file

@ -0,0 +1,35 @@
/* Copyright 2015 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef __JERRY_EXTAPI_H__
#define __JERRY_EXTAPI_H__
#define JERRY_STANDALONE_EXIT_CODE_OK (0)
#define JERRY_STANDALONE_EXIT_CODE_FAIL (1)
#ifdef __cplusplus
extern "C" {
#endif
void js_register_functions (void);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,34 @@
/* Copyright 2015 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef __JERRY_RUN_H__
#define __JERRY_RUN_H__
#ifdef __cplusplus
extern "C" {
#endif
int js_entry (const char *source_p, const size_t source_size);
int js_eval (const char *source_p, const size_t source_size);
int js_loop (uint32_t ticknow);
void js_exit (void);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,33 @@
/* Copyright 2015 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef __NATIVE_ESP8266_H__
#define __NATIVE_ESP8266_H__
#ifdef __cplusplus
extern "C" {
#endif
void native_gpio_dir (int, int);
void native_gpio_set (int, int);
int native_gpio_get (int);
#ifdef __cplusplus
}
#endif
#endif

View file

@ -0,0 +1,24 @@
/* Copyright 2015 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef __USER_CONFIG_H__
#define __USER_CONFIG_H__
/* number of stack items, x4 for bytes */
#define JERRY_STACK_SIZE 2000
#endif