This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pragma once | |
#include <tuple> | |
using std::tuple; | |
using std::make_tuple; | |
template<typename T, int m, int n> | |
class DenseMatrix | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// IT handlers | |
void UART_Handler(void) | |
{ | |
uint32_t status = UART->UART_SR; | |
//Did we receive new byte? | |
if ((status & UART_SR_RXRDY) == UART_SR_RXRDY) | |
{ | |
//Read new byte from UART_RHR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
while (1) | |
{ | |
//Если получили очередной байт из UART - прочитаем его в переменную received_data | |
if ((UART->UART_SR & UART_SR_RXRDY) == UART_SR_RXRDY ) | |
{ | |
uint32_t received_data = UART->UART_RHR; | |
... | |
} | |
//Если готовы отправить очередной байт (зранится в data_to_transmit) через UART - запишем в регистр UART_THR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
while (1) | |
{ | |
//Если получили очередной байт из UART - прочитаем его в переменную received_data | |
if ((UART->UART_SR & UART_SR_RXRDY) == UART_SR_RXRDY ) | |
{ | |
uint32_t received_data = UART->UART_RHR; | |
... | |
} | |
//Если готовы отправить очередной байт (зранится в data_to_transmit) через UART - запишем в регистр UART_THR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void setupUART() | |
{ | |
PIO_Configure(PIOA, PIO_PERIPH_A,PIO_PA8A_URXD|PIO_PA9A_UTXD, PIO_DEFAULT); | |
/* Enable the pull up on the Rx and Tx pin */ | |
PIOA->PIO_PUER = PIO_PA8A_URXD | PIO_PA9A_UTXD; | |
/*Включаем UART, подавая на него тактирование*/ | |
pmc_enable_periph_clk(ID_UART); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
typedef struct { | |
WoReg US_CR; /**< \brief (Usart Offset: 0x0000) Control Register */ | |
RwReg US_MR; /**< \brief (Usart Offset: 0x0004) Mode Register */ | |
WoReg US_IER; /**< \brief (Usart Offset: 0x0008) Interrupt Enable Register */ | |
WoReg US_IDR; /**< \brief (Usart Offset: 0x000C) Interrupt Disable Register */ | |
RoReg US_IMR; /**< \brief (Usart Offset: 0x0010) Interrupt Mask Register */ | |
RoReg US_CSR; /**< \brief (Usart Offset: 0x0014) Channel Status Register */ | |
RoReg US_RHR; /**< \brief (Usart Offset: 0x0018) Receiver Holding Register */ | |
WoReg US_THR; /**< \brief (Usart Offset: 0x001C) Transmitter Holding Register */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
typedef struct { | |
WoReg UART_CR; /**< \brief (Uart Offset: 0x0000) Control Register */ | |
RwReg UART_MR; /**< \brief (Uart Offset: 0x0004) Mode Register */ | |
WoReg UART_IER; /**< \brief (Uart Offset: 0x0008) Interrupt Enable Register */ | |
WoReg UART_IDR; /**< \brief (Uart Offset: 0x000C) Interrupt Disable Register */ | |
RoReg UART_IMR; /**< \brief (Uart Offset: 0x0010) Interrupt Mask Register */ | |
RoReg UART_SR; /**< \brief (Uart Offset: 0x0014) Status Register */ | |
RoReg UART_RHR; /**< \brief (Uart Offset: 0x0018) Receive Holding Register */ | |
WoReg UART_THR; /**< \brief (Uart Offset: 0x001C) Transmit Holding Register */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "due_sam3x.init.h" | |
int main(void) | |
{ | |
/* The general init (clock, libc, watchdog disable) */ | |
init_controller(); | |
PIO_Configure(PIOB, PIO_OUTPUT_1, PIO_PB27, PIO_DEFAULT); | |
while(1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'image' | |
function ElasticTransform(img, alpha, sigma) | |
--[[ | |
Parameters | |
---------- | |
img: Tensor of size KxHxW | |
Image on which elastic transformation have to be applied | |
alpha: number | |
Intensity of the transformation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
glm::mat4 MVP = Projection * View * mechanicalModel.getOrientation() * glm::scale(glm::mat4(1.0f), vec3(1.0, 1.73, 2.24)); |
NewerOlder