'잡동사니'에 해당되는 글 13968건

  1. 2025.11.12 rust 비트 구조체
  2. 2025.11.11 stm32 리셋없이 디버그 붙이기
  3. 2025.11.11 gdb attach
  4. 2025.11.11 rust 참조와 대여
  5. 2025.11.10 눈떠보니
  6. 2025.11.10 영포티 단상
  7. 2025.11.09 흑우 음뭬~
  8. 2025.11.08 부활 쿨타임
  9. 2025.11.07 wacom 2k pen
  10. 2025.11.07 wacom CTL-480 구매 도착!
Programming/rust2025. 11. 12. 09:24

golang에서는 비트 구조체 안되던것 같은데 러스트에서는 된다고 하니 관심이 증가중 ㅋㅋ

머 리눅스 커널에서도 쓰려고 하는데 설마 없겠어? 싶기도 하네

 

use bit_struct::*; 

enums! {
    // 2 bits, i.e., 0b00, 0b01, 0b10
    pub HouseKind { Urban, Suburban, Rural}
}

bit_struct! {
    // u8 is the base storage type. This can be any multiple of 8
    pub struct HouseConfig(u8) {
        // 2 bits
        kind: HouseKind,
        
        // two's compliment 3-bit signed number
        lowest_floor: i3,
        
        // 2 bit unsigned number
        highest_floor: u2,
    }
}

// We can create a new `HouseConfig` like such:
// where all numbers are statically checked to be in bounds.
let config = HouseConfig::new(HouseKind::Suburban, i3!(-2), u2!(1));

// We can get the raw `u8` which represents `config`:
let raw: u8 = config.raw();
assert_eq!(114_u8, raw);

// or we can get a `HouseConfig` from a `u8` like:
let mut config: HouseConfig = HouseConfig::try_from(114_u8).unwrap();
assert_eq!(config, HouseConfig::new(HouseKind::Suburban, i3!(-2), u2!(1)));
// We need to unwrap because `HouseConfig` is not valid for all numbers. For instance, if the
// most significant bits are `0b11`, it encodes an invalid `HouseKind`. However, 
// if all elements of a struct are always valid (suppose we removed the `kind` field), the struct will
// auto implement a trait which allows calling the non-panicking:
// let config: HouseConfig = HouseConfig::exact_from(123_u8);

// We can access values of `config` like so:
let kind: HouseKind = config.kind().get();

// And we can set values like so:
config.lowest_floor().set(i3!(0));

// We can also convert the new numeric types for alternate bit-widths into the 
// numeric types provided by the standard library:
let lowest_floor: i3 = config.lowest_floor().get();
let lowest_floor_std: i8 = lowest_floor.value();
assert_eq!(lowest_floor_std, 0_i8);

