mirror of
https://github.com/sengeiou/realtek_ameba_mp_sdk.git
synced 2026-03-21 10:04:50 +00:00
ameba micropython sdk first commit
This commit is contained in:
commit
8508ee6139
5619 changed files with 1874619 additions and 0 deletions
41
sdk/component/common/drivers/modules/MFi_auth.h
Normal file
41
sdk/component/common/drivers/modules/MFi_auth.h
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
//==========================================================================
|
||||
//
|
||||
// tmp75.h
|
||||
//
|
||||
// tmp75/175 temperature sensor driver using i2c for STM32 CortexM processors
|
||||
//
|
||||
//==========================================================================
|
||||
// #####DESCRIPTIONBEGIN####
|
||||
//
|
||||
// Author(s): Cloud Tseng
|
||||
// Contributors:
|
||||
// Date: 2013-11-07
|
||||
// Description: Temperature sensor driver using i2c for STM32 CortexM processors
|
||||
//
|
||||
// ####DESCRIPTIONEND####
|
||||
//
|
||||
//==========================================================================
|
||||
#ifndef __MFI_I2C_H__
|
||||
#define __MFI_I2C_H__
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define kMFiAuthReg_ProtocolMajorVersion 0x02
|
||||
#define kMFiAuthReg_ErrorCode 0x05
|
||||
#define kMFiAuthReg_AuthControlStatus 0x10
|
||||
#define kMFiAuthErr_Flag 0x80
|
||||
#define kMFiAuthControl_GenerateSignature 0x01
|
||||
#define kMFiAuthReg_SignatureSize 0x11
|
||||
#define kMFiAuthReg_SignatureData 0x12
|
||||
#define kMFiAuthReg_ChallengeSize 0x20
|
||||
#define kMFiAuthReg_ChallengeData 0x21
|
||||
#define kMFiAuthReg_DeviceCertificateSize 0x30
|
||||
#define kMFiAuthReg_DeviceCertificateData1 0x31 // Note: auto-increments so next read is Data2, Data3, etc.
|
||||
|
||||
uint16_t MFi_i2c_tx(uint8_t reg, const uint8_t* buf, uint16_t count, uint8_t retry);
|
||||
uint16_t MFi_i2c_rx(uint8_t reg, uint8_t* buf, uint16_t count, uint8_t retry);
|
||||
int MFi_auth_io(uint8_t reg, const uint8_t *write_buf, uint16_t write_count, uint8_t *read_buf, uint16_t read_count, uint8_t retry_count);
|
||||
void MFi_auth_init(void);
|
||||
void MFi_auth_deinit(void);
|
||||
|
||||
#endif //__MFI_I2C_H__
|
||||
18
sdk/component/common/drivers/modules/pir_74hc00.h
Normal file
18
sdk/component/common/drivers/modules/pir_74hc00.h
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
#ifndef __PIR_H__
|
||||
#define __PIR_H__
|
||||
|
||||
#define PIR_IRQHandler EXTI1_IRQHandler
|
||||
#define PIR_INT_GPIO_CLK RCC_AHB1Periph_GPIOB
|
||||
#define PIR_INT_PIN GPIO_Pin_1
|
||||
#define PIR_INT_GPIO_PORT GPIOB
|
||||
#define PIR_INT_EXT_PORT_SRC EXTI_PortSourceGPIOB
|
||||
#define PIR_INT_EXT_PIN_SRC EXTI_PinSource1
|
||||
#define PIR_INT_EXT_LINE EXTI_Line1
|
||||
#define PIR_INT_EXT_IRQ EXTI1_IRQn
|
||||
|
||||
void pir_isr(void);
|
||||
int pir_init_flag(int *state);
|
||||
int pir_init_callback(void (* pir_callback)(void));
|
||||
void pir_exit(void);
|
||||
|
||||
#endif // __PIR_H__
|
||||
37
sdk/component/common/drivers/modules/rgb_led.h
Normal file
37
sdk/component/common/drivers/modules/rgb_led.h
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
#ifndef __RGB_LED_H__
|
||||
#define __RGB_LED_H__
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
// R: PA6(TIM3_CH1) , G: PA7(TIM3_CH2) , B: PB0(TIM3_CH3)
|
||||
#define TIMER TIM3
|
||||
|
||||
#define R_PIN GPIO_Pin_6
|
||||
#define R_PORT GPIOA
|
||||
#define R_CLK RCC_AHB1Periph_GPIOA
|
||||
#define R_TCLK RCC_APB1Periph_TIM3
|
||||
#define R_AF GPIO_AF_TIM3
|
||||
#define R_AF_P GPIO_PinSource6
|
||||
|
||||
#define G_PIN GPIO_Pin_7
|
||||
#define G_PORT GPIOA
|
||||
#define G_CLK RCC_AHB1Periph_GPIOA
|
||||
#define G_TCLK RCC_APB1Periph_TIM3
|
||||
#define G_AF GPIO_AF_TIM3
|
||||
#define G_AF_P GPIO_PinSource7
|
||||
|
||||
#define B_PIN GPIO_Pin_0
|
||||
#define B_PORT GPIOB
|
||||
#define B_CLK RCC_AHB1Periph_GPIOB
|
||||
#define B_TCLK RCC_APB1Periph_TIM3
|
||||
#define B_AF GPIO_AF_TIM3
|
||||
#define B_AF_P GPIO_PinSource0
|
||||
|
||||
void led_init(void);
|
||||
void led_set_color(uint8_t r, uint8_t g, uint8_t b);
|
||||
void led_gradient_mode_thread(void *param);
|
||||
void led_pinky_mode_thread(void *param);
|
||||
void led_christmas_mode_thread(void *param);
|
||||
void led_warning_mode_thread(void *param);
|
||||
|
||||
#endif // __RGB_LED_H__
|
||||
49
sdk/component/common/drivers/modules/tmp75.h
Normal file
49
sdk/component/common/drivers/modules/tmp75.h
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
//==========================================================================
|
||||
//
|
||||
// tmp75.h
|
||||
//
|
||||
// tmp75/175 temperature sensor driver using i2c for STM32 CortexM processors
|
||||
//
|
||||
//==========================================================================
|
||||
// #####DESCRIPTIONBEGIN####
|
||||
//
|
||||
// Author(s): Cloud Tseng
|
||||
// Contributors:
|
||||
// Date: 2013-11-07
|
||||
// Description: Temperature sensor driver using i2c for STM32 CortexM processors
|
||||
//
|
||||
// ####DESCRIPTIONEND####
|
||||
//
|
||||
//==========================================================================
|
||||
#ifndef __TMP75_H__
|
||||
#define __TMP75_H__
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#define SHUTDOWN_MODE_OFF 0x00
|
||||
#define SHUTDOWN_MODE_ON 0x01
|
||||
#define COMPARATOR_MODE 0x00
|
||||
#define INTERRUPT_MODE 0x02
|
||||
#define POLARITY_0 0x00
|
||||
#define POLARITY_1 0x04
|
||||
#define FAULT_QUEUE_1 0x00
|
||||
#define FAULT_QUEUE_2 0x08
|
||||
#define FAULT_QUEUE_4 0x10
|
||||
#define FAULT_QUEUE_6 0x18
|
||||
#define RESOLUTION_9 0x00
|
||||
#define RESOLUTION_10 0x20
|
||||
#define RESOLUTION_11 0x40
|
||||
#define RESOLUTION_12 0x60
|
||||
#define ONE_SHOT 0x80
|
||||
|
||||
void tmp75_set_temperature_low(float value);
|
||||
float tmp75_get_temperature_low(void);
|
||||
void tmp75_set_temperature_high(float value);
|
||||
float tmp75_get_temperature_high(void);
|
||||
float tmp75_get_temperature(void);
|
||||
void tmp75_set_config(uint8_t config);
|
||||
uint8_t tmp75_get_config(void);
|
||||
void tmp75_start_single_conversion(void);
|
||||
void tmp75_init(void);
|
||||
|
||||
#endif //__TMP75_H__
|
||||
Loading…
Add table
Add a link
Reference in a new issue