[링크 : https://docs.rs/bit-struct/latest/bit_struct/]

'Programming > rust' 카테고리의 다른 글

rust 참조와 대여  (0) 2025.11.11
rust mut 외 몇가지 컴파일 에러들  (0) 2023.05.26
rust mut  (0) 2023.05.25
rust visibility and privacy  (0) 2023.05.25
rust 소유권  (0) 2023.05.25
Posted by 구차니
embeded/Cortex-M3 STM2025. 11. 11. 19:41

오오.. 신세계!

 

reset 작동을 바꾸어주어야 하고

 

그 다음에는 프로그램을 업로드 하지 않도록 해주어야 한다.

[링크 : https://community.st.com/t5/stm32-mcus-boards-and-hardware/how-do-i-avoid-triggering-a-reset-when-connecting-my-stlink-v2-1/td-p/72802]

'embeded > Cortex-M3 STM' 카테고리의 다른 글

stn32f103 usb cdc(communication device class) , vcp?  (0) 2025.11.19
stm32f103 도착  (0) 2025.11.19
stm32 adc + dma.. part 2?  (0) 2025.10.29
stm32 부트로더로 부팅 전환하기  (0) 2025.10.21
EEPROM emulation for stm32  (0) 2025.10.16
Posted by 구차니

stm32도 붙이는데 리눅스에서도 작동중인 녀석을 디버그 할 수 있나 찾는데

그냥 pid 옵션주면 된다고

 

12년전 글이라서 한번 해봐야겠다.

-p는 gdb 옵션

attach 는 gdb 인터프리터내 명령어

gdb -p 12271
gdb /path/to/exe 12271

gdb /path/to/exe
(gdb) attach 12271

[링크 : https://stackoverflow.com/questions/14370972/how-to-attach-a-process-in-gdb]

   [링크 : https://kukuta.tistory.com/202]

'프로그램 사용 > gdb & insight' 카테고리의 다른 글

gdb 사용법  (0) 2026.01.16
gdbserver taget  (0) 2023.07.19
gdb conditional break  (0) 2023.07.19
gdb 디버깅 타겟을 인자와 함께 실행하기  (0) 2022.10.17
gdb break  (0) 2021.04.09
Posted by 구차니
Programming/rust2025. 11. 11. 19:29

소유권은 하나만 가지지만, 참조는 소유권이 아니라서 볼수는 있다고

그렇다면.. 공유메모리 처럼 서로 쓰고 지우게 할 수는 없고 무조건 매니저를 거쳐서 하는 구조로 가야하나?

 

[링크 : https://doc.rust-kr.org/ch04-02-references-and-borrowing.html]

'Programming > rust' 카테고리의 다른 글

rust 비트 구조체  (0) 2025.11.12
rust mut 외 몇가지 컴파일 에러들  (0) 2023.05.26
rust mut  (0) 2023.05.25
rust visibility and privacy  (0) 2023.05.25
rust 소유권  (0) 2023.05.25
Posted by 구차니

용산출발.. 후..

 

오랫마에 지각이 예정되었습니다 두둥!

'개소리 왈왈 > 직딩의 비애' 카테고리의 다른 글

피곤  (0) 2025.11.21
오늘따...라 엄청 피곤하고 추움  (0) 2025.11.17
부활 쿨타임  (0) 2025.11.08
mt 아우빡세  (0) 2025.11.06
MT 전날  (0) 2025.11.05
Posted by 구차니

40이라 긁히는건가 싶기도 하고 ㅋㅋㅋ

아무튼 개인적인 생각에는 그 망할(?) 50으로 더 올려줘야 하지 않나 싶기도 하고.. (응?)

 

[링크 : https://www.joongang.co.kr/article/25380508]

[링크 : https://weekly.khan.co.kr/article/202511030600001]

'개소리 왈왈 > 정치관련 신세한탄' 카테고리의 다른 글

혼돈 파괴 카오스(?)의 미국  (0) 2026.01.20
패권주의의 부활?  (0) 2026.01.04
은행 이자는 점점 떨어지네  (0) 2025.09.17
콜래트럴 데미지  (0) 2025.06.03
전장련 시위 시작  (0) 2025.04.21
Posted by 구차니

skt 털려서 기간도 되었고

kt 알뜰폰으로 갔더니 여긴 이미 털려있었고 아닌척을 넘어 은폐까지 시도하고

skt 털리니 kt는 안전해요 하고 광고까지.. 하

 

KT 무단 결제 사태를 조사해온 민관합동조사단이 발견한 것은 KT가 지난해 외부 침입 사실을 확인하고도 은폐한 정황이었습니다.
악성코드를 발견하면 3일 이내에 당국에 신고해야 하지만, KT는 신고는커녕 감염 흔적까지 숨기려다가 꼬리가 잡혔습니다.

[링크 : https://www.youtube.com/watch?v=ZgkvL8daenA]

Posted by 구차니

병원간 거 빼고는 계속 잠만 자게되네

'개소리 왈왈 > 직딩의 비애' 카테고리의 다른 글

오늘따...라 엄청 피곤하고 추움  (0) 2025.11.17
눈떠보니  (0) 2025.11.10
mt 아우빡세  (0) 2025.11.06
MT 전날  (0) 2025.11.05
회복모드  (0) 2025.11.01
Posted by 구차니
하드웨어/pen tablet2025. 11. 7. 23:02

one by wacom에 쓰려고 당근에서 만원에 구매, 편의점 택배로 받음

 

해보니 잘 된다. CTH-490은 출타중이라 비교는 안해봤는데

이전 기억으로는 기본 펜과 동일한 녀석인 듯. 필압은 모르겠다 

l

'하드웨어 > pen tablet' 카테고리의 다른 글

wacom CTL-480 구매 도착!  (0) 2025.11.07
CTL-472 one by wacom 도착  (0) 2025.09.14
xsetwacom with intuos pen & touch tablet  (0) 2025.09.10
cth-490 on ubuntu  (0) 2025.09.08
와콤 cth-490 지름  (2) 2025.09.06
Posted by 구차니
하드웨어/pen tablet2025. 11. 7. 22:54

당근에서 편의점 택배로 진행

만원에 원래 본체 + 펜 추가 였으나 펜 추가가 사라졌다지만 그래도 싸니까 일단 구매!

 

윈도우에서 꽂으니 너무 구형제품이라 드라이버 지원안한다고 배째고 -_-

 

공식 사이트 검색해보니

2022년 8월 23일 드라이버를 마지막으로 지원하는 것으로 보인다.

[링크 : https://www.wacom.com/ko-kr/support/product-support/drivers]

 

그래서 귀찮아(!) 리눅스에서 꽂아보니 잘되긴 한데

 

커널로그는 다음고 같이 Intuos PS로 인식한다. Pen Small

[  369.539929] usb 1-1.1: new full-speed USB device number 5 using ehci-pci
[  369.624274] usb 1-1.1: New USB device found, idVendor=056a, idProduct=030e, bcdDevice= 1.00
[  369.624282] usb 1-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[  369.624284] usb 1-1.1: Product: Intuos PS
[  369.624285] usb 1-1.1: Manufacturer: Wacom Co.,Ltd.
[  369.629350] wacom 0003:056A:030E.0004: hidraw0: USB HID v1.10 Device [Wacom Co.,Ltd. Intuos PS] on usb-0000:00:1d.0-1.1/input0
[  369.629393] input: Wacom Intuos S Pen as /devices/pci0000:00/0000:00:1d.0/usb1/1-1/1-1.1/1-1.1:1.0/0003:056A:030E.0004/input/input29
[  369.630798] wacom 0003:056A:030E.0005: hidraw1: USB HID v1.10 Device [Wacom Co.,Ltd. Intuos PS] on usb-0000:00:1d.0-1.1/input1
[  369.630833] input: Wacom Intuos S Pad as /devices/pci0000:00/0000:00:1d.0/usb1/1-1/1-1.1/1-1.1:1.1/0003:056A:030E.0005/input/input34

 

그 와중에 버튼은 왜 또 순서가 안 맞냐...

'하드웨어 > pen tablet' 카테고리의 다른 글

wacom 2k pen  (0) 2025.11.07
CTL-472 one by wacom 도착  (0) 2025.09.14
xsetwacom with intuos pen & touch tablet  (0) 2025.09.10
cth-490 on ubuntu  (0) 2025.09.08
와콤 cth-490 지름  (2) 2025.09.06
Posted by 구차니